aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore24
-rw-r--r--BRMSGateway/config.properties12
-rw-r--r--BRMSGateway/dependency.json131
-rw-r--r--BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSHandler.java3
-rw-r--r--BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java39
-rw-r--r--BRMSGateway/src/test/resources/config.properties2
-rw-r--r--LogParser/parserlog.properties8
-rw-r--r--LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java4
-rw-r--r--LogParser/src/test/resources/test_config.properties4
-rw-r--r--ONAP-PAP-REST/policyelk.properties4
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java60
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java9
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java5
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java40
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java5
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java7
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java6
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java6
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java2
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java12
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/ia/DbAuditCompareEntriesTest.java2
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java431
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java22
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java2
-rw-r--r--ONAP-PAP-REST/xacml.pap.properties4
-rw-r--r--ONAP-PDP-REST/pom.xml4
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java8
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java9
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java3
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java2
-rw-r--r--ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java103
-rw-r--r--ONAP-PDP-REST/src/test/resources/META-INF/drop.ddl7
-rw-r--r--ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml201
-rw-r--r--ONAP-PDP-REST/src/test/resources/fail.xacml.pdp.properties4
-rw-r--r--ONAP-PDP-REST/src/test/resources/notification.xacml.pdp.properties4
-rw-r--r--ONAP-PDP-REST/src/test/resources/pass.xacml.pdp.properties4
-rw-r--r--ONAP-PDP-REST/src/test/resources/xacml.pdp.properties176
-rw-r--r--ONAP-PDP-REST/xacml.pdp.properties4
-rw-r--r--ONAP-PDP/pom.xml5
-rw-r--r--ONAP-SDK-APP/pom.xml27
-rw-r--r--ONAP-SDK-APP/src/main/java/org/openecomp/portalapp/login/LoginStrategyImpl.java36
-rw-r--r--ONAP-SDK-APP/src/main/resources/portal.properties11
-rw-r--r--ONAP-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties6
-rw-r--r--ONAP-SDK-APP/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2Header.html68
-rw-r--r--ONAP-SDK-APP/xacml.admin.properties4
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPAPPolicy.java2
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java22
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java101
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPAPPolicyTest.java543
-rw-r--r--POLICY-SDK-APP/pom.xml10
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java8
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java137
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java7
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java18
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java27
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java12
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java12
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java8
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java8
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java4
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java7
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java14
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java14
-rw-r--r--POLICY-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties4
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html4
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js6
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js7
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js7
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js7
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js7
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js9
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js6
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js7
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js7
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html23
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/CheckPDPTest.java42
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java12
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java94
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java232
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java12
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java50
-rw-r--r--POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt2
-rw-r--r--POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt2
-rw-r--r--POLICY-SDK-APP/src/test/resources/test.properties21
-rw-r--r--POLICY-SDK-APP/src/test/resources/xacml.admin.properties4
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyParameters.java21
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java6
-rw-r--r--PolicyEngineClient/testResources/test.drl2
-rw-r--r--PolicyEngineUtils/pom.xml4
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/api/LoadedPolicy.java60
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationHandler.java17
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationType.java57
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/api/PDPNotification.java44
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/api/RemovedPolicy.java30
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/api/UpdateType.java49
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/jpa/BackUpMonitorEntity.java154
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/std/NotificationStore.java443
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/std/StdPDPNotification.java88
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/utils/BackUpMonitor.java4
-rw-r--r--PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/PolicyUtilsTest.java2
-rw-r--r--PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/testBackUpMonitor.java26
-rw-r--r--docs/index.rst5
-rwxr-xr-xdocs/platform/PolicyArchitectureDetails.pngbin0 -> 240372 bytes
-rwxr-xr-xdocs/platform/PolicyEngineApiList.pngbin0 -> 647514 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Access.pngbin0 -> 496702 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Admin.pngbin0 -> 167777 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Dashboard.pngbin0 -> 363623 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Dictionary.pngbin0 -> 497540 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Editor.pngbin0 -> 304599 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Editor_CreatePolicy.pngbin0 -> 519210 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Editor_PolicyActions.pngbin0 -> 336600 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Editor_PolicyActionsDetail.pngbin0 -> 520752 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Editor_Scope.pngbin0 -> 333349 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_PDP.pngbin0 -> 513409 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Push.pngbin0 -> 448178 bytes
-rwxr-xr-xdocs/platform/PolicyGUI_Roles.pngbin0 -> 220140 bytes
-rwxr-xr-xdocs/platform/PolicyR1Architecture.pngbin0 -> 271523 bytes
-rwxr-xr-xdocs/platform/PolicyTargetArchitecture.pngbin0 -> 532121 bytes
-rwxr-xr-xdocs/platform/api-docs.json1
-rw-r--r--docs/platform/architecture.rst98
-rw-r--r--docs/platform/index.rst12
-rw-r--r--docs/platform/installation.rst315
-rw-r--r--docs/platform/offeredapis.rst49
-rw-r--r--docs/platform/policygui.rst136
-rw-r--r--docs/release-notes/bug-fixes.rst86
-rw-r--r--docs/release-notes/deprecation-notes.rst5
-rw-r--r--docs/release-notes/index.rst11
-rw-r--r--docs/release-notes/known-issues.rst17
-rw-r--r--docs/release-notes/new-features.rst140
-rw-r--r--docs/release-notes/other.rst5
-rw-r--r--docs/release-notes/security-issues.rst5
-rw-r--r--docs/release-notes/upgrade-notes.rst5
-rwxr-xr-xpackages/base/src/files/install/mysql/data/161000_upgrade_script.sql14
-rw-r--r--packages/base/src/files/install/mysql/data/171001_upgrade_script.sql4
-rw-r--r--packages/base/src/files/install/servers/brmsgw/config.properties8
-rw-r--r--packages/base/src/files/install/servers/brmsgw/dependency.json73
-rwxr-xr-xpackages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml93
-rwxr-xr-xpackages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml93
-rw-r--r--packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_MS_vFirewall.1.xml114
-rw-r--r--packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_MS_vLoadBalancer.1.xml114
-rw-r--r--packages/base/src/files/install/servers/onap/WEB-INF/classes/portal.properties11
-rw-r--r--packages/base/src/files/install/servers/onap/WEB-INF/conf/system.properties2
-rw-r--r--packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml93
-rw-r--r--packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml93
-rw-r--r--packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_MS_vFirewall.1.xml114
-rw-r--r--packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_MS_vLoadBalancer.1.xml114
-rw-r--r--packages/base/src/files/install/servers/pap/bin/pdps/default/xacml.pip.properties6
-rw-r--r--packages/base/src/files/install/servers/pap/bin/pdps/default/xacml.policy.properties8
-rwxr-xr-xpackages/base/src/files/install/servers/pap/webapps/Config/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt1145
-rwxr-xr-xpackages/base/src/files/install/servers/pap/webapps/Config/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt1145
-rw-r--r--packages/base/src/files/install/servers/pap/webapps/Config/com.Config_MS_vFirewall.1.json1
-rw-r--r--packages/base/src/files/install/servers/pap/webapps/Config/com.Config_MS_vLoadBalancer.1.json1
-rw-r--r--packages/base/src/files/install/servers/pdp/bin/xacml.pdp.properties2
-rw-r--r--packages/base/src/files/m2/settings.xml36
-rw-r--r--packages/install/src/files/base.conf6
-rw-r--r--packages/install/src/files/brmsgw.conf6
-rw-r--r--pom.xml2
162 files changed, 4191 insertions, 4063 deletions
diff --git a/.gitignore b/.gitignore
index 46f3928ab..4640bd995 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,27 @@ XACML-PDP-REST/catalina.base_IS_UNDEFINED/logs/Policy/XACML-PDP-REST/metrics.log
XACML-REST/IntegrityMonitor.log
/bin/
*.checkstyle
+BRMSGateway/logs/
+BRMSGateway/sql/
+BRMSGateway/src/test/resources/META-INF/generatedCreate.ddl
+BRMSGateway/src/test/resources/META-INF/generatedDrop.ddl
+BRMSGateway/src/test/resources/failure.properties
+LogParser/logs/
+ONAP-PAP-REST/catalina.base_IS_UNDEFINED/
+ONAP-PAP-REST/pdps/
+ONAP-PAP-REST/sql/
+ONAP-PAP-REST/src/test/resources/generatedCreate.ddl
+ONAP-PAP-REST/src/test/resources/generatedDrop.ddl
+ONAP-PAP-REST/src/test/resources/webapps/
+ONAP-PDP-REST/catalina.base_IS_UNDEFINED/
+ONAP-PDP-REST/sql/
+ONAP-PDP-REST/src/test/resources/config_testing/
+ONAP-PDP-REST/src/test/resources/generatedCreate.ddl
+ONAP-PDP-REST/src/test/resources/generatedDrop.ddl
+ONAP-PDP-REST/topicBackup.txt
+ONAP-PDP/logs/
+ONAP-XACML/logs/
+ONAP-XACML/src/test/resources/pdpstest/
+POLICY-SDK-APP/catalina.base_IS_UNDEFINED/
+PolicyEngineAPI/logs/
+PolicyEngineUtils/logs/
diff --git a/BRMSGateway/config.properties b/BRMSGateway/config.properties
index 762f0ff1f..b17804bd5 100644
--- a/BRMSGateway/config.properties
+++ b/BRMSGateway/config.properties
@@ -47,19 +47,17 @@ repositoryPassword=admin123
policyKeyID = controller
## GroupNames can be comma separated values.
-groupNames = default, vFW , vDNS
+groupNames = default, amsterdam
default.groupID = org.onap.policy-engine
default.artifactID = drlPDPGroup
-vFW.groupID= org.onap.policy-engine.drools.vFW
-vFW.artifactID= policy-vFW-rules
-vDNS.groupID= org.onap.policy-engine.drools.vDNS
-vDNS.artifactID= policy-vDNS-rules
+amsterdam.groupID= org.onap.policy-engine.drools.amsterdam
+amsterdam.artifactID= policy-amsterdam-rules
#Integrity Monitor values
#database driver for Integrity Monitor
-javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
+javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
#database URL for Integrity Monitor
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/xacml
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk
#database username for Integrity Monitor
javax.persistence.jdbc.user=policy_user
#database password for Integrity Monitor
diff --git a/BRMSGateway/dependency.json b/BRMSGateway/dependency.json
index a883cc9da..f758db096 100644
--- a/BRMSGateway/dependency.json
+++ b/BRMSGateway/dependency.json
@@ -1,33 +1,102 @@
{
- "dependencies": {
- "default": [{
- "groupId": "org.onap.policy.drools-applications",
- "artifactId": "demo",
- "version": "1.1.0-SNAPSHOT"
- }, {
- "groupId": "org.onap.policy.drools-applications",
- "artifactId": "events",
- "version": "1.1.0-SNAPSHOT"
- }, {
- "groupId": "org.onap.policy.drools-applications",
- "artifactId": "rest",
- "version": "1.1.0-SNAPSHOT"
- }, {
- "groupId": "org.onap.policy.drools-applications",
- "artifactId": "appc",
- "version": "1.1.0-SNAPSHOT"
- }, {
- "groupId": "org.onap.policy.drools-applications",
- "artifactId": "aai",
- "version": "1.1.0-SNAPSHOT"
- }, {
- "groupId": "org.onap.policy.drools-applications",
- "artifactId": "mso",
- "version": "1.1.0-SNAPSHOT"
- }, {
- "groupId": "org.onap.policy.drools-applications",
- "artifactId": "trafficgenerator",
- "version": "1.1.0-SNAPSHOT"
- }]
- }
+ "dependencies": {
+ "default": [{
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "demo",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "events",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "rest",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "appc",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "aai",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "mso",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "trafficgenerator",
+ "version": "1.1.0-SNAPSHOT"
+ }],
+ "amsterdam": [{
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "events",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "appc",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "appclcm",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "vfc",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "so",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "aai",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "sdc",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "trafficgenerator",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "eventmanager",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "guard",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actorServiceProvider",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actor.appc",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actor.appclcm",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actor.so",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actor.vfc",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "policy-yaml",
+ "version": "1.1.0-SNAPSHOT"
+ }, {
+ "groupId": "com.att.research.xacml",
+ "artifactId": "xacml-pdp",
+ "version": "1.0.0"
+ }]
+ }
} \ No newline at end of file
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSHandler.java b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSHandler.java
index 43031861b..a11e8b4b7 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSHandler.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSHandler.java
@@ -95,7 +95,7 @@ public class BRMSHandler implements BackUpHandler{
}
}
}
- Boolean failureFlag = false;
+ Boolean failureFlag;
int i = 0;
do{
failureFlag = false;
@@ -118,6 +118,7 @@ public class BRMSHandler implements BackUpHandler{
* (non-Javadoc)
* @see org.onap.policy.utils.BackUpHandler#runOnNotification(org.onap.policy.api.PDPNotification)
*/
+ @Override
public void runOnNotification(PDPNotification notification){
if(notification.getNotificationType().equals(NotificationType.REMOVE)){
removedPolicies(notification.getRemovedPolicies());
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
index c923c3c34..266e090a2 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
@@ -109,6 +109,7 @@ public class BRMSPush {
private static final String[] GOALS = { "clean", "deploy" };
private static final String DEFAULT_VERSION = "1.1.0-SNAPSHOT";
private static final String DEPENDENCY_FILE = "dependency.json";
+ private static final String BRMSPERSISTENCE = "brmsEclipselink.persistencexml";
private static Map<String, String> modifiedGroups = new HashMap<>();
private static IntegrityMonitor im;
@@ -188,8 +189,10 @@ public class BRMSPush {
} catch (Exception e) {
LOGGER.error("Error starting BackUpMonitor: " + e);
}
- if(!config.containsKey(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML)){
+ if(!config.containsKey(BRMSPERSISTENCE)){
config.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "META-INF/persistenceBRMS.xml");
+ } else {
+ config.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, config.getProperty(BRMSPERSISTENCE,"META-INF/persistenceBRMS.xml"));
}
EntityManagerFactory emf = Persistence.createEntityManagerFactory("BRMSGW", config);
em = emf.createEntityManager();
@@ -388,11 +391,11 @@ public class BRMSPush {
selectedName = responseAttributes.get(key);
}
// kmodule configurations
- else if (key.equals("kSessionName")) {
+ else if ("kSessionName".equals(key)) {
kSessionName = responseAttributes.get(key);
}
// Check User Specific values.
- if (key.equals("$controller:")) {
+ if ("$controller:".equals(key)) {
try {
PEDependency dependency = PolicyUtils.jsonStringToObject(responseAttributes.get(key),
PEDependency.class);
@@ -402,7 +405,7 @@ public class BRMSPush {
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while resolving Controller: " + e);
}
- } else if (key.equals("$dependency$")) {
+ } else if ("$dependency$".equals(key)) {
String value = responseAttributes.get(key);
if (value.startsWith("[") && value.endsWith("]")) {
value = value.substring(1, value.length() - 1).trim();
@@ -500,7 +503,7 @@ public class BRMSPush {
List<?> pList = query.getResultList();
boolean createFlag = false;
BRMSPolicyInfo brmsPolicyInfo = new BRMSPolicyInfo();
- if (pList.size() > 0) {
+ if (!pList.isEmpty()) {
// Already exists.
brmsPolicyInfo = (BRMSPolicyInfo) pList.get(0);
if (!brmsPolicyInfo.getControllerName().getControllerName().equals(controllerName)) {
@@ -514,7 +517,7 @@ public class BRMSPush {
query.setParameter("cn", controllerName);
List<?> bList = query.getResultList();
BRMSGroupInfo brmsGroupInfo = new BRMSGroupInfo();
- if (bList.size() > 0) {
+ if (!bList.isEmpty()) {
brmsGroupInfo = (BRMSGroupInfo) bList.get(0);
}
brmsPolicyInfo.setPolicyName(policyName);
@@ -528,7 +531,7 @@ public class BRMSPush {
private void syncProject(String selectedName) {
boolean projectExists = checkProject(selectedName);
if (projectExists) {
- String version = null;
+ String version;
version = getVersion(selectedName);
if (version == null) {
LOGGER.error("Error getting local version for the given Controller Name:" + selectedName
@@ -599,7 +602,6 @@ public class BRMSPush {
}
fos.close();
is.close();
- f = null;
LOGGER.info(fileName + " Created..");
}
}
@@ -641,7 +643,7 @@ public class BRMSPush {
private boolean checkRemoteSync(String selectedName, String version) {
List<NexusArtifact> artifacts = getArtifactFromNexus(selectedName, version);
- return (artifacts.size() == 0) ? false : true;
+ return artifacts.isEmpty() ? false : true;
}
private List<NexusArtifact> getArtifactFromNexus(String selectedName, String version) {
@@ -690,7 +692,7 @@ public class BRMSPush {
if (artifact != null) {
newVersion = incrementVersion(artifact.getVersion());
}
- if (newVersion.equals("0.1.0")) {
+ if ("0.1.0".equals(newVersion)) {
createFlag = true;
}
setVersion(newVersion, selectedName);
@@ -736,8 +738,9 @@ public class BRMSPush {
}
if (!modifiedGroups.isEmpty()) {
Boolean flag = false;
- for (String group : modifiedGroups.keySet()) {
+ for (Map.Entry<String, String> entry : modifiedGroups.entrySet()) {
InvocationResult result = null;
+ String group = entry.getKey();
try {
InvocationRequest request = new DefaultInvocationRequest();
setVersion(group);
@@ -761,7 +764,7 @@ public class BRMSPush {
if (createFlag) {
addNotification(group, "create");
} else {
- addNotification(group, modifiedGroups.get(group));
+ addNotification(group, entry.getValue());
}
flag = true;
} else {
@@ -795,7 +798,7 @@ public class BRMSPush {
return policyMap.get(name);
} else {
syncGroupInfo();
- return (policyMap.containsKey(name)) ? policyMap.get(name) : null;
+ return policyMap.containsKey(name) ? policyMap.get(name) : null;
}
}
@@ -869,7 +872,7 @@ public class BRMSPush {
pub.send("MyPartitionKey", message);
final List<?> stuck = pub.close(uebDelay, TimeUnit.SECONDS);
- if (stuck.size() > 0) {
+ if (!stuck.isEmpty()) {
LOGGER.error(stuck.size() + " messages unsent");
} else {
LOGGER.debug("Clean exit; Message Published on UEB : " + uebList + "for Topic: " + pubTopic);
@@ -1018,7 +1021,7 @@ public class BRMSPush {
}
private void readGroups(Properties config) throws PolicyException {
- String[] groupNames = null;
+ String[] groupNames;
if (!config.containsKey("groupNames") || config.getProperty("groupNames")==null){
throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE
+ "groupNames property is missing or empty from the property file ");
@@ -1069,7 +1072,7 @@ public class BRMSPush {
query.setParameter("cn", name);
List<?> groupList = query.getResultList();
BRMSGroupInfo brmsGroupInfo = null;
- if (groupList.size() > 0) {
+ if (!groupList.isEmpty()) {
LOGGER.info("Controller name already Existing in DB. Will be updating the DB Values" + name);
brmsGroupInfo = (BRMSGroupInfo) groupList.get(0);
}
@@ -1122,8 +1125,8 @@ public class BRMSPush {
Query query = em.createQuery("select b from BRMSPolicyInfo as b where b.policyName = :pn");
query.setParameter("pn", policyName);
List<?> pList = query.getResultList();
- BRMSPolicyInfo brmsPolicyInfo = new BRMSPolicyInfo();
- if (pList.size() > 0) {
+ BRMSPolicyInfo brmsPolicyInfo;
+ if (!pList.isEmpty()) {
// Already exists.
brmsPolicyInfo = (BRMSPolicyInfo) pList.get(0);
if (brmsPolicyInfo.getControllerName().getControllerName().equals(controllerName)) {
diff --git a/BRMSGateway/src/test/resources/config.properties b/BRMSGateway/src/test/resources/config.properties
index 4f9e01305..8c46ec277 100644
--- a/BRMSGateway/src/test/resources/config.properties
+++ b/BRMSGateway/src/test/resources/config.properties
@@ -65,7 +65,7 @@ javax.persistence.jdbc.user=sa
#database password for Integrity Monitor
javax.persistence.jdbc.password=
#persistence xml
-eclipselink.persistencexml=META-INF/persistenceBRMStest.xml
+brmsEclipselink.persistencexml=META-INF/persistenceBRMStest.xml
#resource name
RESOURCE_NAME=site_1.brmsgw_1
#***Properties for IntegrityMonitor integration defined in IntegrityMonitorProperties.java***
diff --git a/LogParser/parserlog.properties b/LogParser/parserlog.properties
index 4a5ecdb9c..66ce34d19 100644
--- a/LogParser/parserlog.properties
+++ b/LogParser/parserlog.properties
@@ -20,14 +20,14 @@
#Health Check Values
RESOURCE_NAME=logparser_pap01
-javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/onap_sdk
+javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk
javax.persistence.jdbc.user=policy_user
javax.persistence.jdbc.password=policy_user
#Log Parser application values
-JDBC_DRIVER=com.mysql.jdbc.Driver
-JDBC_URL=jdbc:mysql://localhost:3306/log
+JDBC_DRIVER=org.mariadb.jdbc.Driver
+JDBC_URL=jdbc:mariadb://localhost:3306/log
JDBC_USER=policy_user
JDBC_PASSWORD=policy_user
SERVER=https://localhost:9091/pap/
diff --git a/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java b/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java
index c12797f28..1f42ac39b 100644
--- a/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java
+++ b/LogParser/src/test/java/org/onap/xacml/parser/ParseLogTest.java
@@ -122,8 +122,8 @@ public class ParseLogTest {
config = new Properties();
config.put("RESOURCE_NAME", "logparser_pap01");
- config.put("JDBC_DRIVER" ,"com.mysql.jdbc.Driver");
- config.put("JDBC_URL", "jdbc:mysql://localhost:3306/");
+ config.put("JDBC_DRIVER" ,"org.mariadb.jdbc.Driver");
+ config.put("JDBC_URL", "jdbc:mariadb://localhost:3306/");
config.put("JDBC_USER", "root");
config.put("JDBC_PASSWORD", "password");
config.put("JMX_URL", "service:jmx:rmi:///jndi/rmi://localhost:9998/jmxrmi");
diff --git a/LogParser/src/test/resources/test_config.properties b/LogParser/src/test/resources/test_config.properties
index 6512184c8..ca2b9edc9 100644
--- a/LogParser/src/test/resources/test_config.properties
+++ b/LogParser/src/test/resources/test_config.properties
@@ -20,8 +20,8 @@
RESOURCE_NAME=logparser_pap01
-JDBC_DRIVER=com.mysql.jdbc.Driver
-JDBC_URL=jdbc:mysql://localhost:3306/
+JDBC_DRIVER=org.mariadb.jdbc.Driver
+JDBC_URL=jdbc:mariadb://localhost:3306/
JDBC_USER=root
JDBC_PASSWORD=password
jmx_url=service:jmx:rmi:///jndi/rmi://localhost:9996/jmxrmi
diff --git a/ONAP-PAP-REST/policyelk.properties b/ONAP-PAP-REST/policyelk.properties
index 386008ce5..d07fab90a 100644
--- a/ONAP-PAP-REST/policyelk.properties
+++ b/ONAP-PAP-REST/policyelk.properties
@@ -24,7 +24,7 @@ policy.elk.url=http://localhost:9200
#Policy Database properties
-policy.database.driver=com.mysql.jdbc.Driver
-policy.database.url=jdbc:mysql://localhost:3306/onap_sdk?autoReconnect=true&useSSL=false
+policy.database.driver=org.mariadb.jdbc.Driver
+policy.database.url=jdbc:mariadb://localhost:3306/onap_sdk?autoReconnect=true&useSSL=false
policy.database.username=policy_user
policy.database.password=policy_user \ No newline at end of file
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
index b27dd22ca..3ed2ee37d 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
@@ -34,6 +34,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -116,10 +117,8 @@ public class CreateBrmsParamPolicy extends Policy {
// Utility to read json data from the existing file to a string
static String readFile(String path, Charset encoding) throws IOException {
-
byte[] encoded = Files.readAllBytes(Paths.get(path));
return new String(encoded, encoding);
-
}
// Saving the Configurations file at server location for config policy.
@@ -135,8 +134,6 @@ public class CreateBrmsParamPolicy extends Policy {
policyAdapter.setJsonBody(expandedBody);
policyAdapter.setConfigBodyData(expandedBody);
out.close();
-
-
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving configuration file");
}
@@ -207,7 +204,7 @@ public class CreateBrmsParamPolicy extends Policy {
Map<String, String> mapFieldType= new HashMap<>();
if(rule!=null){
try {
- String params = "";
+ StringBuilder params = new StringBuilder();
Boolean flag = false;
Boolean comment = false;
String lines[] = rule.split("\n");
@@ -252,19 +249,19 @@ public class CreateBrmsParamPolicy extends Policy {
continue;
}
if (flag) {
- params = params + line;
+ params.append(line);
}
- if (line.contains("declare Params")) {
- params = params + line;
+ if (line.contains("declare PapParams")) {
+ params.append(line);
flag = true;
}
if (line.contains("end") && flag) {
break;
}
}
- params = params.replace("declare Params", "").replace("end", "")
+ String param = params.toString().replace("declare PapParams", "").replace("end", "")
.replaceAll("\\s+", "");
- String[] components = params.split(":");
+ String[] components = param.split(":");
String caption = "";
for (int i = 0; i < components.length; i++) {
String type = "";
@@ -335,16 +332,16 @@ public class CreateBrmsParamPolicy extends Policy {
//Get the type of the UI Fields.
Map<String,String> typeOfUIField=findType(valueFromDictionary);
- String generatedRule=null;
- String body = "";
+ StringBuilder generatedRule = new StringBuilder();
+ StringBuilder body = new StringBuilder();
try {
try {
- body = "/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI purpose. \n\t " +
- "<$%BRMSParamTemplate=" + tempateValue + "%$> \n */ \n";
- body = body + valueFromDictionary + "\n";
- generatedRule = "rule \"" +policyName.substring(0, policyName.replace(".xml", "").lastIndexOf(".")) +".Params\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tParams params = new Params();";
+ body.append("/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI purpose. \n\t " +
+ "<$%BRMSParamTemplate=" + tempateValue + "%$> \n */ \n");
+ body.append(valueFromDictionary + "\n");
+ generatedRule.append("rule \"" +policyName.substring(0, policyName.replace(".xml", "").lastIndexOf(".")) +".PapParams\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tPapParams params = new PapParams();");
//We first read the map data structure(ruleAndUIValue) received from the PAP-ADMIN
//We ignore if the key is "templateName as we are interested only in the UI fields and its value.
@@ -361,24 +358,23 @@ public class CreateBrmsParamPolicy extends Policy {
if(fieldType.getValue()=="String")
{
//Type is String
- generatedRule = generatedRule + "\n\t\tparams.set"
+ generatedRule.append("\n\t\tparams.set"
+ key + "(\""
- + entry.getValue() + "\");";
+ + entry.getValue() + "\");");
}
else{
- generatedRule = generatedRule + "\n\t\tparams.set"
+ generatedRule.append("\n\t\tparams.set"
+ key + "("
- + entry.getValue() + ");";
+ + entry.getValue() + ");");
}
}
}
}
}
- generatedRule = generatedRule
- + "\n\t\tinsert(params);\nend";
+ generatedRule.append("\n\t\tinsert(params);\nend");
LOGGER.info("New rule generated with :" + generatedRule);
- body = body + generatedRule;
+ body.append(generatedRule);
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving policy");
}
@@ -387,10 +383,10 @@ public class CreateBrmsParamPolicy extends Policy {
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving policy");
}
- saveConfigurations(policyName,body);
+ saveConfigurations(policyName,body.toString());
// Make sure the filename ends with an extension
- if (policyName.endsWith(".xml") == false) {
+ if (!policyName.endsWith(".xml")) {
policyName = policyName + ".xml";
}
@@ -429,7 +425,7 @@ public class CreateBrmsParamPolicy extends Policy {
anyOf.getAllOf().add(allOf);
TargetType target = new TargetType();
- ((TargetType) target).getAnyOf().add(anyOf);
+ target.getAnyOf().add(anyOf);
// Adding the target to the policy element
configPolicy.setTarget((TargetType) target);
@@ -536,14 +532,14 @@ public class CreateBrmsParamPolicy extends Policy {
assignment2.setAttributeId("URLID");
assignment2.setCategory(CATEGORY_RESOURCE);
assignment2.setIssuer("");
- AttributeValueType AttributeValue = new AttributeValueType();
- AttributeValue.setDataType(URI_DATATYPE);
+ AttributeValueType attributeValue = new AttributeValueType();
+ attributeValue.setDataType(URI_DATATYPE);
String content = CONFIG_URL + "/Config/"+ getConfigFile(policyName);
- AttributeValue.getContent().add(content);
+ attributeValue.getContent().add(content);
assignment2.setExpression(new ObjectFactory()
- .createAttributeValue(AttributeValue));
+ .createAttributeValue(attributeValue));
advice.getAttributeAssignmentExpression().add(assignment2);
// Policy Name Assignment
@@ -624,8 +620,8 @@ public class CreateBrmsParamPolicy extends Policy {
// Dynamic Field Config Attributes.
Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
- for (String keyField : dynamicFieldConfigAttributes.keySet()) {
- advice.getAttributeAssignmentExpression().add(createResponseAttributes("key:"+keyField, dynamicFieldConfigAttributes.get(keyField)));
+ for (Entry<String, String> map : dynamicFieldConfigAttributes.entrySet()) {
+ advice.getAttributeAssignmentExpression().add(createResponseAttributes("key:"+map.getKey(), map.getValue()));
}
//Risk Attributes
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java
index eae3e79a9..22d2da311 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java
@@ -63,6 +63,7 @@ import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.std.pip.engines.aaf.AAFEngine;
import org.onap.policy.xacml.util.XACMLPolicyScanner;
+import com.att.research.xacml.api.XACML3;
import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.std.IdentifierImpl;
@@ -229,7 +230,8 @@ public class DecisionPolicy extends Policy {
decisionPolicy.setTarget(target);
Map<String, String> dynamicFieldDecisionSettings = policyAdapter.getDynamicSettingsMap();
- if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals(AAFPROVIDER)){
+ if(policyAdapter.getRuleProvider()!=null && (policyAdapter.getRuleProvider().equals(AAFPROVIDER)||
+ policyAdapter.getRuleProvider().equals(RAINY_DAY))){
dynamicFieldDecisionSettings = new HashMap<>();
}
@@ -241,8 +243,8 @@ public class DecisionPolicy extends Policy {
VariableDefinitionType dynamicVariable = createDynamicVariable(key, value, dataType);
decisionPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(dynamicVariable);
}
- Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap();
+ Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap();
if(policyAdapter.getRuleProvider().equals(RAINY_DAY)){
for(String keyField : dynamicFieldTreatmentAttributes.keySet()) {
String errorcode = keyField;
@@ -423,7 +425,6 @@ public class DecisionPolicy extends Policy {
// Values for AAF Provider are here for XML Creation.
ConditionType condition = new ConditionType();
ApplyType decisionApply = new ApplyType();
- String selectedFunction = "boolean-equal";
AttributeValueType value1 = new AttributeValueType();
value1.setDataType(BOOLEAN_DATATYPE);
@@ -439,7 +440,7 @@ public class DecisionPolicy extends Policy {
innerDecisionApply.setFunctionId(FUNCTION_BOOLEAN_ONE_AND_ONLY);
innerDecisionApply.getExpression().add(new ObjectFactory().createAttributeDesignator(value2));
- decisionApply.setFunctionId(dropDownMap.get(selectedFunction));
+ decisionApply.setFunctionId(XACML3.ID_FUNCTION_BOOLEAN_EQUAL.stringValue());
decisionApply.getExpression().add(new ObjectFactory().createAttributeValue(value1));
decisionApply.getExpression().add(new ObjectFactory().createApply(innerDecisionApply));
condition.setExpression(new ObjectFactory().createApply(decisionApply));
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
index d142a46f3..675c82549 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
@@ -35,6 +35,7 @@ import org.json.JSONObject;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pap.xacml.rest.adapters.GridData;
+import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
import org.onap.policy.pap.xacml.rest.util.JsonMessage;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.ClosedLoopD2Services;
@@ -1042,6 +1043,10 @@ public class ClosedLoopDictionaryController{
}
return null;
}
+
+ public static void setCommonClassDao(CommonClassDaoImpl commonClassDaoImpl) {
+ commonClassDao = commonClassDaoImpl;
+ }
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
index aac777a67..f4e32ebea 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
@@ -20,19 +20,9 @@
package org.onap.policy.pap.xacml.rest.controller;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.json.JSONObject;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
@@ -49,9 +39,17 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
@Controller
public class DecisionPolicyDictionaryController {
@@ -184,7 +182,7 @@ public class DecisionPolicyDictionaryController {
}
if (fromAPI) {
- if (responseString!=null && !responseString.equals("Duplicate")) {
+ if (!"Duplicate".equals(responseString)) {
if(isFakeUpdate){
responseString = "Exists";
} else {
@@ -264,7 +262,7 @@ public class DecisionPolicyDictionaryController {
@RequestMapping(value={"/get_RainyDayDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getRainyDayDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
+ public void getRainyDayDictionaryEntityData(HttpServletResponse response){
try{
Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
@@ -329,8 +327,8 @@ public class DecisionPolicyDictionaryController {
counter ++;
}
}
+ decisionRainyDay.setTreatments(userValue);
}
- decisionRainyDay.setTreatments(userValue);
if(decisionRainyDay.getId() == 0){
List<Object> duplicateData = commonClassDao.checkDuplicateEntry(decisionRainyDay.getBbid()+":"+decisionRainyDay.getWorkstep(), "bbid:workstep", RainyDayTreatments.class);
@@ -352,7 +350,7 @@ public class DecisionPolicyDictionaryController {
}
if (fromAPI) {
- if (responseString!=null && !responseString.equals("Duplicate")) {
+ if (!"Duplicate".equals(responseString)) {
if(isFakeUpdate){
responseString = "Exists";
} else {
@@ -416,7 +414,7 @@ public class DecisionPolicyDictionaryController {
}
class TreatmentValues {
- private ArrayList<Object> userDataTypeValues;
+ private ArrayList<Object> userDataTypeValues = new ArrayList<>();
public ArrayList<Object> getUserDataTypeValues() {
return userDataTypeValues;
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
index 86706d154..3a4d7b71b 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
@@ -103,6 +103,11 @@ public class FirewallDictionaryController {
public FirewallDictionaryController(CommonClassDao commonClassDao){
FirewallDictionaryController.commonClassDao = commonClassDao;
}
+
+ public static void setCommonClassDao(CommonClassDao clDao){
+ commonClassDao = clDao;
+ }
+
/*
* This is an empty constructor
*/
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
index 5d2b7f6c7..1766cb302 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java
@@ -242,7 +242,12 @@ public class CommonClassDaoImpl implements CommonClassDao{
try {
Query hbquery = session.createQuery(query);
for (Map.Entry<String, Object> paramPair : params.entrySet()) {
- hbquery.setParameter(paramPair.getKey(), paramPair.getValue());
+ if(paramPair.getValue() instanceof java.lang.Long){
+ hbquery.setLong(paramPair.getKey(), (long) paramPair.getValue());
+ }
+ else{
+ hbquery.setParameter(paramPair.getKey(), paramPair.getValue());
+ }
}
data = hbquery.list();
tx.commit();
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
index 97da76708..78da2a572 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
@@ -388,17 +388,17 @@ public class PolicyElasticSearchController{
case clVarbind :
VarbindDictionary varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("data").toString(), VarbindDictionary.class);
value = varbindDictionary.getVarbindName();
- policyList = searchElkDatabase(closedloop, "jsonBodyData.triggerSignaturesUsedForUI.signatures",value);
+ policyList = searchElkDatabase(closedloop, "jsonBodyData","*"+value+"*");
break;
case clVnf :
VNFType vNFType = (VNFType)mapper.readValue(root.get("data").toString(), VNFType.class);
value = vNFType.getVnftype();
- policyList = searchElkDatabase(closedloop, "jsonBodyData.vnfType",value);
+ policyList = searchElkDatabase(closedloop, "jsonBodyData","*"+value+"*");
break;
case clVSCL :
VSCLAction vsclAction = (VSCLAction)mapper.readValue(root.get("data").toString(), VSCLAction.class);
value = vsclAction.getVsclaction();
- policyList = searchElkDatabase(closedloop, "jsonBodyData.actions",value);
+ policyList = searchElkDatabase(closedloop, "jsonBodyData","*"+value+"*");
break;
case decision :
DecisionSettings decisionSettings = (DecisionSettings)mapper.readValue(root.get("data").toString(), DecisionSettings.class);
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java
index 13eee4a3f..ae749adb5 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java
@@ -69,6 +69,9 @@ public class DictionaryHandlerImpl implements DictionaryHandler{
case "Settings":
dictionary.getSettingsDictionary(response);
break;
+ case "RainyDayTreatments":
+ dictionary.getRainyDayDictionary(response);
+ break;
case "DescriptiveScope":
dictionary.getDescriptiveDictionary(response);
break;
@@ -212,6 +215,9 @@ public class DictionaryHandlerImpl implements DictionaryHandler{
case "Settings":
result = dictionary.saveSettingsDictionary(request, response);
break;
+ case "RainyDayTreatments":
+ result = dictionary.saveRainyDayDictionary(request, response);
+ break;
case "DescriptiveScope":
result = dictionary.saveDescriptiveDictionary(request, response);
break;
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java
index c86ded43f..e7680c3e2 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java
@@ -131,6 +131,8 @@ public class SavePolicyHandler {
policyAdapter.setRuleProvider(policy.getProviderComboBox());
policyAdapter.setDomainDir(policyAdapter.getPolicyScope());
policyAdapter.setDomain(policyAdapter.getPolicyScope());
+ policyAdapter.setRainydayMap(policy.getTreatments());
+
return policyAdapter;
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java
index 5b2fc4cd7..6e19b9b1c 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java
@@ -121,6 +121,13 @@ public class DictionaryService {
return result.getViewName();
}
+ public String saveRainyDayDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
+
+ DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
+ ModelAndView result = dictionary.saveRainyDayDictionary(request, response);
+ return result.getViewName();
+ }
+
public String saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
@@ -343,6 +350,11 @@ public class DictionaryService {
dictionary.getSettingsDictionaryEntityData(response);
}
+ public void getRainyDayDictionary(HttpServletResponse response){
+ DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
+ dictionary.getRainyDayDictionaryEntityData(response);
+ }
+
public void getDescriptiveDictionary(HttpServletResponse response){
DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
dictionary.getDescriptiveDictionaryEntityData(response);
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/ia/DbAuditCompareEntriesTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/ia/DbAuditCompareEntriesTest.java
index f913c181f..13255ba50 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/ia/DbAuditCompareEntriesTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/ia/DbAuditCompareEntriesTest.java
@@ -233,7 +233,7 @@ public class DbAuditCompareEntriesTest {
entry1.setFlag("flag1");
- entry1.setResoruceNodeName("node1");
+ entry1.setResourceNodeName("node1");
entry1.setResourceName("resourceName");
entry1.setTimeStamp(new Date());
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
index f110c5b6a..82088937e 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
@@ -23,11 +23,15 @@ package org.onap.policy.pap.test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import javax.servlet.ServletConfig;
@@ -43,8 +47,14 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.policy.pap.xacml.rest.XACMLPapServlet;
+import org.onap.policy.pap.xacml.rest.controller.ClosedLoopDictionaryController;
+import org.onap.policy.pap.xacml.rest.controller.FirewallDictionaryController;
import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
import org.onap.policy.pap.xacml.rest.policycontroller.PolicyCreation;
+import org.onap.policy.rest.dao.CommonClassDao;
+import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.PolicyEditorScopes;
+import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.utils.PolicyUtils;
import org.onap.policy.xacml.std.pap.StdPAPPolicy;
import org.springframework.mock.web.MockHttpServletResponse;
@@ -84,7 +94,7 @@ public class XACMLPAPTest {
@Test
public void testFirwallCreatePolicy() throws IOException, ServletException, SQLException {
httpServletRequest = Mockito.mock(HttpServletRequest.class);
- String json = "";
+ String json = "{\"serviceTypeId\":\"/v0/firewall/pan\",\"configName\":\"TestFwPolicyConfig\",\"deploymentOption\":{\"deployNow\":false},\"securityZoneId\":\"cloudsite:dev1a\",\"serviceGroups\":[{\"name\":\"SSH\",\"description\":\"Sshservice entry in servicelist\",\"type\":\"SERVICE\",\"transportProtocol\":\"tcp\",\"appProtocol\":null,\"ports\":\"22\"}],\"addressGroups\":[{\"name\":\"test\",\"description\":\"Destination\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"127.0.0.1/12\"}]},{\"name\":\"TestServers\",\"description\":\"SourceTestServers for firsttesting\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"127.0.0.1/23\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"FWRuleTestServerToTest\",\"fromZones\":[\"UntrustedZoneTestName\"],\"toZones\":[\"TrustedZoneTestName\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"name\":\"TestServers\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"name\":\"Test\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"SSH\"}],\"action\":\"accept\",\"description\":\"FWrule for Test source to Test destination\",\"enabled\":true,\"log\":true}]}";
Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
@@ -102,10 +112,429 @@ public class XACMLPAPTest {
Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
Mockito.verify(httpServletResponse).addHeader("successMapKey", "success");
Mockito.verify(httpServletResponse).addHeader("policyName", "test.Config_FW_test.1.xml");
+ }
+
+ @Test
+ public void testBRMSCreatePolicy() throws IOException, ServletException, SQLException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
+ Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
+ Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Config");
+ Map<String, String> matchingAttributes = new HashMap<>();
+ Map<String, String> ruleAttributes = new HashMap<>();
+ ruleAttributes.put("templateName", "testPolicy");
+ ruleAttributes.put("samPoll", "5");
+ ruleAttributes.put("value", "test");
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy("BRMS_Param","test", "testing",
+ "BRMS_PARAM_RULE",false,"test",
+ matchingAttributes, 0, "DROOLS",
+ null, ruleAttributes, "5",
+ "default", "false", "", null, null);
+ MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
+ Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
+
+ // set DBDao
+ setDBDao();
+ setPolicyCreation();
+ pap.service(httpServletRequest, httpServletResponse);
+
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ Mockito.verify(httpServletResponse).addHeader("successMapKey", "success");
+ Mockito.verify(httpServletResponse).addHeader("policyName", "test.Config_BRMS_Param_test.1.xml");
+ }
+
+ @Test
+ public void testBRMSRawCreatePolicy() throws IOException, ServletException, SQLException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
+ Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
+ Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Config");
+ Map<String, String> ruleAttributes = new HashMap<>();
+ ruleAttributes.put("value", "test");
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy("BRMS_Raw","test","testig description",
+ "BRMS_RAW_RULE",false,"test", ruleAttributes, 0, "DROOLS",
+ "test", "4",
+ "default", "false", null, null, null);
+ MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
+ Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
+
+ // set DBDao
+ setDBDao();
+ setPolicyCreation();
+ pap.service(httpServletRequest, httpServletResponse);
+
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ Mockito.verify(httpServletResponse).addHeader("successMapKey", "success");
+ Mockito.verify(httpServletResponse).addHeader("policyName", "test.Config_BRMS_Raw_test.1.xml");
+ }
+
+ @Test
+ public void testClosedLoopPMCreatePolicy() throws IOException, ServletException, SQLException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
+ Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
+ Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Config");
+ String json = "{\"test\":\"java\"}";
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy("ClosedLoop_PM", "test", "testing", "onap",
+ json, false, null, "Registration Failure(Trinity)", false, "test", 0, null,
+ "default", "true", "");
+ MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
+ Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
+
+ // set DBDao
+ setDBDao();
+ setPolicyCreation();
+ pap.service(httpServletRequest, httpServletResponse);
+
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ Mockito.verify(httpServletResponse).addHeader("successMapKey", "success");
+ Mockito.verify(httpServletResponse).addHeader("policyName", "test.Config_PM_test.1.xml");
+ }
+
+ @Test
+ public void testDecisonAAFPolicy() throws IOException, ServletException, SQLException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
+ Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
+ Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Decision");
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy("test", "test rule", "ONAP", "AAF", null, null, null,
+ null, null, null, null, null, null, null, false, "test", 0);
+ MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
+ Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
+
+ // set DBDao
+ setDBDao();
+ pap.service(httpServletRequest, httpServletResponse);
+
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ Mockito.verify(httpServletResponse).addHeader("successMapKey", "success");
+ Mockito.verify(httpServletResponse).addHeader("policyName", "test.Decision_test.1.xml");
+ }
+
+ @Test
+ public void testDecisonGuardPolicy() throws IOException, ServletException, SQLException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
+ Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
+ Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Decision");
+ Map<String, String> matchingAttributes = new HashMap<>();
+ matchingAttributes.put("actor","test");
+ matchingAttributes.put("recipe","restart");
+ matchingAttributes.put("targets","test,test1");
+ matchingAttributes.put("clname","");
+ matchingAttributes.put("limit","1");
+ matchingAttributes.put("timeWindow","15");
+ matchingAttributes.put("timeUnits","minute");
+ matchingAttributes.put("guardActiveStart","05:00");
+ matchingAttributes.put("guardActiveEnd","10:00");
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy("testGuard", "test rule", "PDPD", "GUARD_YAML", matchingAttributes , null, null,
+ null, null, null, null, null, null, null, false, "test", 0);
+ MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
+ Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
+
+ // set DBDao
+ setDBDao();
+ pap.service(httpServletRequest, httpServletResponse);
+
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ Mockito.verify(httpServletResponse).addHeader("successMapKey", "success");
+ Mockito.verify(httpServletResponse).addHeader("policyName", "test.Decision_testGuard.1.xml");
+ }
+
+ @Test
+ public void testDecisonBLGuardPolicy() throws IOException, ServletException, SQLException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
+ Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
+ Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Decision");
+ Map<String, String> matchingAttributes = new HashMap<>();
+ matchingAttributes.put("actor","test");
+ matchingAttributes.put("recipe","restart");
+ matchingAttributes.put("clname","test");
+ matchingAttributes.put("guardActiveStart","05:00");
+ matchingAttributes.put("guardActiveEnd","10:00");
+ matchingAttributes.put("blackList","bl1,bl2");
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy("testblGuard", "test rule", "PDPD", "GUARD_BL_YAML", matchingAttributes , null, null,
+ null, null, null, null, null, null, null, false, "test", 0);
+ MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
+ Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
+
+ // set DBDao
+ setDBDao();
+ pap.service(httpServletRequest, httpServletResponse);
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ Mockito.verify(httpServletResponse).addHeader("successMapKey", "success");
+ Mockito.verify(httpServletResponse).addHeader("policyName", "test.Decision_testblGuard.1.xml");
}
+ @Test
+ public void testConfigPolicy() throws IOException, ServletException, SQLException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
+ Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
+ Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Config");
+ Map<String, String> configAttributes = new HashMap<>();
+ configAttributes.put("value", "test");
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy("Base", "test", "test rule", "TEST", "config", configAttributes, "OTHER",
+ "test body", false, "test",0, "5","default", "false", null);
+ MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
+ Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
+
+ // set DBDao
+ setDBDao();
+ pap.service(httpServletRequest, httpServletResponse);
+
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ Mockito.verify(httpServletResponse).addHeader("successMapKey", "success");
+ Mockito.verify(httpServletResponse).addHeader("policyName", "test.Config_test.1.xml");
+ }
+
+ private void setPolicyCreation() {
+ CommonClassDao commonClassDao = Mockito.mock(CommonClassDao.class);
+ PolicyCreation.setCommonClassDao(commonClassDao);
+ PolicyEditorScopes editorScope = new PolicyEditorScopes();
+ UserInfo userInfo = new UserInfo();
+ userInfo.setUserName("API");
+ userInfo.setUserLoginId("API");
+ editorScope.setScopeName("test");
+ editorScope.setUserCreatedBy(userInfo);
+ editorScope.setUserModifiedBy(userInfo);
+ Mockito.when(commonClassDao.getEntityItem(PolicyEditorScopes.class, "scopeName", "test")).thenReturn(editorScope);
+ BRMSParamTemplate template = new BRMSParamTemplate();
+ template.setRuleName("testPolicy");
+ template.setUserCreatedBy(userInfo);
+ String rule = "package com.sample;\n"
+ + "import com.sample.DroolsTest.Message;\n"
+ + "declare PapParams\n"
+ + "samPoll : int\n"
+ + "value : String\n"
+ + "end\n"
+ + "///This Rule will be generated by the UI.\n"
+ + "rule \"${policyName}.Create parameters structure\"\n"
+ + "salience 1000 \n"
+ + "when\n"
+ + "then\n"
+ + "Params params = new Params();\n"
+ + "params.setSamPoll(76);\n"
+ + "params.setValue(\"test\");\n"
+ + "insertLogical(params);\n"
+ + "end\n"
+ + "rule \"Rule 1: Check parameter structure access from when/then\"\n"
+ + "when\n"
+ + "$param: Params()\n"
+ + "Params($param.samPoll > 50)\n"
+ + "then\n"
+ + "System.out.println(\"Firing rule 1\");\n"
+ + "System.out.println($param);\n"
+ + "end\n";
+ template.setRule(rule );
+ Mockito.when(commonClassDao.getEntityItem(BRMSParamTemplate.class, "ruleName", "testPolicy")).thenReturn(template);
+
+ }
+ @Test
+ public void testClosedLoopCreateDictionary() throws IOException, SQLException, ServletException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ // Check VSCLAction.
+ String json = "{\"dictionaryFields\": {\"vsclaction\": \"testRestAPI\",\"description\": \"testing create\"}}";
+ dictionaryTestSetup(false, "VSCLAction", json);
+ // set DBDao
+ ClosedLoopDictionaryController.setCommonClassDao(new CommonClassDaoImpl());
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check VNFType
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\": {\"vnftype\": \"testrestAPI1\",\"description\": \"testing create\"}}";
+ dictionaryTestSetup(false, "VNFType", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check PEPOptions
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"pepName\":\"testRestAPI\",\"description\":\"testing create\",\"attributes\":[{\"option\":\"test1\",\"number\":\"test\"},{\"option\":\"test2\",\"number\":\"test\"}]}}";
+ dictionaryTestSetup(false, "PEPOptions", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check Varbind
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"varbindName\":\"testRestAPI\",\"varbindDescription\":\"testing\",\"varbindOID\":\"test\"}}";
+ dictionaryTestSetup(false, "Varbind", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check Service
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"serviceName\":\"testRestAPI\",\"description\":\"testing\"}}";
+ dictionaryTestSetup(false, "Service", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check Site
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"siteName\":\"testRestAPI\",\"description\":\"testing\"}}";
+ dictionaryTestSetup(false, "Site", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ }
+
+ @Test
+ public void testFirewallCreateDictionary() throws IOException, SQLException, ServletException {
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ // Check SecurityZone.
+ String json = "{\"dictionaryFields\":{\"zoneName\":\"testRestAPI\",\"zoneValue\":\"testing\"}}";
+ dictionaryTestSetup(false, "SecurityZone", json);
+ // set DBDao
+ FirewallDictionaryController.setCommonClassDao(new CommonClassDaoImpl());
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check Action List
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"actionName\":\"testRestAPI\",\"description\":\"test\"}}";
+ dictionaryTestSetup(false, "ActionList", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check Protocol List.
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"protocolName\":\"testRestAPI\",\"description\":\"test\"}}";
+ dictionaryTestSetup(false, "ProtocolList", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check Zone.
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"zoneName\":\"testRestAPI\",\"zoneValue\":\"test\"}}";
+ dictionaryTestSetup(false, "Zone", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check PrefixList.
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"prefixListName\":\"testRestAPI\",\"prefixListValue\":\"127.0.0.1\",\"description\":\"testing\"}}";
+ dictionaryTestSetup(false, "PrefixList", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check AddressGroup.
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"groupName\":\"testRestAPIgroup\",\"description\":\"testing\",\"attributes\":[{\"option\":\"testRestAPI\"}, {\"option\":\"testRestAPI\"}]}}";
+ dictionaryTestSetup(false, "AddressGroup", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check ServiceGroup.
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"groupName\":\"testRestAPIServiceGroup\",\"attributes\":[{\"option\":\"testRestAPIservice\"}]}}";
+ dictionaryTestSetup(false, "ServiceGroup", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check ServiceList.
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"serviceName\":\"testRestAPIservice\",\"serviceDescription\":\"test\",\"servicePorts\":\"8888\",\"transportProtocols\":[{\"option\":\"testRestAPI\"},{\"option\":\"testRestAPI1\"}],\"appProtocols\":[{\"option\":\"testRestAPI\"},{\"option\":\"testRestAPI1\"}]}}";
+ dictionaryTestSetup(false, "ServiceList", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ //
+ // Check TermList.
+ //
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+ json = "{\"dictionaryFields\":{\"termName\":\"testRestAPIRule\",\"termDescription\":\"testing\",\"fromZoneDatas\":[{\"option\":\"testRestAPI\"}],\"toZoneDatas\":[{\"option\":\"testRestAPI1\"}],\"sourceListDatas\":[{\"option\":\"Group_testportal\"}],\"destinationListDatas\":[{\"option\":\"testRestAPI\"}],\"sourceServiceDatas\":[{\"option\":\"testRestAPIservice\"},{\"option\":\"testRestAPIservice1\"}],\"destinationServiceDatas\":[{\"option\":\"testRestAPIservice1\"},{\"option\":\"testportalservice2\"}],\"actionListDatas\":[{\"option\":\"testRestAPI\"}]}}";
+ dictionaryTestSetup(false, "TermList", json);
+ // send Request to PAP
+ pap.service(httpServletRequest, httpServletResponse);
+ // Verify
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
+ }
+
+ private void dictionaryTestSetup(Boolean updateFlag, String dictionaryType, String json) throws IOException, SQLException {
+ Mockito.when(httpServletRequest.getHeader(ENVIRONMENT_HEADER)).thenReturn("DEVL");
+ Mockito.when(httpServletRequest.getHeader("ClientScope")).thenReturn("dictionaryItem");
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("PUT");
+ Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
+ if(updateFlag){
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("update");
+ }else{
+ Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
+ }
+ Mockito.when(httpServletRequest.getParameter("dictionaryType")).thenReturn(dictionaryType);
+ MockServletInputStream mockInput = new MockServletInputStream(json.getBytes());
+ Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
+ Mockito.when(httpServletRequest.getReader()).thenReturn(new BufferedReader(new InputStreamReader(mockInput)));
+ // set DBDao
+ setDBDao();
+ }
private void setDBDao() throws SQLException {
BasicDataSource dataSource = new BasicDataSource();
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java
index 1a97d7fad..99285e77f 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/FirewallConfigPolicyTest.java
@@ -20,9 +20,10 @@
package org.onap.policy.pap.xacml.rest.components;
import static org.junit.Assert.*;
-import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
@@ -124,5 +125,24 @@ public class FirewallConfigPolicyTest {
assertTrue(response);
}
+
+ @Test
+ public void testUpdateJson() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{
+ FirewallConfigPolicy firewallConfigPolicy = new FirewallConfigPolicy();
+ Method method = firewallConfigPolicy.getClass().getDeclaredMethod("updateFirewallDictionaryData", String.class , String.class);
+ method.setAccessible(true);
+ String jsonBody= "{\"serviceTypeId\":\"/v0/firewall/pan\",\"configName\":\"TestFwPolicyConfig\",\"deploymentOption\":{\"deployNow\":false},\"securityZoneId\":\"cloudsite:dev1a\",\"serviceGroups\":[{\"name\":\"SSH\",\"description\":\"Sshservice entry in servicelist\",\"type\":\"SERVICE\",\"transportProtocol\":\"tcp\",\"appProtocol\":null,\"ports\":\"22\"}],\"addressGroups\":[{\"name\":\"test\",\"description\":\"Destination\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"127.0.0.1/12\"}]},{\"name\":\"TestServers\",\"description\":\"SourceTestServers for firsttesting\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"127.0.0.1/23\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"FWRuleTestServerToTest\",\"fromZones\":[\"UntrustedZoneTestName\"],\"toZones\":[\"TrustedZoneTestName\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"name\":\"TestServers\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"name\":\"Test\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"SSH\"}],\"action\":\"accept\",\"description\":\"FWrule for Test source to Test destination\",\"enabled\":true,\"log\":true}]}";
+ String prevJsonBody = "{\"serviceTypeId\":\"/v0/firewall/pan\",\"configName\":\"TestFwPolicy1Config\",\"deploymentOption\":{\"deployNow\":false},\"securityZoneId\":\"cloudsite:dev\",\"vendorServiceId\":\"test\",\"vendorSpecificData\":{\"idMap\":[{\"Id\":\"cloudsite:dev1a\",\"vendorId\":\"deviceGroup:dev\"}]},\"serviceGroups\":[{\"name\":\"SSH\",\"description\":\"Ssh service entry in service list\",\"type\":\"SERVICE\",\"transportProtocol\":\"tcp\",\"appProtocol\":null,\"ports\":\"22\"}],\"addressGroups\":[{\"name\":\"Test\",\"description\":\"Destination Test\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"127.0.0.1/12\"}]},{\"name\":\"TestServers\",\"description\":\"Source TestServers for first testing\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"127.0.0.1/23\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"FWRuleTestServerTot\",\"fromZones\":[\"UntrustedZoneTestName\"],\"toZones\":[\"TrustedZoneTName\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"name\":\"TServers\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"name\":\"Test\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"SSH\"}],\"action\":\"accept\",\"description\":\"FW rule for HOHO source to CiscoVCE destination\",\"enabled\":true,\"log\":true}]}";
+ assertFalse((Boolean) method.invoke(firewallConfigPolicy, jsonBody, prevJsonBody));
+ }
+
+ @Test
+ public void testInsertJson() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{
+ FirewallConfigPolicy firewallConfigPolicy = new FirewallConfigPolicy();
+ Method method = firewallConfigPolicy.getClass().getDeclaredMethod("insertFirewallDicionaryData", String.class);
+ method.setAccessible(true);
+ String jsonBody= "{\"serviceTypeId\":\"/v0/firewall/pan\",\"configName\":\"TestFwPolicyConfig\",\"deploymentOption\":{\"deployNow\":false},\"securityZoneId\":\"cloudsite:dev1a\",\"serviceGroups\":[{\"name\":\"SSH\",\"description\":\"Sshservice entry in servicelist\",\"type\":\"SERVICE\",\"transportProtocol\":\"tcp\",\"appProtocol\":null,\"ports\":\"22\"}],\"addressGroups\":[{\"name\":\"test\",\"description\":\"Destination\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"127.0.0.1/12\"}]},{\"name\":\"TestServers\",\"description\":\"SourceTestServers for firsttesting\",\"members\":[{\"type\":\"SUBNET\",\"value\":\"127.0.0.1/23\"}]}],\"firewallRuleList\":[{\"position\":\"1\",\"ruleName\":\"FWRuleTestServerToTest\",\"fromZones\":[\"UntrustedZoneTestName\"],\"toZones\":[\"TrustedZoneTestName\"],\"negateSource\":false,\"negateDestination\":false,\"sourceList\":[{\"type\":\"REFERENCE\",\"name\":\"TestServers\"}],\"destinationList\":[{\"type\":\"REFERENCE\",\"name\":\"Test\"}],\"sourceServices\":[],\"destServices\":[{\"type\":\"REFERENCE\",\"name\":\"SSH\"}],\"action\":\"accept\",\"description\":\"FWrule for Test source to Test destination\",\"enabled\":true,\"log\":true}]}";
+ assertFalse((Boolean) method.invoke(firewallConfigPolicy, jsonBody));
+ }
} \ No newline at end of file
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java
index 529047181..a2c67ea81 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryControllerTest.java
@@ -198,7 +198,7 @@ public class DecisionPolicyDictionaryControllerTest {
MockHttpServletResponse response = new MockHttpServletResponse();
- controller.getRainyDayDictionaryEntityData(request, response);
+ controller.getRainyDayDictionaryEntityData(response);
try {
assertTrue( response.getContentAsString() != null && response.getContentAsString().contains("rainyDayDictionaryDatas"));
diff --git a/ONAP-PAP-REST/xacml.pap.properties b/ONAP-PAP-REST/xacml.pap.properties
index 2517ebdcc..dc8300d92 100644
--- a/ONAP-PAP-REST/xacml.pap.properties
+++ b/ONAP-PAP-REST/xacml.pap.properties
@@ -88,8 +88,8 @@ xacml.rest.pdp.idfile=test.properties
#Properties for db access
#properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs
-javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/onap_sdk?failOverReadOnly=false&autoReconnect=true
+javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk?failOverReadOnly=false&autoReconnect=true
javax.persistence.jdbc.user=policy_user
javax.persistence.jdbc.password=policy_user
diff --git a/ONAP-PDP-REST/pom.xml b/ONAP-PDP-REST/pom.xml
index a2f7f7207..fb957f00d 100644
--- a/ONAP-PDP-REST/pom.xml
+++ b/ONAP-PDP-REST/pom.xml
@@ -212,6 +212,10 @@
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>com.att.aft</groupId>
+ <artifactId>dme2</artifactId>
+ </exclusion>
</exclusions>
</dependency>
</dependencies>
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java
index 18c201737..b824312dc 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java
@@ -180,6 +180,14 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
private static volatile boolean configThreadTerminate = false;
private transient ONAPLoggingContext baseLoggingContext = null;
private transient IntegrityMonitor im;
+ public IntegrityMonitor getIm() {
+ return im;
+ }
+
+ public void setIm(IntegrityMonitor im) {
+ this.im = im;
+ }
+
/**
* Default constructor.
*/
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java
index c283ff14c..915e3b30f 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java
@@ -80,6 +80,8 @@ public class DecisionPolicyService{
}
Map<String,String> matchingAttributes = null;
Map<String,String> settingsAttributes = null;
+
+ //Get the MATCHING and/or SETTINGS attributes
if (policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)) {
matchingAttributes = policyParameters.getAttributes().get(AttributeType.MATCHING);
settingsAttributes = policyParameters.getAttributes().get(AttributeType.SETTINGS);
@@ -88,9 +90,10 @@ public class DecisionPolicyService{
}else if(policyParameters.getAttributes()!=null && policyParameters.getAttributes().containsKey(AttributeType.MATCHING) && !policyParameters.getAttributes().containsKey(AttributeType.SETTINGS)){
matchingAttributes = policyParameters.getAttributes().get(AttributeType.MATCHING);
}
- // Create Policy.
- StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyParameters.getPolicyDescription(), onapName, ruleProvider.toString(), matchingAttributes, settingsAttributes, policyParameters.getDynamicRuleAlgorithmLabels(),
- policyParameters.getDynamicRuleAlgorithmFunctions(), policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmField2(), null, null, null, updateFlag, policyScope, 0);
+ // Create StdPAPPolicy object used to send policy data to PAP-REST.
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyParameters.getPolicyDescription(), onapName, ruleProvider.toString(), matchingAttributes, settingsAttributes,
+ policyParameters.getTreatments(), policyParameters.getDynamicRuleAlgorithmLabels(), policyParameters.getDynamicRuleAlgorithmFunctions(),
+ policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmField2(), null, null, null, updateFlag, policyScope, 0);
// Send JSON to PAP.
response = (String) papServices.callPAP(newPAPPolicy, new String[] {"operation="+operation, "apiflag=api", "policyType=Decision"}, policyParameters.getRequestID(), "Decision");
LOGGER.info(message);
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java
index 8f88ef7c7..d3628f3c1 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java
@@ -171,6 +171,9 @@ public class GetDictionaryService {
case "Settings":
jsonString = jsonString.replace("settingsDictionaryDatas", "DictionaryDatas");
break;
+ case "RainyDayTreatments":
+ jsonString = jsonString.replace("rainyDayDictionaryDatas", "DictionaryDatas");
+ break;
case "DescriptiveScope":
jsonString = jsonString.replace("descriptiveScopeDictionaryDatas", "DictionaryDatas");
break;
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
index efaa5c167..8258aba1a 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
@@ -128,7 +128,7 @@ public class PDPServices {
LOGGER.info("Decision not a Permit. " + result.getDecision().toString());
PDPResponse pdpResponse = new PDPResponse();
if (decide) {
- String indeterminatePropValue = XACMLProperties.getProperty("decision.inStringdeterminate.response");
+ String indeterminatePropValue = XACMLProperties.getProperty("decision.indeterminate.response");
if(result.getDecision().equals(Decision.INDETERMINATE)&& indeterminatePropValue != null){
if("PERMIT".equalsIgnoreCase(indeterminatePropValue)){
pdpResponse.setDecision(PolicyDecision.PERMIT);
diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java
index 3e3f584a9..594b51c06 100644
--- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java
+++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java
@@ -27,6 +27,10 @@ import java.util.List;
import java.util.Properties;
import java.util.Random;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+import javax.persistence.Persistence;
import javax.servlet.ServletConfig;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
@@ -34,16 +38,18 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
-import org.junit.runner.RunWith;
+import org.junit.Test;
import org.mockito.Mockito;
+import org.onap.policy.common.ia.DbDAO;
+import org.onap.policy.common.ia.IntegrityAuditProperties;
import org.onap.policy.common.im.AdministrativeStateException;
import org.onap.policy.common.im.IntegrityMonitor;
import org.onap.policy.common.im.StandbyStatusException;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
+
+import org.onap.policy.pdp.rest.XACMLPdpServletTest;
import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletConfig;
@@ -51,8 +57,6 @@ import com.mockrunner.mock.web.MockServletInputStream;
import junit.framework.TestCase;
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(IntegrityMonitor.class) // so PowerMock can mock static method of IntegrityMonitor
public class XACMLPdpServletTest extends TestCase{
private static Logger LOGGER = FlexLogger.getLogger(XACMLPdpServletTest.class);
@@ -65,16 +69,64 @@ public class XACMLPdpServletTest extends TestCase{
private ServletConfig servletConfig;
private XACMLPdpServlet pdpServlet;
private IntegrityMonitor im;
-
+
+ private DbDAO dbDAO;
+ private String persistenceUnit;
+ private Properties properties;
+ private String resourceName;
+ private String dbDriver;
+ private String dbUrl;
+ private String dbUser;
+ private String dbPwd;
+ private String siteName;
+ private String nodeType;
+ private static final String DEFAULT_DB_DRIVER = "org.h2.Driver";
+ private static final String DEFAULT_DB_USER = "sa";
+ private static final String DEFAULT_DB_PWD = "";
@Before
public void setUp(){
+
+ properties = new Properties();
+ properties.put(IntegrityAuditProperties.DB_DRIVER, XACMLPdpServletTest.DEFAULT_DB_DRIVER);
+ properties.put(IntegrityAuditProperties.DB_URL, "jdbc:h2:file:./sql/xacmlTest");
+ properties.put(IntegrityAuditProperties.DB_USER, XACMLPdpServletTest.DEFAULT_DB_USER);
+ properties.put(IntegrityAuditProperties.DB_PWD, XACMLPdpServletTest.DEFAULT_DB_PWD);
+ properties.put(IntegrityAuditProperties.SITE_NAME, "SiteA");
+ properties.put(IntegrityAuditProperties.NODE_TYPE, "pap");
+ //properties.put("com.sun.management.jmxremote.port", "9999");
+ dbDriver = XACMLPdpServletTest.DEFAULT_DB_DRIVER;
+ dbUrl = "jdbc:h2:file:./sql/xacmlTest";
+ dbUser = XACMLPdpServletTest.DEFAULT_DB_USER;
+ dbPwd = XACMLPdpServletTest.DEFAULT_DB_PWD;
+ siteName = "SiteA";
+ nodeType = "pdp";
+ persistenceUnit = "testPdpPU";
+ resourceName = "siteA.pdp1";
+
+ System.setProperty("com.sun.management.jmxremote.port", "9999");
+
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit, properties);
+
+ EntityManager em = emf.createEntityManager();
+ // Start a transaction
+ EntityTransaction et = em.getTransaction();
+
+ IntegrityMonitor im = null;
+ try {
+ im = IntegrityMonitor.getInstance(resourceName, properties);
+ } catch (Exception e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ }
+ //cleanDb(persistenceUnit, properties);
+
httpServletRequest = Mockito.mock(HttpServletRequest.class);
Mockito.when(httpServletRequest.getMethod()).thenReturn("POST");
Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers));
Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers));
-
+ Mockito.when(httpServletRequest.getRequestURI()).thenReturn("/pdp/test");
mockOutput = Mockito.mock(ServletOutputStream.class);
@@ -90,15 +142,17 @@ public class XACMLPdpServletTest extends TestCase{
//servletConfig
Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers));
pdpServlet = new XACMLPdpServlet();
+ pdpServlet.setIm(im);
- Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties");
+ Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("src/test/resources/xacml.pdp.properties");
- System.setProperty("xacml.properties", "xacml.pdp.properties");
- System.setProperty("xacml.rest.pdp.config", "config_testing");
- System.setProperty("xacml.rest.pdp.webapps", "/webapps");
- System.setProperty("xacml.rootPolicies", "test_PolicyEngine.xml");
+ System.setProperty("xacml.properties", "src/test/resources/xacml.pdp.properties");
+ System.setProperty("xacml.rest.pdp.config", "src/test/resources/config_testing");
+ System.setProperty("xacml.rest.pdp.webapps", "src/test/resources/webapps");
+ /*System.setProperty("xacml.rootPolicies", "test_PolicyEngine.xml");
System.setProperty("xacml.referencedPolicies", "test_PolicyEngine.xml");
System.setProperty("test_PolicyEngine.xml.file", "config_testing\\test_PolicyEngine.xml");
+ */
System.setProperty("xacml.rest.pdp.register", "false");
System.setProperty("com.sun.management.jmxremote.port", "9999");
@@ -119,8 +173,9 @@ public class XACMLPdpServletTest extends TestCase{
}
Mockito.doNothing().when(im).endTransaction();
}
-
- public void testInit(){
+
+ @Test
+ public void testInit(){
LOGGER.info("XACMLPdpServletTest - testInit");
try {
pdpServlet.init(servletConfig);
@@ -133,12 +188,14 @@ public class XACMLPdpServletTest extends TestCase{
}
+ @Test
public void testDoGetNoTypeError(){
LOGGER.info("XACMLPdpServletTest - testDoGetNoTypeError");
try{
+
pdpServlet.init(servletConfig);
pdpServlet.doGet(httpServletRequest, httpServletResponse);
- Mockito.verify(httpServletResponse).sendError(HttpServletResponse.SC_BAD_REQUEST, "type not 'config' or 'hb'");
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
assertTrue(true);
}catch(Exception e){
System.out.println("Unexpected exception in testDoGetNoTypeError");
@@ -147,6 +204,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDoGetConfigType(){
LOGGER.info("XACMLPdpServletTest - testDoGetConfigType");
Mockito.when(httpServletRequest.getParameter("type")).thenReturn("config");
@@ -164,14 +222,14 @@ public class XACMLPdpServletTest extends TestCase{
}
-
+ @Test
public void testDoGetTypeHb(){
LOGGER.info("XACMLPdpServletTest - testDoGetTypeHb");
try{
Mockito.when(httpServletRequest.getParameter("type")).thenReturn("hb");
pdpServlet.init(servletConfig);
pdpServlet.doGet(httpServletRequest, httpServletResponse);
- Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_NO_CONTENT);
+ Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
assertTrue(true);
}catch(Exception e){
System.out.println("Unexpected exception in testDoGetTypeHb");
@@ -179,6 +237,8 @@ public class XACMLPdpServletTest extends TestCase{
fail();
}
}
+
+ @Test
public void testDoGetTypeStatus(){
LOGGER.info("XACMLPdpServletTest - testDoGetTypeStatus");
try{
@@ -194,6 +254,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDoPost(){
LOGGER.info("XACMLPdpServletTest - testDoPost");
try{
@@ -207,6 +268,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDoPostToLong(){
LOGGER.info("XACMLPdpServletTest - testDoPostToLong");
try{
@@ -223,6 +285,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDoPostContentLengthNegative(){
LOGGER.info("XACMLPdpServletTest - testDoPostToLong");
try{
@@ -239,6 +302,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDoPostContentTypeNonValid(){
LOGGER.info("XACMLPdpServletTest - testDoPostToLong");
try{
@@ -255,6 +319,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDoPostContentTypeConfigurationError(){
LOGGER.info("XACMLPdpServletTest - testDoPostToLong");
try{
@@ -271,6 +336,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDoPutCacheEmpty(){
LOGGER.info("XACMLPdpServletTest - testDoPutCacheEmpty");
mockInput = Mockito.mock(ServletInputStream.class);
@@ -290,6 +356,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDoPutConfigPolicies(){
LOGGER.info("XACMLPdpServletTest - testDoPutConfigPolicies");
byte[] b = new byte[20];
@@ -330,6 +397,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDoPutInvalidContentType(){
LOGGER.info("XACMLPdpServletTest - testDoPutToLong");
try{
@@ -349,6 +417,7 @@ public class XACMLPdpServletTest extends TestCase{
}
}
+ @Test
public void testDestroy(){
LOGGER.info("XACMLPdpServletTest - testDestroy");
diff --git a/ONAP-PDP-REST/src/test/resources/META-INF/drop.ddl b/ONAP-PDP-REST/src/test/resources/META-INF/drop.ddl
new file mode 100644
index 000000000..f7138ad52
--- /dev/null
+++ b/ONAP-PDP-REST/src/test/resources/META-INF/drop.ddl
@@ -0,0 +1,7 @@
+DROP TABLE IF EXISTS ConfigurationDataEntity
+DROP TABLE IF EXISTS PolicyEntity
+DROP TABLE IF EXISTS PolicyDBDaoEntity
+DROP TABLE IF EXISTS ActionBodyEntity
+DROP SEQUENCE IF EXISTS seqPolicy
+DROP SEQUENCE IF EXISTS seqConfig
+DROP SEQUENCE IF EXISTS seqActBody
diff --git a/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml b/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml
new file mode 100644
index 000000000..b44841c9d
--- /dev/null
+++ b/ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP-PAP-REST
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
+ <persistence-unit name="XACML-PAP-REST">
+ <class>org.onap.policy.rest.jpa.PolicyEntity</class>
+ <class>org.onap.policy.rest.jpa.ConfigurationDataEntity</class>
+ <class>org.onap.policy.rest.jpa.PolicyDBDaoEntity</class>
+ <class>org.onap.policy.rest.jpa.GroupEntity</class>
+ <class>org.onap.policy.rest.jpa.PdpEntity</class>
+ <class>org.onap.policy.rest.jpa.ActionBodyEntity</class>
+ <class>org.onap.policy.rest.jpa.DatabaseLockEntity</class>
+ <class>org.onap.policy.rest.jpa.PolicyVersion</class>
+ <class>org.onap.policy.rest.jpa.PolicyScore</class>
+ <class>org.onap.policy.rest.jpa.FunctionDefinition</class>
+ <class>org.onap.policy.rest.jpa.Attribute</class>
+ <class>org.onap.policy.rest.jpa.Category</class>
+ <class>org.onap.policy.rest.jpa.ConstraintType</class>
+ <class>org.onap.policy.rest.jpa.ConstraintValue</class>
+ <class>org.onap.policy.rest.jpa.Datatype</class>
+ <class>org.onap.policy.rest.jpa.FunctionArgument</class>
+ <class>org.onap.policy.rest.jpa.UserInfo</class>
+ <class>org.onap.policy.rest.jpa.ActionPolicyDict</class>
+ <class>org.onap.policy.rest.jpa.DecisionSettings</class>
+ <class>org.onap.policy.rest.jpa.MicroServiceModels</class>
+ <class>org.onap.policy.rest.jpa.BRMSParamTemplate</class>
+ <class>org.onap.policy.rest.jpa.PolicyEditorScopes</class>
+ <!-- unique to PolicyEngineUtils - will be audited from PAP -->
+ <class>org.onap.policy.jpa.BackUpMonitorEntity</class>
+ <!-- unique to integrity-monitor - will be audited from PAP -->
+ <class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
+ <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
+ <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class>
+ <!-- unique to integrity-audit - will be audited from PAP -->
+ <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
+ <exclude-unlisted-classes>false</exclude-unlisted-classes>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ <properties>
+ <!-- The properties defined below are the default settings to be used when someone initially
+ wants to start working with the XACML-PAP-ADMIN web gui. They are not intended for production
+ use.
+
+ They are setup to drop and create the tables and then load an initial set of data into the database
+ every time the application is deployed. So if you add anything to the dictionaries or PIP
+ configuration, they will get lost upon each deployment. It uses an H2 database engine configured
+ for a local file so you don't have to setup you're own SQL database environment to start.
+
+ Instead of modifying this file directly, please refer to the xacml.admin.properties file for
+ customizing the application settings.
+
+ -->
+ <!-- <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
+ <property name="javax.persistence.schema-generation.create-source" value="metadata-then-script"/>
+ <property name="javax.persistence.schema-generation.create-script-source" value="META-INF/views.sql" />
+ <property name="javax.persistence.schema-generation.drop-source" value="script"/>
+ <property name="javax.persistence.schema-generation.drop-script-source" value="META-INF/drop.sql" />
+ <property name="javax.persistence.sql-load-script-source" value="META-INF/data.sql" />-->
+
+
+
+ <!-- These properties should be set in the xacml.admin.properties file, so they can be re-used by non-JPA
+ database functionality. -->
+ <!--
+ <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
+ <property name="javax.persistence.jdbc.url" value="jdbc:h2:file:sql/xacml"/>
+ <property name="javax.persistence.jdbc.user" value="sa"/>
+ <property name="javax.persistence.jdbc.password" value=""/>
+ -->
+ </properties>
+ </persistence-unit>
+
+<persistence-unit name="auditPapPU">
+ <!-- This is the persistence unit used by IntegrityAudit to determine
+ which classes to audit. All the PAP classes are also included in
+ XACML-PAP-ADMIN, so they will be audited there rather than having a
+ duplicate audit run from the XACL-PAP-REST node -->
+ <!-- unique to PolicyEngineUtils - will be audited from PAP -->
+ <class>org.onap.policy.jpa.BackUpMonitorEntity</class>
+ <!-- unique to integrity-monitor - will be audited from PAP -->
+ <class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
+ <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
+ <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class>
+ <!-- unique to integrity-audit - will be audited from PAP -->
+ <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ </persistence-unit>
+
+ <persistence-unit name="testPdpPU" transaction-type="RESOURCE_LOCAL">
+ <!-- This tests all the classes that will be audited in the XACML-PAP-REST and the XACML-PAP_ADMIN -->
+ <!-- XACML-PAP-REST -->
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.onap.policy.rest.jpa.PolicyEntity</class>
+ <class>org.onap.policy.rest.jpa.ConfigurationDataEntity</class>
+ <class>org.onap.policy.rest.jpa.PolicyDBDaoEntity</class>
+ <class>org.onap.policy.rest.jpa.GroupEntity</class>
+ <class>org.onap.policy.rest.jpa.PdpEntity</class>
+ <class>org.onap.policy.rest.jpa.ActionBodyEntity</class>
+ <class>org.onap.policy.rest.jpa.DatabaseLockEntity</class>
+ <class>org.onap.policy.rest.jpa.PolicyVersion</class>
+ <class>org.onap.policy.rest.jpa.PolicyScore</class>
+ <class>org.onap.policy.rest.jpa.FunctionDefinition</class>
+ <class>org.onap.policy.rest.jpa.Attribute</class>
+ <class>org.onap.policy.rest.jpa.Category</class>
+ <class>org.onap.policy.rest.jpa.ConstraintType</class>
+ <class>org.onap.policy.rest.jpa.ConstraintValue</class>
+ <class>org.onap.policy.rest.jpa.Datatype</class>
+ <class>org.onap.policy.rest.jpa.FunctionArgument</class>
+ <class>org.onap.policy.rest.jpa.UserInfo</class>
+ <class>org.onap.policy.rest.jpa.ActionPolicyDict</class>
+ <class>org.onap.policy.rest.jpa.DecisionSettings</class>
+ <class>org.onap.policy.rest.jpa.MicroServiceModels</class>
+ <!-- unique to XACML-PAP-ADMIN -->
+ <class>org.onap.policy.rest.jpa.ActionList</class>
+ <class>org.onap.policy.rest.jpa.AddressGroup</class>
+ <class>org.onap.policy.rest.jpa.AttributeAssignment</class>
+ <class>org.onap.policy.rest.jpa.BRMSParamTemplate</class>
+ <class>org.onap.policy.rest.jpa.ClosedLoopD2Services</class>
+ <class>org.onap.policy.rest.jpa.ClosedLoopSite</class>
+ <class>org.onap.policy.rest.jpa.DCAEUsers</class>
+ <class>org.onap.policy.rest.jpa.DCAEuuid</class>
+ <class>org.onap.policy.rest.jpa.DescriptiveScope</class>
+ <class>org.onap.policy.rest.jpa.OnapName</class>
+ <class>org.onap.policy.rest.jpa.EnforcingType</class>
+ <class>org.onap.policy.rest.jpa.GlobalRoleSettings</class>
+ <class>org.onap.policy.rest.jpa.GroupPolicyScopeList</class>
+ <class>org.onap.policy.rest.jpa.GroupServiceList</class>
+ <class>org.onap.policy.rest.jpa.MicroServiceConfigName</class>
+ <class>org.onap.policy.rest.jpa.MicroServiceLocation</class>
+ <class>org.onap.policy.rest.jpa.Obadvice</class>
+ <class>org.onap.policy.rest.jpa.ObadviceExpression</class>
+ <class>org.onap.policy.rest.jpa.PEPOptions</class>
+ <class>org.onap.policy.rest.jpa.PIPConfigParam</class>
+ <class>org.onap.policy.rest.jpa.PIPConfiguration</class>
+ <class>org.onap.policy.rest.jpa.PIPResolver</class>
+ <class>org.onap.policy.rest.jpa.PIPResolverParam</class>
+ <class>org.onap.policy.rest.jpa.PIPType</class>
+ <class>org.onap.policy.rest.jpa.PolicyAlgorithms</class>
+ <class>org.onap.policy.rest.jpa.PolicyManagement</class>
+ <class>org.onap.policy.rest.jpa.PolicyScopeService</class>
+ <class>org.onap.policy.rest.jpa.PolicyScopeType</class>
+ <class>org.onap.policy.rest.jpa.PolicyScopeResource</class>
+ <class>org.onap.policy.rest.jpa.PolicyScopeClosedLoop</class>
+ <class>org.onap.policy.rest.jpa.PortList</class>
+ <class>org.onap.policy.rest.jpa.PREFIXLIST</class>
+ <class>org.onap.policy.rest.jpa.ProtocolList</class>
+ <class>org.onap.policy.rest.jpa.RemoteCatalogValues</class>
+ <class>org.onap.policy.rest.jpa.PolicyRoles</class>
+ <class>org.onap.policy.rest.jpa.RuleAlgorithms</class>
+ <class>org.onap.policy.rest.jpa.SecurityZone</class>
+ <class>org.onap.policy.rest.jpa.ServiceList</class>
+ <class>org.onap.policy.rest.jpa.SystemLogDB</class>
+ <class>org.onap.policy.rest.jpa.TermList</class>
+ <class>org.onap.policy.rest.jpa.VarbindDictionary</class>
+ <class>org.onap.policy.rest.jpa.VMType</class>
+ <class>org.onap.policy.rest.jpa.VNFType</class>
+ <class>org.onap.policy.rest.jpa.VSCLAction</class>
+ <class>org.onap.policy.rest.jpa.Zone</class>
+ <!-- unique to PolicyEngineUtils -->
+ <class>org.onap.policy.jpa.BackUpMonitorEntity</class>
+ <!-- unique to integrity-monitor -->
+ <class>org.onap.policy.common.im.jpa.StateManagementEntity</class>
+ <class>org.onap.policy.common.im.jpa.ForwardProgressEntity</class>
+ <class>org.onap.policy.common.im.jpa.ResourceRegistrationEntity</class>
+ <!-- unique to integrity-audit -->
+ <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
+
+ <exclude-unlisted-classes>false</exclude-unlisted-classes>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ <properties>
+ <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
+ <property name="javax.persistence.jdbc.url" value="jdbc:h2:file:./sql/xacmlTest"/> <!-- ;MODE=MySQL"/> -->
+ <property name="javax.persistence.jdbc.user" value="sa"/>
+ <property name="javax.persistence.jdbc.password" value=""/>
+ <property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/>
+ <property name="javax.persistence.schema-generation.scripts.create-target" value="./src/test/resources/generatedCreate.ddl"/>
+ <property name="javax.persistence.schema-generation.scripts.drop-target" value="./src/test/resources/generatedDrop.ddl"/>
+ <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
+ <property name="javax.persistence.schema-generation.create-source" value="metadata-then-script"/>
+ <property name="javax.persistence.schema-generation.drop-source" value="script"/>
+ <property name="javax.persistence.schema-generation.drop-script-source" value="META-INF/drop.ddl" />
+ </properties>
+ </persistence-unit>
+</persistence>
diff --git a/ONAP-PDP-REST/src/test/resources/fail.xacml.pdp.properties b/ONAP-PDP-REST/src/test/resources/fail.xacml.pdp.properties
index a16b422bf..fdc7798b4 100644
--- a/ONAP-PDP-REST/src/test/resources/fail.xacml.pdp.properties
+++ b/ONAP-PDP-REST/src/test/resources/fail.xacml.pdp.properties
@@ -122,8 +122,8 @@ xacml.rest.notification.delay=30
REQUEST_BUFFER_SIZE=15
#properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs
-javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/xacml
+javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk
javax.persistence.jdbc.user=policy_user
javax.persistence.jdbc.password=policy_user
diff --git a/ONAP-PDP-REST/src/test/resources/notification.xacml.pdp.properties b/ONAP-PDP-REST/src/test/resources/notification.xacml.pdp.properties
index 9ca1bba9c..2a3600559 100644
--- a/ONAP-PDP-REST/src/test/resources/notification.xacml.pdp.properties
+++ b/ONAP-PDP-REST/src/test/resources/notification.xacml.pdp.properties
@@ -122,8 +122,8 @@ xacml.rest.notification.delay=30
REQUEST_BUFFER_SIZE=15
#properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs
-javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/xacml
+javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk
javax.persistence.jdbc.user=policy_user
javax.persistence.jdbc.password=policy_user
diff --git a/ONAP-PDP-REST/src/test/resources/pass.xacml.pdp.properties b/ONAP-PDP-REST/src/test/resources/pass.xacml.pdp.properties
index c9a111012..c3eda591f 100644
--- a/ONAP-PDP-REST/src/test/resources/pass.xacml.pdp.properties
+++ b/ONAP-PDP-REST/src/test/resources/pass.xacml.pdp.properties
@@ -122,8 +122,8 @@ xacml.rest.notification.delay=30
REQUEST_BUFFER_SIZE=15
#properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs
-javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/xacml
+javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk
javax.persistence.jdbc.user=policy_user
javax.persistence.jdbc.password=policy_user
diff --git a/ONAP-PDP-REST/src/test/resources/xacml.pdp.properties b/ONAP-PDP-REST/src/test/resources/xacml.pdp.properties
new file mode 100644
index 000000000..bb174b9fd
--- /dev/null
+++ b/ONAP-PDP-REST/src/test/resources/xacml.pdp.properties
@@ -0,0 +1,176 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP-PDP-REST
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+# Default XACML Properties File for PDP RESTful servlet
+#
+# Standard API Factories
+#
+xacml.dataTypeFactory=com.att.research.xacml.std.StdDataTypeFactory
+xacml.pdpEngineFactory=com.att.research.xacmlatt.pdp.ATTPDPEngineFactory
+xacml.pepEngineFactory=com.att.research.xacml.std.pep.StdEngineFactory
+# NOT USED SEE BELOW xacml.pipFinderFactory=org.onap.policy.xacml.std.pip.StdPIPFinderFactory
+xacml.traceEngineFactory=com.att.research.xacml.std.trace.LoggingTraceEngineFactory
+#
+# AT&T PDP Implementation Factories
+#
+xacml.att.evaluationContextFactory=com.att.research.xacmlatt.pdp.std.StdEvaluationContextFactory
+xacml.att.combiningAlgorithmFactory=com.att.research.xacmlatt.pdp.std.StdCombiningAlgorithmFactory
+xacml.att.functionDefinitionFactory=org.onap.policy.xacml.custom.OnapFunctionDefinitionFactory
+# NOT USED SEE BELOW xacml.att.policyFinderFactory=org.onap.policy.pdp.std.StdPolicyFinderFactory
+# creteUpdate Policy Implementation Class details.
+createUpdatePolicy.impl.className=org.onap.policy.pdp.rest.api.services.CreateUpdatePolicyServiceImpl
+# AAF Implementation class details
+aafClient.impl.className=org.onap.policy.utils.AAFPolicyClientImpl
+#
+# AT&T RESTful PDP Implementation Factories
+#
+xacml.pipFinderFactory=org.onap.policy.pdp.rest.impl.XACMLPdpPIPFinderFactory
+xacml.att.policyFinderFactory=org.onap.policy.pdp.rest.XACMLPdpPolicyFinderFactory
+#
+# When set to true, this flag tells the StdPolicyFinderFactory to combined all the root policy files into
+# into one PolicySet and use the given Policy Algorithm.
+#
+xacml.att.policyFinderFactory.combineRootPolicies=urn:com:att:xacml:3.0:policy-combining-algorithm:combined-permit-overrides
+#
+# PDP RESTful API properties
+#
+# Set this to the address where the XACML-PAP-REST servlet is running
+xacml.rest.pap.url=http://localhost:8070/pap/
+
+#if multiple paps exist, the xacml.rest.pap.url can be removed and they can be defined like this:
+#xacml.rest.pap.urls=http://localhost:9090/pap/,http://localhost:9091/pap/
+
+#
+# Give the running PDP an ID for the PAP. The url that its running as is a good choice.
+# The PAP identifies PDP's using the URL of the PDP.
+#
+xacml.rest.pdp.id=http://localhost:8082/pdp/
+
+# Give the port number used for the PDP
+
+xacml.jmx.port=0
+
+
+# Notification Properties
+# Notifcation type: websocket, ueb or dmaap... if left blank websocket is the default
+NOTIFICATION_TYPE=websocket
+NOTIFICATION_SERVERS=
+NOTIFICATION_TOPIC=
+NOTIFICATION_DELAY=
+UEB_API_KEY=
+UEB_API_SECRET=
+DMAAP_AAF_LOGIN=
+DMAAP_AAF_PASSWORD=
+
+#
+# Set the directory where the PDP holds its Policy Cache and PIP Configuration
+#
+xacml.rest.pdp.config=config
+
+xacml.rest.pdp.webapps=/home/users/PolicyEngine/webapps/ConfigPAP/
+#
+# Initialize register with PAP servlet
+#
+xacml.rest.pdp.register=true
+#
+# Sleep period in seconds between register attempts
+#
+xacml.rest.pdp.register.sleep=15
+#
+# number of attempts to register. -1 means keep trying forever.
+#
+xacml.rest.pdp.register.retries=-1
+#
+# max number of bytes in a POST of a XML/JSON request
+# old value #32767
+xacml.rest.pdp.maxcontent=99999999
+#
+# Set UserID here
+xacml.rest.pdp.userid=testpdp
+# Set Password here
+xacml.rest.pdp.password=alpha456
+
+# id PAP
+xacml.rest.pap.userid=testpap
+#if multiple paps have different logins, they can be defined like this:
+#http\://localhost\:9090/pap/.xacml.rest.pap.userid=testpap
+
+# pass PAP
+xacml.rest.pap.password=alpha123
+#http\://localhost\:9090/pap/.xacml.rest.pap.password=alpha123
+
+# Delay for Notifications Don't change this. Value in milliSec.
+xacml.rest.notification.delay=30
+
+# Client interval to ping notification service.
+CLIENT_INTERVAL=15000
+
+# Buffer Size.
+REQUEST_BUFFER_SIZE=15
+
+#Properties for db access
+#properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs
+javax.persistence.jdbc.driver=org.h2.Driver
+javax.persistence.jdbc.url=jdbc:h2:file:./sql/xacmlTest
+javax.persistence.jdbc.user=sa
+javax.persistence.jdbc.password=
+
+#***Properties for IntegrityMonitor integration defined in XACMLRestProperties.java***
+
+#The name of the PDP. Must be unique across the system
+xacml.rest.pdp.resource.name=site_1.pdp_1
+
+#***Properties for IntegrityMonitor integration defined in IntegrityMonitorProperties.java***
+
+#Interval between forward progress counter updates in seconds
+fp_monitor_interval=30
+
+#Number of forward progress counter failures before failover
+failed_counter_threshold=3
+
+#Interval in seconds between test transactions if there is no other traffic
+test_trans_interval=10
+
+#Interval in seconds between updates of the forward progress counter in the DB
+write_fpc_interval=5
+
+#Name of the site
+site_name=site_1
+
+#Node type
+node_type=pdp_xacml
+
+#Dependency groups are groups of resources upon which a node operational state is dependent upon).
+#Each group is a comma-separated list of resource names and groups are separated by a semicolon.
+#A group may contain one or more members. Resource names must match the resource names defined
+#in the respective servers' properties files
+dependency_groups=site_1.pdplp_1;site_1.astragw_1;site_1.brmsgw_1
+
+# this can be DEVL, TEST, PROD
+ENVIRONMENT=DEVL
+xacml.rest.pep.idfile = client.properties
+
+#AAF Policy Name space
+#Not Mandatory for Open Onap
+policy.aaf.namespace =
+policy.aaf.resource =
+# Decision Response settings.
+# can be either PERMIT or DENY.
+decision.indeterminate.response=PERMIT \ No newline at end of file
diff --git a/ONAP-PDP-REST/xacml.pdp.properties b/ONAP-PDP-REST/xacml.pdp.properties
index 6cf2e945b..4d120042a 100644
--- a/ONAP-PDP-REST/xacml.pdp.properties
+++ b/ONAP-PDP-REST/xacml.pdp.properties
@@ -126,8 +126,8 @@ CLIENT_INTERVAL=15000
REQUEST_BUFFER_SIZE=15
#properties for MySql xacml database: PLEASE DO NOT REMOVE... NEEDED FOR APIs
-javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/onap_sdk
+javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk
javax.persistence.jdbc.user=policy_user
javax.persistence.jdbc.password=policy_user
diff --git a/ONAP-PDP/pom.xml b/ONAP-PDP/pom.xml
index 0310d390e..bd0507465 100644
--- a/ONAP-PDP/pom.xml
+++ b/ONAP-PDP/pom.xml
@@ -49,11 +49,6 @@
<version>4.4.4</version>
</dependency>
<dependency>
- <groupId>org.glassfish</groupId>
- <artifactId>javax.json</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
diff --git a/ONAP-SDK-APP/pom.xml b/ONAP-SDK-APP/pom.xml
index e6ef8ed1e..04f933930 100644
--- a/ONAP-SDK-APP/pom.xml
+++ b/ONAP-SDK-APP/pom.xml
@@ -31,7 +31,7 @@
<properties>
<encoding>UTF-8</encoding>
- <epsdk.version>1.1.0</epsdk.version>
+ <epsdk.version>1.3.1</epsdk.version>
<springframework.version>4.2.0.RELEASE</springframework.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<!-- Skip assembling the zip; assemble via mvn -Dskipassembly=false .. -->
@@ -108,8 +108,11 @@
</archive>
<overlays>
<overlay>
- <groupId>org.openecomp.ecompsdkos</groupId>
+ <groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-app-overlay</artifactId>
+ <excludes>
+ <exclude>static/fusion/raptor/uigrid/vfs_fonts.js</exclude>
+ </excludes>
</overlay>
<overlay>
<groupId>org.onap.policy.engine</groupId>
@@ -149,7 +152,7 @@
<type>war</type>
<exclusions>
<exclusion>
- <groupId>org.openecomp.ecompsdkos</groupId>
+ <groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-core</artifactId>
</exclusion>
</exclusions>
@@ -162,7 +165,7 @@
<classifier>classes</classifier>
<exclusions>
<exclusion>
- <groupId>org.openecomp.ecompsdkos</groupId>
+ <groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-core</artifactId>
</exclusion>
</exclusions>
@@ -180,25 +183,31 @@
</dependency>
<!-- SDK overlay war -->
<dependency>
- <groupId>org.openecomp.ecompsdkos</groupId>
+ <groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-app-overlay</artifactId>
<version>${epsdk.version}</version>
<type>war</type>
</dependency>
<dependency>
- <groupId>org.openecomp.ecompsdkos</groupId>
+ <groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-app-common</artifactId>
<version>${epsdk.version}</version>
<type>jar</type>
</dependency>
<!-- SDK components -->
<dependency>
- <groupId>org.openecomp.ecompsdkos</groupId>
+ <groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-core</artifactId>
<version>${epsdk.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>org.openecomp.ecompsdkos</groupId>
+ <groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-analytics</artifactId>
<version>${epsdk.version}</version>
<exclusions>
@@ -209,7 +218,7 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.openecomp.ecompsdkos</groupId>
+ <groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-workflow</artifactId>
<version>${epsdk.version}</version>
</dependency>
diff --git a/ONAP-SDK-APP/src/main/java/org/openecomp/portalapp/login/LoginStrategyImpl.java b/ONAP-SDK-APP/src/main/java/org/openecomp/portalapp/login/LoginStrategyImpl.java
index 567fbb7cf..3b38f1d8e 100644
--- a/ONAP-SDK-APP/src/main/java/org/openecomp/portalapp/login/LoginStrategyImpl.java
+++ b/ONAP-SDK-APP/src/main/java/org/openecomp/portalapp/login/LoginStrategyImpl.java
@@ -26,10 +26,10 @@ import javax.servlet.http.HttpServletResponse;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.openecomp.portalsdk.core.auth.LoginStrategy;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.onboarding.exception.PortalAPIException;
import org.openecomp.portalsdk.core.onboarding.util.CipherUtil;
-import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants;
-import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.openecomp.portalsdk.core.util.SystemProperties;
import org.springframework.web.servlet.ModelAndView;
public class LoginStrategyImpl extends LoginStrategy {
@@ -58,23 +58,21 @@ public class LoginStrategyImpl extends LoginStrategy {
}
private static String getUserIdFromCookie(HttpServletRequest request) throws PortalAPIException {
- String userId = "";
- Cookie[] cookies = request.getCookies();
- Cookie userIdcookie = null;
- if (cookies != null)
- for (Cookie cookie : cookies)
- if (cookie.getName().equals(USER_ID))
- userIdcookie = cookie;
- if (userIdcookie != null) {
- try {
- userId = CipherUtil.decrypt(userIdcookie.getValue(),
- PortalApiProperties.getProperty(PortalApiConstants.Decryption_Key));
- } catch (Exception e) {
- throw new PortalAPIException(e);
- }
- }
- return userId;
-
+ String userId = "";
+ Cookie userIdCookie = getCookie(request, USER_ID);
+ if (userIdCookie != null) {
+ final String cookieValue = userIdCookie.getValue();
+ if (!SystemProperties.containsProperty(SystemProperties.Decryption_Key))
+ throw new IllegalStateException("Failed to find property " + SystemProperties.Decryption_Key);
+ final String decryptionKey = SystemProperties.getProperty(SystemProperties.Decryption_Key);
+ try {
+ userId = CipherUtil.decrypt(cookieValue, decryptionKey);
+ LOGGER.debug("getUserIdFromCookie: decrypted as {}" +userId);
+ } catch (Exception e) {
+ LOGGER.error("Exception Occured in getUserIdFromCookie" + e);
+ }
+ }
+ return userId;
}
private static boolean isLoginCookieExist(HttpServletRequest request) {
diff --git a/ONAP-SDK-APP/src/main/resources/portal.properties b/ONAP-SDK-APP/src/main/resources/portal.properties
index 2ab096f1a..1f2336d7b 100644
--- a/ONAP-SDK-APP/src/main/resources/portal.properties
+++ b/ONAP-SDK-APP/src/main/resources/portal.properties
@@ -27,11 +27,6 @@ portal.api.prefix = /api
max.idle.time = 5
user.attribute.name = user_attribute
-# CSP settings
-csp_cookie_name = attESSec
-csp_gate_keeper_prod_key = PROD
-testing=testing
-
#Use REST API instead of UEB to fetch the functional menu data
use_rest_for_functional_menu=true
@@ -43,10 +38,10 @@ use_rest_for_functional_menu=true
portal.api.impl.class = org.openecomp.portalapp.service.OnBoardingApiServiceImpl
# CSP Global Log On for single sign on
-onap_redirect_url = todo_csp_global_logon
+ecomp_redirect_url = todo_csp_global_logon
# URL of the ONAP Portal REST API
-onap_rest_url = todo_Onap_rest_url
+ecomp_rest_url = todo_Onap_rest_url
# Applications do not need to run a UEB listener in 1610.
ueb_listeners_enable = false
@@ -58,7 +53,7 @@ ueb_listeners_enable = false
# UEB servers
ueb_url_list = todo_ueb_list
# ONAP Portal listens on this UEB topic
-onap_portal_inbox_name = ONAP-PORTAL-INBOX-TEST-DEMETER
+ecomp_portal_inbox_name = ONAP-PORTAL-INBOX-TEST-DEMETER
# Replace these 3 default values with the ones for your specific App,
# as shown on the on-boarding page on the ONAP Portal web application.
ueb_app_key = ZOicEniw7BWDL1pM
diff --git a/ONAP-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties b/ONAP-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties
index 304bcbd90..aa8ee1476 100644
--- a/ONAP-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties
+++ b/ONAP-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties
@@ -23,8 +23,8 @@ decryption_key = AGLDdG4D04BKm2IxIWEr8o==
# The following properties MAY require changes by partner applications.
##########################################################################
#Mysql
-db.driver = com.mysql.jdbc.Driver
-db.connectionURL = jdbc:mysql://localhost:3306/onap_sdk
+db.driver = org.mariadb.jdbc.Driver
+db.connectionURL = jdbc:mariadb://localhost:3306/onap_sdk
db.userName = policy_user
db.password = policy_user
db.hib.dialect = org.hibernate.dialect.MySQLDialect
@@ -50,7 +50,7 @@ mylogins_feed_cron = 0 0/60 * * * ?;
my_login_feed_output_dir = /tmp/MyLogins
# ONAP Portal Shared Context REST API URL
-onap_shared_context_rest_url= todo_shared_context_url
+ecomp_shared_context_rest_url= todo_shared_context_url
# Link shown in Help menu
contact_us_link = todo_Contact_link
diff --git a/ONAP-SDK-APP/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2Header.html b/ONAP-SDK-APP/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2Header.html
new file mode 100644
index 000000000..444514939
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2Header.html
@@ -0,0 +1,68 @@
+<div class="header-main-div" >
+ <header class="b2b-header-tabs" b2b-header-responsive ng-show="{{showHeader}}">
+ <ul class="header__items" role="navigation">
+ <li class="header__item icon__item" tabindex="0" ng-click="returnToPortal()">
+ <span class="globe-text">ONAP Portal</span>
+ </li>
+ <li b2b-header-menu class="header__item b2b-headermenu" ng-repeat="item in menuItems" role="presentation">
+ <a href="javascript:void(0);" class="menu__item" role="menuitem" ng-bind="item.text"></a>
+ <div class="header-secondary-wrapper">
+ <ul class="header-secondary" role="menu">
+ <li class="header-subitem" b2b-header-submenu
+ ng-repeat="secondLevMenu in item.children" role="presentation">
+ <a href="{{secondLevMenu.action}}" ng-if="secondLevMenu.childMenus.length==0" class="menu__item" role="menuitem" ng-bind="secondLevMenu.label"></a>
+ <a href="javascript:void(0);" ng-if="secondLevMenu.childMenus.length!=0" class="menu__item" role="menuitem" ng-bind="secondLevMenu.label" ></a>
+ <div class="header-tertiary-wrapper">
+ <ul class="header-tertiary" role="menu">
+ <li b2b-header-tertiarymenu ng-repeat="thirdLevMenu in secondLevMenu.childMenus"role="presentation">
+ <a href="{{thirdLevMenu.action}}"role="menuitem" aria-haspopup="true" ng-bind="thirdLevMenu.label"></a>
+ </li>
+ </ul>
+ </div>
+ </li>
+ </ul>
+ </div></li>
+ <li class="header__item profile">
+ <b2b-flyout>
+ <div b2b-flyout-toggler class="header-profile" >
+ <div class="icon-people-oneperson" id="header-user-icon" tabindex="0" b2b-accessibility-click="13,32" aria-label="notifications" aria-haspopup="true" aria-expanded="{{flyoutOpened}}" role="button"></div>
+ <div id="login-snippet-text" class="login-snippet-text">{{userFirstName}}</div>
+ </div>
+ <b2b-flyout-content horizontal-placement="center" vertical-placement="below">
+ <div>
+ <div id="reg-header-snippet">
+ <div tabindex="0" class="reg-profileDetails" id="reg-profiledetails-id">
+ <ul class="reg-Details-table">
+ <li>
+ <div class="reg-userName-table">
+ <div id="reg-userName-table-row">
+ <div id="reg-userName-table-cell">
+ <h3 ng-bind="userName">&nbsp;</h3>
+ <span>&nbsp;</span>
+ </div>
+ </div>
+ </div>
+ </li>
+ <li><div class="reg-userEmail-label"><span class="reg-userEmail-label-spn" style=font-weight:bold>Email<span class="visuallyhidden">:
+ </span></span></div></li>
+ <li><div class="reg-userEmail-value"><span class="reg-userEmail-value-spn">
+ {{userEmail}}</span></div></li>
+ <li>&nbsp;</li>
+ <li><div class="reg-userRole-label"><span class="reg-userRole-label-spn" style=font-weight:bold>
+ User Id<span class="visuallyhidden">:</span></span></div></li>
+ <li><div class="reg-userRole-value"><span class="reg-userRole-value-spn">
+ {{userId}}<span class="visuallyhidden"></span></span></div></li>
+ </ul>
+ <div id="reg-logout-div" style="padding-top: 8px">
+ <a href="logout.htm" id="allLogout" class="btn btn-alt btn-small">
+ Log out
+ </a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </b2b-flyout-content>
+ </b2b-flyout>
+ </ul>
+ </header>
+</div>
diff --git a/ONAP-SDK-APP/xacml.admin.properties b/ONAP-SDK-APP/xacml.admin.properties
index 0f285b694..333da49a5 100644
--- a/ONAP-SDK-APP/xacml.admin.properties
+++ b/ONAP-SDK-APP/xacml.admin.properties
@@ -87,8 +87,8 @@ xacml.log.db.password=policy_user
xacml.att.log.timeframe=150
-javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/onap_sdk
+javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk
javax.persistence.jdbc.user=policy_user
javax.persistence.jdbc.password=policy_user
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPAPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPAPPolicy.java
index 78ce354e0..4539b4225 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPAPPolicy.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPAPPolicy.java
@@ -46,6 +46,7 @@ public interface OnapPAPPolicy {
public String getOnapName();
public String getConfigName();
public Map<String, String> getDynamicFieldConfigAttributes();
+ public Map<String, String> getTreatments();
public Map<String, String> getDynamicSettingsMap();
public List<String> getDynamicRuleAlgorithmLabels();
public List<String> getDynamicRuleAlgorithmCombo();
@@ -81,7 +82,6 @@ public interface OnapPAPPolicy {
public String getDictionaryType();
public String getDictionary();
public String getDictionaryFields();
-
public String getRiskLevel();
public String getGuard();
public String getRiskType();
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
index 56676f38b..034c08bfa 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
@@ -36,6 +36,7 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable{
private String onapName = null;
private String configName = null;
private Map<String, String> dyanamicFieldConfigAttributes = new HashMap<>();
+ private Map<String, String> treatments = new HashMap<>();
private Map<String, String> dropDownMap = new HashMap<>();
private Map<String, String> dynamicSettingsMap = new HashMap<>();
private List<String> dynamicRuleAlgorithmLabels;
@@ -125,8 +126,9 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable{
}
- //Constructor for Create/Update Decision Policies from Admin Console
- public StdPAPPolicy(String policyName, String description, String onapName, String providerComboBox, Map<String, String> attributes, Map<String, String> settings,
+ //Constructor for Create/Update Decision Policies
+ public StdPAPPolicy(String policyName, String description, String onapName, String providerComboBox,
+ Map<String, String> attributes, Map<String, String> settings, Map<String, String> treatments,
List<String> dynamicRuleAlgorithmLabels, List<String> dynamicRuleAlgorithmCombo, List<String> dynamicRuleAlgorithmField1,
List<String> dynamicRuleAlgorithmField2, Map<String, String> dropDownMap, List<Object> dynamicVariableList,
List<String> dataTypeList, Boolean editPolicy, String domain, int highestVersion) {
@@ -147,10 +149,10 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable{
this.editPolicy = editPolicy;
this.domain = domain;
this.highestVersion = highestVersion;
+ this.treatments = treatments;
}
-
//Constructor for Create Config Policies from API and Admin Console
//Constructor for Updating Config Policies from the API
public StdPAPPolicy(String configPolicyType, String policyName, String description, String onapName, String configName, Map<String, String> attributes, String configType,
@@ -675,6 +677,11 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable{
}
@Override
+ public Map<String, String> getTreatments() {
+ return treatments;
+ }
+
+ @Override
public String toString() {
return "StdPAPPolicy [policyName=" + policyName + ", policyDescription=" + policyDescription + ", onapName="
+ onapName + ", configName=" + configName + ", dyanamicFieldConfigAttributes=" + dyanamicFieldConfigAttributes + ", configBodyData=" + configBodyData
@@ -688,9 +695,10 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable{
+ ",dataTypeList=" + dataTypeList + ",draft=" + ",oldPolicyFileName=" + oldPolicyFileName + ",serviceType=" + serviceType
+ ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority=" + priority + ",deleteCondition=" + deleteCondition + ",dictionaryType=" + dictionaryType
+ ",dictionary=" + dictionary + ",dictionaryFields=" + dictionaryFields + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority="
- + priority + ",deleteCondition=" + deleteCondition + ",riskType="+riskType + ",riskLevel="+riskLevel + ",guard="+ guard + ",ttlDate="+ ttlDate + "]";
+ + priority + ",deleteCondition=" + deleteCondition + ",riskType="+riskType + ",riskLevel="+riskLevel + ",guard="+ guard + ",ttlDate="+ ttlDate
+ + ",treatments=" + treatments + "]";
}
-
+
// Methods needed for JSON Deserialization
public void setPolicyName(String policyName) {
this.policyName = policyName;
@@ -907,4 +915,8 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable{
public void setBrmsDependency(ArrayList<String> brmsDependency) {
this.brmsDependency = brmsDependency;
}
+
+ public void setTreatments(Map<String, String> treatments) {
+ this.treatments = treatments;
+ }
} \ No newline at end of file
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java
new file mode 100644
index 000000000..6600a9208
--- /dev/null
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdEngineTest.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-XACML
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.xacml.test.std.pap;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.xacml.api.pap.OnapPDP;
+import org.onap.policy.xacml.std.pap.StdEngine;
+
+import com.att.research.xacml.api.pap.PAPException;
+import com.att.research.xacml.std.pap.StdPDP;
+
+public class StdEngineTest {
+
+ private static Logger logger = FlexLogger.getLogger(StdEngineTest.class);
+ private Path repository;
+ Properties properties = new Properties();
+ StdEngine stdEngine = null;
+
+ @Before
+ public void setUp(){
+
+ repository = Paths.get("src/test/resources/pdps");
+ try {
+ stdEngine = new StdEngine(repository);
+ } catch (PAPException e) {
+ logger.info(e);
+ } catch (IOException e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetDefaultGroup(){
+ try {
+ assertTrue(stdEngine.getDefaultGroup() != null);
+ } catch (PAPException e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetGroup(){
+ try {
+ assertTrue(stdEngine.getGroup("1") == null);
+ } catch (PAPException e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testGetOnapPDPGroups(){
+ try {
+ assertTrue(stdEngine.getOnapPDPGroups() != null);
+ } catch (PAPException e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetPDP(){
+ try {
+ assertTrue(stdEngine.getPDP("1") == null);
+ } catch (PAPException e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetPDPGroup(){
+ try {
+ assertTrue(stdEngine.getPDPGroup(null) == null);
+ } catch (PAPException e) {
+ logger.info(e);
+ }
+ }
+}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPAPPolicyTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPAPPolicyTest.java
new file mode 100644
index 000000000..da7476b67
--- /dev/null
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPAPPolicyTest.java
@@ -0,0 +1,543 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-XACML
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.xacml.test.std.pap;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.xacml.api.pap.OnapPDP;
+import org.onap.policy.xacml.std.pap.StdEngine;
+import org.onap.policy.xacml.std.pap.StdPAPPolicy;
+
+import com.att.research.xacml.api.pap.PAPException;
+import com.att.research.xacml.std.pap.StdPDP;
+
+public class StdPAPPolicyTest {
+
+ private static Logger logger = FlexLogger.getLogger(StdPAPPolicyTest.class);
+ private Path repository;
+ Properties properties = new Properties();
+ StdPAPPolicy stdPAPPolicy;
+
+ @Before
+ public void setUp(){
+
+ repository = Paths.get("src/test/resources/pdps");
+ try {
+ stdPAPPolicy = new StdPAPPolicy();
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetActionAttribute(){
+ try {
+ stdPAPPolicy.setActionAttribute("test");
+ assertTrue(stdPAPPolicy.getActionAttribute() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetActionBody(){
+ try {
+ stdPAPPolicy.setActionBody("actionBody");
+ assertTrue(stdPAPPolicy.getActionBody() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testGetActionDictHeader(){
+ try {
+ stdPAPPolicy.setActionDictHeader("actionDictHeader");
+ assertTrue(stdPAPPolicy.getActionDictHeader() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetActionDictMethod(){
+ try {
+ stdPAPPolicy.setActionDictMethod("actionDictMethod");
+ assertTrue(stdPAPPolicy.getActionDictMethod() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetActionDictType(){
+ try {
+ stdPAPPolicy.setActionDictType("actionDictType");
+ assertTrue(stdPAPPolicy.getActionDictType() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetActionDictUrl(){
+ try {
+ stdPAPPolicy.setActionDictUrl("actionDictUrl");
+ assertTrue(stdPAPPolicy.getActionDictUrl() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetActionPerformer(){
+ try {
+ stdPAPPolicy.setActionPerformer("actionPerformer");
+ assertTrue(stdPAPPolicy.getActionPerformer() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testGetBrmsController(){
+ try {
+ stdPAPPolicy.setBrmsController("brmsController");
+ assertTrue(stdPAPPolicy.getBrmsController() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetBrmsDependency(){
+ try {
+ stdPAPPolicy.setBrmsDependency(new ArrayList());
+ assertTrue(stdPAPPolicy.getBrmsDependency() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetConfigBodyData(){
+ try {
+ stdPAPPolicy.setConfigBodyData("configBodyData");
+ assertTrue(stdPAPPolicy.getConfigBodyData() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+
+ @Test
+ public void testGetConfigName(){
+ try {
+ stdPAPPolicy.setConfigName("configName");
+ assertTrue(stdPAPPolicy.getConfigName() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetConfigPolicyType(){
+ try {
+ stdPAPPolicy.setConfigPolicyType("configPolicyType");
+ assertTrue(stdPAPPolicy.getConfigPolicyType() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testGetConfigType(){
+ try {
+ stdPAPPolicy.setConfigType("configType");
+ assertTrue(stdPAPPolicy.getConfigType() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetDataTypeList(){
+ try {
+ stdPAPPolicy.setDataTypeList(new ArrayList<String>());
+ assertTrue(stdPAPPolicy.getDataTypeList() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetDeleteCondition(){
+ try {
+ stdPAPPolicy.setDeleteCondition("deleteCondition");
+ assertTrue(stdPAPPolicy.getDeleteCondition() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+
+ @Test
+ public void testGetDrlRuleAndUIParams(){
+ try {
+ stdPAPPolicy.setDrlRuleAndUIParams(new HashMap());
+ assertTrue(stdPAPPolicy.getDrlRuleAndUIParams() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetDropDownMap(){
+ try {
+ stdPAPPolicy.setDropDownMap(new HashMap());
+ assertTrue(stdPAPPolicy.getDropDownMap() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testGetDynamicFieldConfigAttributes(){
+ try {
+ assertTrue(stdPAPPolicy.getDynamicFieldConfigAttributes() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetDynamicRuleAlgorithmCombo(){
+ try {
+ stdPAPPolicy.setDynamicRuleAlgorithmCombo(new ArrayList());
+ assertTrue(stdPAPPolicy.getDynamicRuleAlgorithmCombo() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetDynamicRuleAlgorithmField1(){
+ try {
+ stdPAPPolicy.setDynamicRuleAlgorithmField1(new ArrayList());
+ assertTrue(stdPAPPolicy.getDynamicRuleAlgorithmField1() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetDictionary(){
+ try {
+ stdPAPPolicy.setDictionary("dictionary");
+ assertTrue(stdPAPPolicy.getDictionary() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetDictionaryFields(){
+ try {
+ stdPAPPolicy.setDictionaryFields("dictionaryFields");
+ assertTrue(stdPAPPolicy.getDictionaryFields() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testGetDictionaryType(){
+ try {
+ stdPAPPolicy.setDictionaryType("dictionaryType");
+ assertTrue(stdPAPPolicy.getDictionaryType() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetDomainDir(){
+ try {
+ stdPAPPolicy.setDomainDir("domain");
+ assertTrue(stdPAPPolicy.getDomainDir() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testIsDraft(){
+ try {
+ stdPAPPolicy.setDraft(true);
+ assertTrue(stdPAPPolicy.isDraft() == true);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetDynamicRuleAlgorithmLabels(){
+ try {
+ stdPAPPolicy.setDynamicRuleAlgorithmLabels(new ArrayList());
+ assertTrue(stdPAPPolicy.getDynamicRuleAlgorithmLabels() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetDynamicSettingsMap(){
+ try {
+ stdPAPPolicy.setDynamicSettingsMap(new HashMap());
+ assertTrue(stdPAPPolicy.getDynamicSettingsMap() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testGetDynamicVariableList(){
+ try {
+ stdPAPPolicy.setDynamicVariableList(new ArrayList());
+ assertTrue(stdPAPPolicy.getDynamicVariableList() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetGuard(){
+ try {
+ stdPAPPolicy.setGuard("domain");
+ assertTrue(stdPAPPolicy.getGuard() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetHighestVersion(){
+ try {
+ stdPAPPolicy.setHighestVersion(123);
+ assertTrue(stdPAPPolicy.getHighestVersion() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testgGtJsonBody(){
+ try {
+ stdPAPPolicy.setJsonBody("jsonBoby");
+ assertTrue(stdPAPPolicy.getJsonBody() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetLocation(){
+ try {
+ stdPAPPolicy.setLocation(new URI("test"));
+ assertTrue(stdPAPPolicy.getLocation() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testGetMsLocation(){
+ try {
+ stdPAPPolicy.setMsLocation("MsLocation");
+ assertTrue(stdPAPPolicy.getMsLocation() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testSetOldPolicyFileName(){
+ try {
+ stdPAPPolicy.setOldPolicyFileName("domain");
+ assertTrue(stdPAPPolicy.getOldPolicyFileName() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetOnapName(){
+ try {
+ stdPAPPolicy.setOnapName("onap");
+ assertTrue(stdPAPPolicy.getOnapName() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetPolicyDescription(){
+ try {
+ stdPAPPolicy.setPolicyDescription("description test");
+ assertTrue(stdPAPPolicy.getPolicyDescription() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetPolicyID(){
+ try {
+ stdPAPPolicy.setPolicyID("test");
+ assertTrue(stdPAPPolicy.getPolicyID() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testSetPolicyName(){
+ try {
+ stdPAPPolicy.setPolicyName("MsLocation");
+ assertTrue(stdPAPPolicy.getPolicyName() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testSetPriority(){
+ try {
+ stdPAPPolicy.setPriority("domain");
+ assertTrue(stdPAPPolicy.getPriority() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetProviderComboBox(){
+ try {
+ stdPAPPolicy.setProviderComboBox("onap");
+ assertTrue(stdPAPPolicy.getProviderComboBox() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetRiskLevel(){
+ try {
+ stdPAPPolicy.setRiskLevel("test");
+ assertTrue(stdPAPPolicy.getRiskLevel() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetRiskType(){
+ try {
+ stdPAPPolicy.setRiskType("test");
+ assertTrue(stdPAPPolicy.getRiskType() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testGetRuleID(){
+ try {
+ stdPAPPolicy.setRuleID("MsLocation");
+ assertTrue(stdPAPPolicy.getRuleID() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetServiceType(){
+ try {
+ stdPAPPolicy.setServiceType("domain");
+ assertTrue(stdPAPPolicy.getServiceType() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+ @Test
+ public void testGetTTLDate(){
+ try {
+ stdPAPPolicy.setTTLDate("09/20/17");
+ assertTrue(stdPAPPolicy.getTTLDate() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+
+ @Test
+ public void testGetUuid(){
+ try {
+ stdPAPPolicy.setUuid("11212122");
+ assertTrue(stdPAPPolicy.getUuid() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testGetVersion(){
+ try {
+ stdPAPPolicy.setVersion("testv01");
+ assertTrue(stdPAPPolicy.getVersion() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+
+ }
+
+ @Test
+ public void testIsEditPolicy(){
+ try {
+ stdPAPPolicy.setEditPolicy(true);
+ assertTrue(stdPAPPolicy.isEditPolicy() == true);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+ @Test
+ public void testToString(){
+ try {
+ assertTrue(stdPAPPolicy.toString() != null);
+ } catch (Exception e) {
+ logger.info(e);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/POLICY-SDK-APP/pom.xml b/POLICY-SDK-APP/pom.xml
index 5adb5d169..aea0afc24 100644
--- a/POLICY-SDK-APP/pom.xml
+++ b/POLICY-SDK-APP/pom.xml
@@ -49,7 +49,7 @@
</build>
<properties>
<encoding>UTF-8</encoding>
- <epsdk.version>1.1.0</epsdk.version>
+ <epsdk.version>1.3.1</epsdk.version>
<springframework.version>4.2.0.RELEASE</springframework.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<skipassembly>true</skipassembly>
@@ -59,9 +59,15 @@
</properties>
<dependencies>
<dependency>
- <groupId>org.openecomp.ecompsdkos</groupId>
+ <groupId>org.onap.portal.sdk</groupId>
<artifactId>epsdk-core</artifactId>
<version>${epsdk.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<!-- Spring -->
<dependency>
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java
index 3febbed44..7ac9ca310 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java
@@ -34,6 +34,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -49,9 +50,14 @@ public class CheckPDP {
private static HashMap<String, String> pdpMap = null;
private static final Logger LOGGER = FlexLogger.getLogger(CheckPDP.class);
- private CheckPDP(){
+ public static Map<String, String> getPdpMap() {
+ return pdpMap;
+ }
+
+ public CheckPDP(){
//default constructor
}
+
public static boolean validateID(String id) {
// ReadFile
try {
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java
index 4f42023c9..d65d1da8a 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -91,16 +91,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class PolicyManagerServlet extends HttpServlet {
private static final Logger LOGGER = FlexLogger.getLogger(PolicyManagerServlet.class);
private static final long serialVersionUID = -8453502699403909016L;
-
- private static boolean jUnit = false;
-
- public static boolean isjUnit() {
- return jUnit;
- }
-
- public static void setjUnit(boolean jUnit) {
- PolicyManagerServlet.jUnit = jUnit;
- }
private enum Mode {
LIST, RENAME, COPY, DELETE, EDITFILE, ADDFOLDER, DESCRIBEPOLICYFILE, VIEWPOLICY, ADDSUBSCOPE, SWITCHVERSION, EXPORT, SEARCHLIST
@@ -123,11 +113,11 @@ public class PolicyManagerServlet extends HttpServlet {
private static String EDITOR = "editor";
private static String GUEST = "guest";
private static String RESULT = "result";
-
+
private static Path closedLoopJsonLocation;
private static JsonArray policyNames;
private static String testUserId = null;
-
+
public static JsonArray getPolicyNames() {
return policyNames;
}
@@ -154,7 +144,7 @@ public class PolicyManagerServlet extends HttpServlet {
//
PolicyManagerServlet.initializeJSONLoad();
}
-
+
protected static void initializeJSONLoad() {
closedLoopJsonLocation = Paths.get(XACMLProperties
.getProperty(XACMLRestProperties.PROP_ADMIN_CLOSEDLOOP));
@@ -163,7 +153,7 @@ public class PolicyManagerServlet extends HttpServlet {
String location = closedLoopJsonLocation.toString();
try {
inputStream = new FileInputStream(location);
- if (location.endsWith("json")) {
+ if (location.endsWith("json")) {
jsonReader = Json.createReader(inputStream);
policyNames = jsonReader.readArray();
serviceTypeNamesList = new ArrayList<>();
@@ -341,7 +331,7 @@ public class PolicyManagerServlet extends HttpServlet {
try {
//Get the Login Id of the User from Request
String userId = UserUtils.getUserSession(request).getOrgUserId();
- //Check if the Role and Scope Size are Null get the values from db.
+ //Check if the Role and Scope Size are Null get the values from db.
List<Object> userRoles = controller.getRoles(userId);
roles = new ArrayList<>();
scopes = new HashSet<>();
@@ -356,7 +346,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
}else{
scopes.add(userRole.getScope());
- }
+ }
}
}
if (roles.contains(ADMIN) || roles.contains(EDITOR) || roles.contains(GUEST) ) {
@@ -373,7 +363,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
}
}
- }
+ }
if(policyList!= null){
for(int i = 0; i < policyList.length(); i++){
String policyName = policyList.get(i).toString().replace(".xml", "");
@@ -390,7 +380,7 @@ public class PolicyManagerServlet extends HttpServlet {
if(!activeData.isEmpty()){
PolicyVersion policy = (PolicyVersion) activeData.get(0);
JSONObject el = new JSONObject();
- el.put("name", policy.getPolicyName().replace(File.separator, "/"));
+ el.put("name", policy.getPolicyName().replace(File.separator, "/"));
el.put("date", policy.getModifiedDate());
el.put("version", policy.getActiveVersion());
el.put("size", "");
@@ -409,7 +399,7 @@ public class PolicyManagerServlet extends HttpServlet {
PolicyVersion filterdata = (PolicyVersion) filter;
try{
String scopeName = filterdata.getPolicyName().substring(0, filterdata.getPolicyName().lastIndexOf(File.separator));
- if(scopes.contains(scopeName)){
+ if(scopes.contains(scopeName)){
policyData.add(filterdata);
}
}catch(Exception e){
@@ -417,12 +407,12 @@ public class PolicyManagerServlet extends HttpServlet {
}
}
}
-
+
if(!policyData.isEmpty()){
for(int i =0; i < policyData.size(); i++){
PolicyVersion policy = (PolicyVersion) policyData.get(i);
JSONObject el = new JSONObject();
- el.put("name", policy.getPolicyName().replace(File.separator, "/"));
+ el.put("name", policy.getPolicyName().replace(File.separator, "/"));
el.put("date", policy.getModifiedDate());
el.put("version", policy.getActiveVersion());
el.put("size", "");
@@ -436,7 +426,7 @@ public class PolicyManagerServlet extends HttpServlet {
}catch(Exception e){
LOGGER.error("Exception occured while reading policy Data from Policy Version table for Policy Search Data"+e);
}
-
+
return new JSONObject().put(RESULT, resultList);
}
@@ -542,7 +532,7 @@ public class PolicyManagerServlet extends HttpServlet {
peParams.put("split_1", split[1]);
peParams.put("split_0", split[0]);
List<Object> queryData = null;
- if(jUnit){
+ if(PolicyController.isjUnit()){
queryData = controller.getDataByQuery(query, null);
}else{
queryData = controller.getDataByQuery(query, peParams);
@@ -574,12 +564,12 @@ public class PolicyManagerServlet extends HttpServlet {
}else{
return error("Error Occured while Describing the Policy");
}
-
+
return object;
}
//Get the List of Policies and Scopes for Showing in Editor tab
- private JSONObject list(JSONObject params, HttpServletRequest request) throws ServletException {
+ private JSONObject list(JSONObject params, HttpServletRequest request) throws ServletException {
Set<String> scopes = null;
List<String> roles = null;
try {
@@ -587,7 +577,7 @@ public class PolicyManagerServlet extends HttpServlet {
//Get the Login Id of the User from Request
String testUserID = getTestUserId();
String userId = testUserID != null ? testUserID : UserUtils.getUserSession(request).getOrgUserId();
- //Check if the Role and Scope Size are Null get the values from db.
+ //Check if the Role and Scope Size are Null get the values from db.
List<Object> userRoles = controller.getRoles(userId);
roles = new ArrayList<>();
scopes = new HashSet<>();
@@ -602,7 +592,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
}else{
scopes.add(userRole.getScope());
- }
+ }
}
}
@@ -623,8 +613,8 @@ public class PolicyManagerServlet extends HttpServlet {
scopes.add(tempScope);
}
}
- }
-
+ }
+
if("/".equals(path)){
if(roles.contains(SUPERADMIN) || roles.contains(SUPEREDITOR) || roles.contains(SUPERGUEST)){
List<Object> scopesList = queryPolicyEditorScopes(null);
@@ -632,7 +622,7 @@ public class PolicyManagerServlet extends HttpServlet {
PolicyEditorScopes scope = (PolicyEditorScopes) list;
if(!(scope.getScopeName().contains(File.separator))){
JSONObject el = new JSONObject();
- el.put("name", scope.getScopeName());
+ el.put("name", scope.getScopeName());
el.put("date", scope.getCreatedDate());
el.put("size", "");
el.put("type", "dir");
@@ -647,7 +637,7 @@ public class PolicyManagerServlet extends HttpServlet {
List<Object> scopesList = queryPolicyEditorScopes(scope.toString());
if(!scopesList.isEmpty()){
PolicyEditorScopes scopeById = (PolicyEditorScopes) scopesList.get(0);
- el.put("name", scopeById.getScopeName());
+ el.put("name", scopeById.getScopeName());
el.put("date", scopeById.getCreatedDate());
el.put("size", "");
el.put("type", "dir");
@@ -663,7 +653,7 @@ public class PolicyManagerServlet extends HttpServlet {
activePolicyList(scopeName, resultList, roles, scopes, onlyFolders);
} catch (Exception ex) {
LOGGER.error("Error Occured While reading Policy Files List"+ex );
- }
+ }
}
return new JSONObject().put(RESULT, resultList);
@@ -684,7 +674,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
PolicyController controller = getPolicyControllerInstance();
List<Object> scopesList = null;
- if(jUnit){
+ if(PolicyController.isjUnit()){
scopesList = controller.getDataByQuery(scopeNamequery, null);
}else{
scopesList = controller.getDataByQuery(scopeNamequery, params);
@@ -703,13 +693,13 @@ public class PolicyManagerServlet extends HttpServlet {
}
String query = "from PolicyVersion where POLICY_NAME like :scopeName";
String scopeNamequery = "from PolicyEditorScopes where SCOPENAME like :scopeName";
-
+
SimpleBindings params = new SimpleBindings();
params.put("scopeName", scopeName + "%");
-
+
List<Object> activePolicies = null;
List<Object> scopesList = null;
- if(jUnit){
+ if(PolicyController.isjUnit()){
activePolicies = controller.getDataByQuery(query, null);
scopesList = controller.getDataByQuery(scopeNamequery, null);
}else{
@@ -732,7 +722,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
if(scopeName.equalsIgnoreCase(checkScope)){
JSONObject el = new JSONObject();
- el.put("name", scope);
+ el.put("name", scope);
el.put("date", scopeById.getModifiedDate());
el.put("size", "");
el.put("type", "dir");
@@ -740,7 +730,7 @@ public class PolicyManagerServlet extends HttpServlet {
el.put("modifiedBy", scopeById.getUserModifiedBy().getUserName());
resultList.add(el);
}
- }
+ }
}
String scopeNameCheck = null;
for (Object list : activePolicies) {
@@ -754,7 +744,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
if(scopeNameValue.equals(scopeNameCheck)){
JSONObject el = new JSONObject();
- el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1));
+ el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1));
el.put("date", policy.getModifiedDate());
el.put("version", policy.getActiveVersion());
el.put("size", "");
@@ -765,7 +755,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
}else if(!scopes.isEmpty() && scopes.contains(scopeNameValue)){
JSONObject el = new JSONObject();
- el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1));
+ el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1));
el.put("date", policy.getModifiedDate());
el.put("version", policy.getActiveVersion());
el.put("size", "");
@@ -774,7 +764,7 @@ public class PolicyManagerServlet extends HttpServlet {
el.put("modifiedBy", getUserName(policy.getModifiedBy()));
resultList.add(el);
}
- }
+ }
}
private String getUserName(String loginId){
@@ -836,11 +826,11 @@ public class PolicyManagerServlet extends HttpServlet {
if(activePolicies.size() != policyActiveInPDP.size()){
rename = true;
}
-
+
UserInfo userInfo = new UserInfo();
userInfo.setUserLoginId(userId);
if(policyActiveInPDP.size() == 0){
- renameScope(scopesList, scopeName, newScopeName, controller);
+ renameScope(scopesList, scopeName, newScopeName, controller);
}else if(rename){
renameScope(scopesList, scopeName, newScopeName, controller);
for(String scope : scopeOfPolicyActiveInPDP){
@@ -853,7 +843,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
if(isActive){
return error("The Following policies rename failed. Since they are active in PDP Groups" +policyActiveInPDP);
- }
+ }
}
return success();
} catch (Exception e) {
@@ -861,7 +851,7 @@ public class PolicyManagerServlet extends HttpServlet {
return error(e.getMessage());
}
}
-
+
private void renameScope(List<Object> scopesList, String scopeName, String newScopeName, PolicyController controller){
for(Object object : scopesList){
PolicyEditorScopes editorScopeEntity = (PolicyEditorScopes) object;
@@ -874,7 +864,7 @@ public class PolicyManagerServlet extends HttpServlet {
controller.updateData(editorScopeEntity);
}
}
-
+
private JSONObject policyRename(String oldPath, String newPath, String userId) throws ServletException {
try {
PolicyEntity entity = null;
@@ -909,7 +899,7 @@ public class PolicyManagerServlet extends HttpServlet {
String[] oldPolicySplit = oldPolicyCheck.split(":");
//Check PolicyEntity table with newPolicy Name
- String policyEntityquery = "FROM PolicyEntity where policyName = :newPolicySplit_1 and scope = :newPolicySplit_1";
+ String policyEntityquery = "FROM PolicyEntity where policyName = :newPolicySplit_1 and scope = :newPolicySplit_0";
SimpleBindings policyParams = new SimpleBindings();
policyParams.put("newPolicySplit_1", newPolicySplit[1]);
policyParams.put("newPolicySplit_0", newPolicySplit[0]);
@@ -951,7 +941,7 @@ public class PolicyManagerServlet extends HttpServlet {
}else{
return error("Policy rename failed due to policy not able to retrieve from database. Please, contact super-admin.");
}
-
+
return success();
} catch (Exception e) {
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured While Renaming Policy"+e);
@@ -959,7 +949,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
}
- private JSONObject checkOldPolicyEntryAndUpdate(PolicyEntity entity, String newScope, String removenewPolicyExtension, String oldScope, String removeoldPolicyExtension,
+ private JSONObject checkOldPolicyEntryAndUpdate(PolicyEntity entity, String newScope, String removenewPolicyExtension, String oldScope, String removeoldPolicyExtension,
String policyName, String newpolicyName, String oldpolicyName, String userId) throws ServletException{
try {
ConfigurationDataEntity configEntity = entity.getConfigurationData();
@@ -1151,7 +1141,7 @@ public class PolicyManagerServlet extends HttpServlet {
cloneRecord(newPolicySplit[1], oldPolicySplit[0], oldPolicySplit[1], newPolicySplit[0], newPolicySplit[1], entity, userId);
success = true;
}
-
+
if(success){
PolicyVersion entityItem = new PolicyVersion();
entityItem.setActiveVersion(Integer.parseInt(version));
@@ -1202,7 +1192,8 @@ public class PolicyManagerServlet extends HttpServlet {
splitPolicyName = policyNamewithoutExtension.replace(".Decision_", ":Decision_");
}
String[] split = splitPolicyName.split(":");
- query = "FROM PolicyEntity where policyName like split_1 and scope = split_0";
+
+ query = "FROM PolicyEntity where policyName like :split_1 and scope = :split_0";
policyParams.put("split_1", split[1] + "%");
policyParams.put("split_0", split[0]);
}else{
@@ -1210,7 +1201,7 @@ public class PolicyManagerServlet extends HttpServlet {
query = "FROM PolicyEntity where scope like :policyNamewithoutExtension";
policyParams.put("policyNamewithoutExtension", policyNamewithoutExtension + "%");
}
-
+
List<Object> policyEntityobjects = controller.getDataByQuery(query, policyParams);
String activePolicyName = null;
boolean pdpCheck = false;
@@ -1238,7 +1229,7 @@ public class PolicyManagerServlet extends HttpServlet {
controller.deleteData(policyEntity.getConfigurationData());
}else if(policyNamewithoutExtension.contains("Action_")){
controller.deleteData(policyEntity.getActionBodyEntity());
- }
+ }
}
}
}
@@ -1267,11 +1258,11 @@ public class PolicyManagerServlet extends HttpServlet {
String currentVersionPolicyName = policyNamewithExtension.substring(policyNamewithExtension.lastIndexOf(File.separator)+1);
String currentVersionScope = policyNamewithExtension.substring(0, policyNamewithExtension.lastIndexOf(File.separator)).replace(File.separator, ".");
query = "FROM PolicyEntity where policyName = :currentVersionPolicyName and scope = :currentVersionScope";
-
+
SimpleBindings peParams = new SimpleBindings();
peParams.put("currentVersionPolicyName", currentVersionPolicyName);
peParams.put("currentVersionScope", currentVersionScope);
-
+
List<Object> policyEntitys = controller.getDataByQuery(query, peParams);
if(!policyEntitys.isEmpty()){
policyEntity = (PolicyEntity) policyEntitys.get(0);
@@ -1292,9 +1283,9 @@ public class PolicyManagerServlet extends HttpServlet {
}else if(policyNamewithoutExtension.contains("Action_")){
controller.deleteData(policyEntity.getActionBodyEntity());
}
-
+
if(version > 1){
- int highestVersion = 0;
+ int highestVersion = 0;
if(!policyEntityobjects.isEmpty()){
for(Object object : policyEntityobjects){
policyEntity = (PolicyEntity) object;
@@ -1325,7 +1316,7 @@ public class PolicyManagerServlet extends HttpServlet {
return error("Policy can't be deleted, it is active in PDP Groups. PolicyName: '"+policyEntity.getScope() + "." +policyEntity.getPolicyName()+"'");
}
}
- }
+ }
}else{
List<String> activePoliciesInPDP = new ArrayList<String>();
if(!policyEntityobjects.isEmpty()){
@@ -1355,7 +1346,7 @@ public class PolicyManagerServlet extends HttpServlet {
//Delete from policyVersion and policyEditor Scope table
String policyVersionQuery = "delete PolicyVersion where POLICY_NAME like '"+path.replace("\\", "\\\\")+"%' and id >0";
controller.executeQuery(policyVersionQuery);
-
+
//Policy Notification
PolicyVersion entity = new PolicyVersion();
entity.setPolicyName(path);
@@ -1375,7 +1366,7 @@ public class PolicyManagerServlet extends HttpServlet {
insertactivePDPVersion.setModifiedBy(userId);
controller.saveData(insertactivePDPVersion);
}
-
+
return error("All the Policies has been deleted in Scope. Except the following list of Policies:"+activePoliciesInPDP);
}else{
String policyScopeQuery = "delete PolicyEditorScopes where SCOPENAME like '"+path.replace("\\", "\\\\")+"%' and id >0";
@@ -1401,10 +1392,10 @@ public class PolicyManagerServlet extends HttpServlet {
String mode = params.getString("mode");
String path = params.getString("path");
LOGGER.debug("editFile path: {}"+ path);
-
+
String domain = path.substring(1, path.lastIndexOf("/"));
domain = domain.replace("/", ".");
-
+
path = path.substring(1);
path = path.replace("/", ".");
String dbCheckName = path;
@@ -1415,14 +1406,14 @@ public class PolicyManagerServlet extends HttpServlet {
}else if(dbCheckName.contains("Decision_")){
dbCheckName = dbCheckName.replace(".Decision_", ":Decision_");
}
-
+
String[] split = dbCheckName.split(":");
String query = "FROM PolicyEntity where policyName = :split_1 and scope = :split_0";
SimpleBindings peParams = new SimpleBindings();
peParams.put("split_1", split[1]);
peParams.put("split_0", split[0]);
List<Object> queryData = null;
- if(jUnit){
+ if(PolicyController.isjUnit()){
queryData = controller.getDataByQuery(query, null);
}else{
queryData = controller.getDataByQuery(query, peParams);
@@ -1432,7 +1423,7 @@ public class PolicyManagerServlet extends HttpServlet {
Object policy = XACMLPolicyScanner.readPolicy(stream);
- PolicyRestAdapter policyAdapter = new PolicyRestAdapter();
+ PolicyRestAdapter policyAdapter = new PolicyRestAdapter();
policyAdapter.setData(policy);
if("viewPolicy".equalsIgnoreCase(mode)){
@@ -1451,7 +1442,7 @@ public class PolicyManagerServlet extends HttpServlet {
PolicyAdapter setpolicyAdapter = PolicyAdapter.getInstance();
setpolicyAdapter.configure(policyAdapter,entity);
-
+
policyAdapter.setParentPath(null);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(policyAdapter);
@@ -1478,7 +1469,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
}else{
name = params.getString("name");
- }
+ }
}catch(Exception e){
name = params.getString("name");
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Exception Occured While Adding Scope"+e);
@@ -1493,7 +1484,7 @@ public class PolicyManagerServlet extends HttpServlet {
String validate = PolicyUtils.policySpecialCharValidator(validateName);
if(!validate.contains("success")){
return error(validate);
- }
+ }
}
LOGGER.debug("addFolder path: {} name: {}" + path +name);
if(!name.equals("")){
@@ -1508,7 +1499,7 @@ public class PolicyManagerServlet extends HttpServlet {
newScope.setScopeName(name);
newScope.setUserCreatedBy(userInfo);
newScope.setUserModifiedBy(userInfo);
- controller.saveData(newScope);
+ controller.saveData(newScope);
}else{
return error("Scope Already Exists");
}
@@ -1543,7 +1534,7 @@ public class PolicyManagerServlet extends HttpServlet {
throw new ServletException(e);
}
}
-
+
private PolicyController getPolicyControllerInstance(){
return policyController != null ? getPolicyController() : new PolicyController();
}
@@ -1555,4 +1546,4 @@ public class PolicyManagerServlet extends HttpServlet {
public static void setTestUserId(String testUserId) {
PolicyManagerServlet.testUserId = testUserId;
}
-} \ No newline at end of file
+}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java
index a4e476200..2326a9fb7 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java
@@ -122,7 +122,12 @@ public class PolicyNotificationMail{
boolean sendFlag = false;
SimpleBindings params = new SimpleBindings();
params.put("policyFileName", policyFileName);
- List<Object> watchList = policyNotificationDao.getDataByQuery(query, params);
+ List<Object> watchList = null;
+ if(PolicyController.isjUnit()){
+ watchList = policyNotificationDao.getDataByQuery(query, null);
+ }else{
+ watchList = policyNotificationDao.getDataByQuery(query, params);
+ }
if(watchList != null && !watchList.isEmpty()){
for(Object watch : watchList){
WatchPolicyNotificationTable list = (WatchPolicyNotificationTable) watch;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
index 7234a3b6a..08f80304c 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
@@ -82,8 +82,24 @@ public class PolicyRestController extends RestrictedBaseController{
private static final String modal = "model";
private static final String importDictionary = "import_dictionary";
+ private static CommonClassDao commonClassDao;
+
+ public static CommonClassDao getCommonClassDao() {
+ return commonClassDao;
+ }
+
+ public static void setCommonClassDao(CommonClassDao commonClassDao) {
+ PolicyRestController.commonClassDao = commonClassDao;
+ }
+
@Autowired
- CommonClassDao commonClassDao;
+ private PolicyRestController(CommonClassDao commonClassDao){
+ PolicyRestController.commonClassDao = commonClassDao;
+ }
+
+ public PolicyRestController(){
+ //default constructor
+ }
@RequestMapping(value={"/policycreation/save_policy"}, method={RequestMethod.POST})
public void policyCreationController(HttpServletRequest request, HttpServletResponse response) {
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java
index a0f1ba86d..7c60ecfdf 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java
@@ -202,7 +202,7 @@ class HtmlProcessor extends SimpleCallback {
combiningAlgo2human.put("only-one-applicable", "to honour the result of the first successfully evaluated $placeholder$ in order");
}
- private Map<String, AttributeIdentifiers> attributeIdentifiersMap = new HashMap<String, AttributeIdentifiers>();
+ private Map<String, AttributeIdentifiers> attributeIdentifiersMap = new HashMap<>();
private final StringWriter stringWriter = new StringWriter();
private final PrintWriter htmlOut = new PrintWriter(stringWriter);
@@ -357,7 +357,7 @@ class HtmlProcessor extends SimpleCallback {
else
policySet(policySet, "li");
- if (policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0)
+ if (!policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty())
htmlOut.println("<ol>");
return super.onPreVisitPolicySet(parent, policySet);
@@ -377,7 +377,7 @@ class HtmlProcessor extends SimpleCallback {
LOGGER.trace("PolicySet: " + policySet.getPolicySetId() +
" Description: " + policySet.getDescription());
- if (policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0)
+ if (!policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty())
htmlOut.println("</ol>");
htmlOut.println("<p></p>");
@@ -421,7 +421,7 @@ class HtmlProcessor extends SimpleCallback {
}
if (policySet.getPolicySetOrPolicyOrPolicySetIdReference() != null &&
- policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0) {
+ !policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty()) {
String algoDesc = combiningAlgo2human.get(combiningAlgorithm);
if (algoDesc != null) {
algoDesc = algoDesc.replace("$placeholder$", "policy") + " (" + "<i>" + combiningAlgorithm + "</i>)";
@@ -449,7 +449,7 @@ class HtmlProcessor extends SimpleCallback {
policy(policy);
- if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0)
+ if (!policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty())
htmlOut.println("<ol type=\"i\">");
return super.onPreVisitPolicy(parent, policy);
@@ -464,7 +464,7 @@ class HtmlProcessor extends SimpleCallback {
LOGGER.trace("PolicySet: " + policy.getPolicyId() +
"Parent PolicySet: " + parent.getPolicySetId() + " Version: " + parent.getVersion());
- if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0)
+ if (!policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty())
htmlOut.println("</ol>");
htmlOut.println("<p></p>");
@@ -506,7 +506,7 @@ class HtmlProcessor extends SimpleCallback {
}
if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition() != null &&
- policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0) {
+ !policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty()) {
String algoDesc = combiningAlgo2human.get(combiningAlgorithm);
if (algoDesc != null) {
algoDesc = algoDesc.replace("$placeholder$", "rule") + " (<i>" + combiningAlgorithm + "</i>)";
@@ -710,7 +710,7 @@ class HtmlProcessor extends SimpleCallback {
//
StdAttribute attribute = null;
AttributeValueType value = match.getAttributeValue();
- String attributeDataType = null;
+ String attributeDataType;
if (match.getAttributeDesignator() != null && value != null) {
AttributeDesignatorType designator = match.getAttributeDesignator();
attribute = new StdAttribute(new IdentifierImpl(designator.getCategory()),
@@ -822,11 +822,12 @@ class HtmlProcessor extends SimpleCallback {
}
private String removePrimitives(String in) {
- in = in.replace("string-", "");
- in = in.replace("integer-", "");
- in = in.replace("double-", "");
- in = in.replace("boolean-", "");
- return in;
+ String newIn = in;
+ newIn = newIn.replace("string-", "");
+ newIn = newIn.replace("integer-", "");
+ newIn = newIn.replace("double-", "");
+ newIn = newIn.replace("boolean-", "");
+ return newIn;
}
private String stringifyCondition(ConditionType condition) {
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java
index 353e08a44..32f40b9e7 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java
@@ -64,4 +64,6 @@ public class HibernateSession{
logSessionFactory = logSessionFactory1;
}
+ private HibernateSession(){
+ }
}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java
index fc7cb60e5..4dc45425a 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java
@@ -173,7 +173,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
if (flag) {
params.append(line);
}
- if (line.contains("declare Params")) {
+ if (line.contains("declare PapParams")) {
params.append(line);
flag = true;
}
@@ -181,7 +181,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
break;
}
}
- params = new StringBuilder(params.toString().replace("declare Params", "").replace("end", "").replaceAll("\\s+", ""));
+ params = new StringBuilder(params.toString().replace("declare PapParams", "").replace("end", "").replaceAll("\\s+", ""));
String[] components = params.toString().split(":");
String caption = "";
for (int i = 0; i < components.length; i++) {
@@ -400,7 +400,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
if (flag) {
params.append(line);
}
- if (line.contains("rule") && line.contains(".Params\"")) {
+ if (line.contains("rule") && line.contains(".PapParams\"")) {
params.append(line);
flag = true;
}
@@ -408,8 +408,8 @@ public class CreateBRMSParamController extends RestrictedBaseController {
break;
}
}
- params = new StringBuilder(params.substring(params.indexOf(".Params\"")+ 8));
- params = new StringBuilder(params.toString().replaceAll("\\s+", "").replace("salience1000whenthenParamsparams=newParams();","")
+ params = new StringBuilder(params.substring(params.indexOf(".PapParams\"")+ 11));
+ params = new StringBuilder(params.toString().replaceAll("\\s+", "").replace("salience1000whenthenPapParamsparams=newPapParams();","")
.replace("insert(params);end", "")
.replace("params.set", ""));
String[] components = params.toString().split("\\);");
@@ -462,7 +462,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
brmsTemplateVlaue + policyData.getRuleName() + "%$> \n */ \n";
body = body + findRule((String) policyData.getRuleName()) + "\n";
StringBuilder generatedRule = new StringBuilder();
- generatedRule.append("rule \""+ policyData.getDomainDir().replace("\\", ".") +".Config_BRMS_Param_" + policyData.getPolicyName()+".Params\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tParams params = new Params();");
+ generatedRule.append("rule \""+ policyData.getDomainDir().replace("\\", ".") +".Config_BRMS_Param_" + policyData.getPolicyName()+".PapParams\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tPapParams params = new PapParams();");
if(policyData.getRuleData().size() > 0){
for(Object keyValue: policyData.getRuleData().keySet()){
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java
index f10041e38..392adf039 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java
@@ -98,24 +98,24 @@ public class CreateClosedLoopPMController{
String attributeId = designator.getAttributeId();
// First match in the target is OnapName, so set that value.
- if (attributeId.equals("ONAPName")) {
+ if ("ONAPName".equals(attributeId)) {
policyAdapter.setOnapName(value);
}
- if (attributeId.equals("RiskType")){
+ if ("RiskType".equals(attributeId)){
policyAdapter.setRiskType(value);
}
- if (attributeId.equals("RiskLevel")){
+ if ("RiskLevel".equals(attributeId)){
policyAdapter.setRiskLevel(value);
}
- if (attributeId.equals("guard")){
+ if ("guard".equals(attributeId)){
policyAdapter.setGuard(value);
}
- if (attributeId.equals("TTLDate") && !value.contains("NA")){
+ if ("TTLDate".equals(attributeId) && !value.contains("NA")){
PolicyController controller = new PolicyController();
String newDate = controller.convertDate(value);
policyAdapter.setTtlDate(newDate);
}
- if (attributeId.equals("ServiceType")){
+ if ("ServiceType".equals(attributeId)){
LinkedHashMap<String, String> serviceTypePolicyName1 = new LinkedHashMap<>();
String key = "serviceTypePolicyName";
serviceTypePolicyName1.put(key, value);
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
index a1b3519ad..ff5ccffb0 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
@@ -1540,6 +1540,14 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
@RequestMapping(value={"/ms_dictionary/set_MSModelData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
public void SetMSModelData(HttpServletRequest request, HttpServletResponse response) throws IOException, FileUploadException{
+ modelList = new ArrayList<>();
+ dirDependencyList = new ArrayList<>();
+ classMap = new HashMap<>();
+ retmap = new HashMap<>();
+ uniqueKeys= new HashSet<>();
+ uniqueDataKeys= new HashSet<>();
+ dataListBuffer=new StringBuilder();
+ dataConstraints= new ArrayList <>();
List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
boolean zip = false;
boolean yml= false;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
index ed0bf4caf..9832f5803 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
@@ -90,6 +90,14 @@ public class CreateFirewallController extends RestrictedBaseController {
private static CommonClassDao commonClassDao;
+ public static CommonClassDao getCommonClassDao() {
+ return commonClassDao;
+ }
+
+ public static void setCommonClassDao(CommonClassDao commonClassDao) {
+ CreateFirewallController.commonClassDao = commonClassDao;
+ }
+
private List<String> tagCollectorList;
private String jsonBody;
List<String> expandablePrefixIPList = new ArrayList<>();
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java
index 625b2bdd8..71d0b3d03 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java
@@ -60,7 +60,7 @@ public class CreatePolicyController extends RestrictedBaseController{
policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName());
policyAdapter.setConfigType(entity.getConfigurationData().getConfigType());
policyAdapter.setConfigBodyData(entity.getConfigurationData().getConfigBody());
- String policyNameValue = policyAdapter.getPolicyName().substring(policyAdapter.getPolicyName().indexOf(' ') + 1);
+ String policyNameValue = policyAdapter.getPolicyName().substring(policyAdapter.getPolicyName().indexOf('_') + 1);
policyAdapter.setPolicyName(policyNameValue);
String description = "";
try{
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java
index 21f3793f1..f987f906d 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java
@@ -64,13 +64,13 @@ public class PolicyNotificationController extends RestrictedBaseController {
String responseValue = "";
try {
String userId = UserUtils.getUserSession(request).getOrgUserId();
- System.out.println(userId);
+ logger.info("userid info: " + userId);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
String name = root.get("watchData").get("name").toString();
JsonNode pathList = root.get("watchData").get("path");
- String finalName = "";
+ String finalName;
if(pathList.isArray()){
ArrayNode arrayNode = (ArrayNode) pathList;
for (int i = 0; i < arrayNode.size(); i++) {
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java
index 946f90ac7..c8ed3a096 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java
@@ -268,7 +268,12 @@ public class CommonClassDaoImpl implements CommonClassDao{
try {
Query hbquery = session.createQuery(query);
for (Map.Entry<String, Object> paramPair : params.entrySet()) {
- hbquery.setParameter(paramPair.getKey(), paramPair.getValue());
+ if(paramPair.getValue() instanceof java.lang.Long){
+ hbquery.setLong(paramPair.getKey(), (long) paramPair.getValue());
+ }
+ else{
+ hbquery.setParameter(paramPair.getKey(), paramPair.getValue());
+ }
}
data = hbquery.list();
tx.commit();
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java
index 49024ba0d..c96da506f 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java
@@ -43,16 +43,6 @@ import org.onap.policy.common.logging.flexlogger.Logger;
public class SystemLogDbDaoImpl implements SystemLogDbDao {
private static final Logger logger = FlexLogger.getLogger(SystemLogDbDaoImpl.class);
- private static boolean jUnit = false;
-
- public static boolean isjUnit() {
- return jUnit;
- }
-
- public static void setjUnit(boolean jUnit) {
- SystemLogDbDaoImpl.jUnit = jUnit;
- }
-
@SuppressWarnings("unchecked")
@Override
public List<SystemLogDB> getLoggingData() {
@@ -61,7 +51,7 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao {
List<SystemLogDB> system = null;
try {
String sqlWhere = null;
- if(jUnit){
+ if(PolicyController.isjUnit()){
sqlWhere = "";
}else{
sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) ORDER BY date DESC limit "+PolicyController.getLogTableLimit()+"";
@@ -90,7 +80,7 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao {
List<SystemLogDB> system = null;
try {
String sqlWhere = null;
- if(jUnit){
+ if(PolicyController.isjUnit()){
sqlWhere = "";
}else{
sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) and logtype = 'error' ORDER BY date DESC limit "+PolicyController.getSystemAlertTableLimit()+"";
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java
index 04ec3e868..3b3f11957 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java
@@ -365,7 +365,7 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po
@Override
public Object firstItemId() {
synchronized (this.groups) {
- if (this.groups.size() > 0) {
+ if (!this.groups.isEmpty()) {
return this.groups.get(0);
}
}
@@ -375,7 +375,7 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po
@Override
public Object lastItemId() {
synchronized (this.groups) {
- if (this.groups.size() > 0) {
+ if (!this.groups.isEmpty()) {
return this.groups.get(this.groups.size() - 1);
}
}
@@ -385,8 +385,8 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po
@Override
public boolean isFirstId(Object itemId) {
synchronized (this.groups) {
- if (this.groups.size() > 0) {
- return (this.groups.get(0).equals(itemId));
+ if (!this.groups.isEmpty()) {
+ return this.groups.get(0).equals(itemId);
}
}
return false;
@@ -395,8 +395,8 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po
@Override
public boolean isLastId(Object itemId) {
synchronized (this.groups) {
- if (this.groups.size() > 0) {
- return (this.groups.get(this.groups.size() - 1).equals(itemId));
+ if (!this.groups.isEmpty()) {
+ return this.groups.get(this.groups.size() - 1).equals(itemId);
}
}
return false;
@@ -444,7 +444,7 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po
//
// You cannot remove the default group
//
- if (((OnapPDPGroup) itemId).getId().equals("Default")) {
+ if ("Default".equals(((OnapPDPGroup) itemId).getId())) {
throw new UnsupportedOperationException("You can't remove the Default Group.");
}
//
diff --git a/POLICY-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties b/POLICY-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties
index 43b2de708..84c5dc5dd 100644
--- a/POLICY-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties
+++ b/POLICY-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties
@@ -23,8 +23,8 @@ decryption_key = AGLDdG4D04BKm2IxIWEr8o==
# The following properties MAY require changes by partner applications.
##########################################################################
#Mysql
-db.driver = com.mysql.jdbc.Driver
-db.connectionURL = jdbc:mysql://localhost:3306/onapsdk1707
+db.driver = org.mariadb.jdbc.Driver
+db.connectionURL = jdbc:mariadb://localhost:3306/onapsdk1707
db.userName = root
db.password =
db.hib.dialect = org.hibernate.dialect.MySQLDialect
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html
index 98570f3dd..2271992b0 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html
@@ -45,7 +45,7 @@
</div>
<div class="form-group row">
<div class="form-group col-sm-6" ng-class="{ 'has-error' : formdata.varbindOID.$invalid && !formdata.varbindOID.$pristine }">
- <label>Varbind OID:</label><br>
+ <label>Varbind OID:<sup><b>*</b></sup></label><br>
<input type="text" ng-model="editCLVarbind.varbindOID" class="form-control" name= "varbindOID" required/>
<p ng-show="formdata.varbindOID.$invalid && !formdata.varbindOID.$pristine" class="help-block">Varbind OID is required.</p>
</div>
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html
index fe7ad5811..89e3aff1e 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html
@@ -34,7 +34,7 @@
<div class="form-group col-sm-6" ng-class="{ 'has-error' : formdata.name.$invalid && !formdata.name.$pristine }">
<label>UUID:<sup><b>*</b></sup></label><br>
<input type="text" ng-model="editDCAEuuid.name" class="form-control" name= "name" required/>
- <p ng-show="formdata.name.$invalid && !formdata.name.$pristine" class="help-block">Onap Name is required.</p>
+ <p ng-show="formdata.name.$invalid && !formdata.name.$pristine" class="help-block">UUID field is required.</p>
</div>
</div>
<div class="form-group row">
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js
index 08d4662da..90b77e45d 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js
@@ -140,7 +140,7 @@ app.controller('vnfTypeDictGridController', function ($scope, PolicyAppService,
$scope.deleteVnfType = function(data) {
var uuu = "searchDictionary";
- var postData={data: data, type: "attribute"};
+ var postData={data: data, type: "clVnf"};
var searchString = "\n";
$.ajax({
type : 'POST',
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html
index 9721e1c2e..f5a5e8678 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html
@@ -220,10 +220,6 @@
<link rel="stylesheet" href="app/fusion/external/ds2/css/digital-ng-library/ionicons.css">
<link rel="stylesheet" href="app/fusion/styles/ecomp.css">
<link rel="stylesheet" href="app/fusion/external/angular-gridster/dist/angular-gridster.min.css">
- <script src= "app/policyApp/CSS/UIGrid/ui-grid.eot"></script>
- <link rel="stylesheet" href="app/policyApp/CSS/UIGrid/ui-grid.svg">
- <script src= "app/policyApp/CSS/UIGrid/ui-grid.woff"></script>
- <script src= "app/policyApp/CSS/UIGrid/ui-grid.ttf"></script>
</head>
<body class="appBody" ng-app="abs" style="padding-top: 0px;">
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js
index 2892936f8..a9097d559 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js
@@ -24,6 +24,12 @@ app.controller('actionPolicyController', ['$scope', 'PolicyAppService', 'policyN
$scope.savebutton = true;
$scope.refreshCheck = false;
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Action"
+ }
+ };
+
$scope.refresh = function(){
if($scope.refreshCheck){
$scope.policyNavigator.refresh();
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js
index 02c31486b..22511c5a7 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js
@@ -24,6 +24,13 @@ angular.module('abs').controller('brmsParamPolicyController', ['$scope', '$windo
$scope.savebutton = true;
$scope.refreshCheck = false;
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "BRMS_Param"
+ }
+ };
+
$scope.refresh = function(){
if($scope.refreshCheck){
$scope.policyNavigator.refresh();
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js
index 8f27f2a09..6061b1ef8 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js
@@ -24,6 +24,13 @@ angular.module('abs').controller('brmsRawPolicyController', ['$scope', '$window'
$scope.savebutton = true;
$scope.refreshCheck = false;
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "BRMS_Raw"
+ }
+ };
+
$scope.refresh = function(){
if($scope.refreshCheck){
$scope.policyNavigator.refresh();
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js
index 891e4098b..7425c92d4 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js
@@ -25,6 +25,13 @@ app.controller('baseConfigController', ['$scope', 'PolicyAppService', 'policyNav
$scope.savebutton = true;
$scope.refreshCheck = false;
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "Base"
+ }
+ };
+
$scope.refresh = function(){
if($scope.refreshCheck){
$scope.policyNavigator.refresh();
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js
index b3f702f6a..1015e7aac 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js
@@ -24,6 +24,13 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol
$scope.savebutton = true;
$scope.refreshCheck = false;
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "ClosedLoop_Fault"
+ }
+ };
+
$scope.refresh = function(){
if($scope.refreshCheck){
$scope.policyNavigator.refresh();
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js
index caec13feb..a67266074 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js
@@ -23,7 +23,14 @@ angular.module("abs").controller('clPMController', ['$scope', '$window', '$timeo
$scope.policyNavigator;
$scope.savebutton = true;
$scope.refreshCheck = false;
-
+
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "ClosedLoop_PM"
+ }
+ };
+
$scope.refresh = function(){
if($scope.refreshCheck){
$scope.policyNavigator.refresh();
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
index fb10a2cc9..5b2bdb2b2 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
@@ -24,6 +24,12 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
$scope.savebutton = true;
$scope.refreshCheck = false;
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Decision"
+ }
+ };
+
$scope.refresh = function(){
if($scope.refreshCheck){
$scope.policyNavigator.refresh();
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js
index 5988ef302..1051ecd9a 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js
@@ -24,6 +24,13 @@ angular.module('abs').controller('fwPolicyController', ['$scope', '$window', 'Po
$scope.savebutton = true;
$scope.refreshCheck = false;
+ if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
+ $scope.temp.policy = {
+ policyType : "Config",
+ configPolicyType : "Firewall Config"
+ }
+ };
+
$scope.refresh = function(){
if($scope.refreshCheck){
$scope.policyNavigator.refresh();
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js
index b96a4f732..0e095a841 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js
@@ -26,7 +26,7 @@ angular.module('abs').factory('item', ['$http', '$q', 'policyManagerConfig', fun
path: path || [],
type: model && model.type || 'file',
size: model && parseInt(model.size || 0),
- date: parseMySQLDate(model && model.date),
+ date: model && model.date,
version: model && model.version || '',
createdBy: model && model.createdBy || '',
modifiedBy: model && model.modifiedBy || '',
@@ -139,6 +139,11 @@ angular.module('abs').factory('item', ['$http', '$q', 'policyManagerConfig', fun
self.inprocess = true;
self.error = '';
$http.post(policyManagerConfig.renameUrl, data).success(function(data) {
+ if(data.result.error != undefined){
+ var value = data.result.error;
+ value = value.replace("rename" , "move");
+ data.result.error = value;
+ }
self.deferredHandler(data, deferred);
}).error(function(data) {
self.deferredHandler(data, deferred, 'Error Occured While Moving');
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html
index f7a6d2442..77006002c 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html
@@ -1,4 +1,4 @@
-<div class="modal animated fadeIn" id="delete" data-toggle="modal" data-backdrop="static" data-keyboard="false">
+<div class="modal" id="delete" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form ng-submit="remove(temp)">
@@ -21,7 +21,7 @@
</div>
</div>
-<div class="modal animated fadeIn" id="deletePolicy" data-toggle="modal" data-backdrop="static" data-keyboard="false">
+<div class="modal" id="deletePolicy" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form ng-submit="removePolicy(temp)">
@@ -50,7 +50,7 @@
</div>
</div>
-<div class="modal animated fadeIn" id="rename" data-toggle="modal" data-backdrop="static" data-keyboard="false">
+<div class="modal" id="rename" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form ng-submit="rename(temp)">
@@ -75,7 +75,7 @@
</div>
</div>
-<div class="modal animated fadeIn" id="searchWindow" data-toggle="modal" data-backdrop="static" data-keyboard="false">
+<div class="modal" id="searchWindow" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form>
@@ -96,7 +96,7 @@
</div>
</div>
-<div class="modal animated fadeIn" id="move" data-toggle="modal" data-backdrop="static" data-keyboard="false">
+<div class="modal" id="move" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form ng-submit="move(temp)">
@@ -119,7 +119,7 @@
</div>
</div>
-<div class="modal animated fadeIn" id="switchVersion" data-toggle="modal" data-backdrop="static" data-keyboard="false">
+<div class="modal" id="switchVersion" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form ng-submit="switchVersion(temp)">
@@ -147,7 +147,7 @@
</div>
</div>
-<div class="modal animated fadeIn" id="copy" data-toggle="modal" data-backdrop="static" data-keyboard="false">
+<div class="modal" id="copy" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form ng-submit="copy(temp)">
@@ -160,9 +160,6 @@
<div class="modal-body">
<label class="radio">Enter new Policy Name to Clone <b>{{temp.model.name}}</b></label>
<input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus">
-
- <div ng-include data-src="'path-selector'" class="clearfix"></div>
- <div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
@@ -197,7 +194,7 @@
</div>
</div>
-<div class="modal animated fadeIn" id="addSubScope" data-toggle="modal" data-backdrop="static" data-keyboard="false">
+<div class="modal" id="addSubScope" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form ng-submit="subScopeFolder(temp)">
@@ -221,7 +218,7 @@
</div>
</div>
-<div class="modal animated fadeIn" id="uploadfile" data-toggle="modal" data-backdrop="static" data-keyboard="false">
+<div class="modal" id="uploadfile" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog">
<div class="modal-content">
<form ng-submit="uploadFiles()">
@@ -250,7 +247,7 @@
</div>
</div>
-<div class="modal animated fadeIn" id="selector" ng-controller="PolicyManagerModalCtrl">
+<div class="modal" id="selector" ng-controller="PolicyManagerModalCtrl">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/CheckPDPTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/CheckPDPTest.java
new file mode 100644
index 000000000..47358a8f2
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/CheckPDPTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.admin;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+
+import org.junit.Test;
+
+public class CheckPDPTest {
+
+ @Test
+ public final void testCheckPDP() {
+ try {
+ System.setProperty("xacml.rest.pdp.idfile", new File(".").getCanonicalPath() + File.separator + "src"+ File.separator + "test" + File.separator + "resources" + File.separator + "test.properties");
+ CheckPDP.validateID("http://localhost:8082/pdp/");
+ assertTrue(CheckPDP.getPdpMap().containsKey("http://localhost:8082/pdp/"));
+ assertTrue(CheckPDP.getEncoding("http://localhost:8082/pdp/").equals("dGVzdHBkcDphbHBoYTQ1Ng=="));
+ } catch (Exception e) {
+ fail("Error occured in CheckPDP test");
+ }
+ }
+
+}
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java
index 970b67878..22cc82a23 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java
@@ -64,6 +64,7 @@ public class PolicyManagerServletTest extends Mockito{
@Before
public void setUp() throws Exception{
logger.info("setUp: Entering");
+ PolicyController.setjUnit(true);
UserInfo userinfo = new UserInfo();
userinfo.setUserLoginId("Test");
userinfo.setUserName("Test");
@@ -146,7 +147,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
BufferedReader reader = new BufferedReader(new StringReader("{params: { mode: 'DESCRIBEPOLICYFILE', path: 'com.Config_SampleTest1206.1.xml'}}"));
try {
when(request.getReader()).thenReturn(reader);
@@ -168,7 +168,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'LIST', path: '/', onlyFolders: false}}");
list.add("{params: { mode: 'LIST', path: '/com', onlyFolders: false}}");
@@ -197,7 +196,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'EDITFILE', path: '/com/Config_SampleTest1206.1.xml', onlyFolders: false}}");
for(int i =0; i < list.size(); i++){
@@ -244,7 +242,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'EDITFILE', path: '/com/Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml', onlyFolders: false}}");
for(int i =0; i < list.size(); i++){
@@ -291,7 +288,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'EDITFILE', path: '/com/Config_BRMS_Raw_TestBRMSRawPolicy.1.xml', onlyFolders: false}}");
for(int i =0; i < list.size(); i++){
@@ -338,7 +334,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'EDITFILE', path: '/com/Config_Fault_TestClosedLoopPolicy.1.xml', onlyFolders: false}}");
for(int i =0; i < list.size(); i++){
@@ -385,7 +380,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'EDITFILE', path: '/com/Config_PM_TestClosedLoopPMPolicy.1.xml', onlyFolders: false}}");
for(int i =0; i < list.size(); i++){
@@ -439,7 +433,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'EDITFILE', path: '/com/Config_MS_vFirewall.1.xml', onlyFolders: false}}");
for(int i =0; i < list.size(); i++){
@@ -487,7 +480,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'EDITFILE', path: '/com/Config_FW_TestFireWallPolicy.1.xml', onlyFolders: false}}");
for(int i =0; i < list.size(); i++){
@@ -532,7 +524,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'EDITFILE', path: '/com/Action_TestActionPolicy.1.xml', onlyFolders: false}}");
for(int i =0; i < list.size(); i++){
@@ -571,7 +562,6 @@ public class PolicyManagerServletTest extends Mockito{
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
PolicyController controller = mock(PolicyController.class);
- PolicyManagerServlet.setjUnit(true);
List<String> list = new ArrayList<>();
list.add("{params: { mode: 'EDITFILE', path: '/com/Decision_TestDecisionPolicyWithRuleAlgorithms.1.xml', onlyFolders: false}}");
for(int i =0; i < list.size(); i++){
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java
new file mode 100644
index 000000000..2c56a8b7f
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.admin;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import static org.mockito.Mockito.when;
+import org.onap.policy.controller.PolicyController;
+import org.onap.policy.rest.dao.CommonClassDao;
+import org.onap.policy.rest.jpa.PolicyVersion;
+import org.onap.policy.rest.jpa.WatchPolicyNotificationTable;
+
+public class PolicyNotificationMailTest {
+
+ private PolicyVersion version;
+ private String policyName = "com/Config_Test";
+ private CommonClassDao commonClassDao;
+ private List<Object> data = null;
+
+ @Before
+ public void setUp() throws Exception {
+ PolicyController.setjUnit(true);
+ PolicyController.setSmtpApplicationName("Test");
+ PolicyController.setSmtpEmailExtension("test.com");
+ PolicyController.setSmtpHost("test");
+ PolicyController.setSmtpPort("23");
+ PolicyController.setSmtpPassword("test");
+ PolicyController.setSmtpUsername("test");
+
+ version = new PolicyVersion();
+ version.setPolicyName("com/Config_Test");
+ version.setModifiedBy("xyz");
+
+ WatchPolicyNotificationTable watch = new WatchPolicyNotificationTable();
+ watch.setPolicyName("com/Config_Test");
+ data = new ArrayList<>();
+ data.add(watch);
+
+ commonClassDao = mock(CommonClassDao.class);
+ PolicyController.setCommonClassDao(commonClassDao);
+ when(commonClassDao.getDataByQuery("from WatchPolicyNotificationTable where policyName like:policyFileName", null)).thenReturn(data);
+ }
+
+ @Test
+ public final void testJavaMailSenderImpl() {
+ PolicyNotificationMail notificationMail = new PolicyNotificationMail();
+ try{
+ assertTrue(notificationMail.javaMailSenderImpl() != null);
+ }catch(Exception e){
+ fail();
+ }
+ }
+
+ @Test
+ public final void testSendMail() {
+ PolicyNotificationMail notificationMail = new PolicyNotificationMail();
+ try{
+ notificationMail.sendMail(version, policyName, "EditPolicy", commonClassDao);
+ notificationMail.sendMail(version, policyName, "Rename", commonClassDao);
+ notificationMail.sendMail(version, policyName, "DeleteAll", commonClassDao);
+ notificationMail.sendMail(version, policyName, "DeleteOne", commonClassDao);
+ notificationMail.sendMail(version, policyName, "DeleteScope", commonClassDao);
+ notificationMail.sendMail(version, policyName, "SwitchVersion", commonClassDao);
+ notificationMail.sendMail(version, policyName, "Move", commonClassDao);
+ }catch(Exception e){
+ fail();
+ }
+ }
+
+}
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java
new file mode 100644
index 000000000..1bda7cd41
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java
@@ -0,0 +1,232 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.admin;
+
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.policy.controller.CreateFirewallController;
+import org.onap.policy.rest.dao.CommonClassDao;
+import org.onap.policy.rest.jpa.ActionList;
+import org.onap.policy.rest.jpa.AddressGroup;
+import org.onap.policy.rest.jpa.FWTagPicker;
+import org.onap.policy.rest.jpa.GroupServiceList;
+import org.onap.policy.rest.jpa.PrefixList;
+import org.onap.policy.rest.jpa.SecurityZone;
+import org.onap.policy.rest.jpa.ServiceList;
+import org.onap.policy.rest.jpa.TermList;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.mock.web.MockHttpServletResponse;
+
+public class PolicyRestControllerTest {
+
+ private String clRequestString;
+ private String fwRequestString;
+ private String fwViewRequestString;
+ private HttpServletRequest request;
+ private MockHttpServletResponse response;
+ private static CommonClassDao commonClassDao;
+ private List<Object> prefixListData;
+ private List<Object> actionListData;
+ private List<Object> serviceListData;
+ private List<Object> addressGroupData;
+ private List<Object> securityZoneData;
+ private List<Object> serviceGroupData;
+ private List<Object> tagListData;
+ private List<Object> termListData;
+
+ @Before
+ public void setUp() throws Exception {
+ commonClassDao = mock(CommonClassDao.class);
+ HttpSession mockSession = mock(HttpSession.class);
+ request = mock(HttpServletRequest.class);
+ response = new MockHttpServletResponse();
+ User user = new User();
+ user.setOrgUserId("Test");
+ Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))).thenReturn(user);
+ Mockito.when(request.getSession(false)).thenReturn(mockSession);
+ clRequestString = "{\"policyData\":{\"error\":\"\",\"inprocess\":false,\"model\":{\"name\":\"com\","
+ + "\"subScopename\":\"\",\"path\":[],\"type\":\"dir\",\"size\":0,\"date\":\"2017-06-01T15:45:36.000Z\","
+ + "\"version\":\"\",\"createdBy\":\"Demo\",\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false},"
+ + "\"tempModel\":{\"name\":\"com\",\"subScopename\":\"\",\"path\":[],\"type\":\"dir\",\"size\":0,\"date\":\"2017-06-01T15:45:36.000Z\","
+ + "\"version\":\"\",\"createdBy\":\"Demo\",\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false},\"$$hashKey\":\"object:1439\","
+ + "\"policy\":{\"policyType\":\"Config\",\"configPolicyType\":\"ClosedLoop_Fault\",\"triggerTrapSignatures\":[1,1,2,3],"
+ + "\"triggerfaultSignatures\":[1,1,2,3],\"traptriggerSignatures\":[{\"id\":\"Trap1\",\"$$hashKey\":\"object:1526\"},"
+ + "{\"id\":\"Trap2\",\"$$hashKey\":\"object:1534\"}],\"connecttriggerSignatures\":[{\"id\":\"C1\",\"$$hashKey\":\"object:1554\","
+ + "\"notBox\":\"NOT\",\"connectTrap1\":\"Trap1\",\"trapCount1\":\"12\",\"operatorBox\":\"AND\",\"connectTrap2\":\"Trap2\","
+ + "\"trapCount2\":\"14\"}],\"faulttriggerSignatures\":[{\"id\":\"Fault1\",\"$$hashKey\":\"object:1566\"},{\"id\":\"Fault2\","
+ + "\"$$hashKey\":\"object:1575\"}],\"connectVerificationSignatures\":[{\"id\":\"C1\",\"$$hashKey\":\"object:1595\","
+ + "\"notBox\":\"NOT\",\"connectTrap1\":\"Fault1\",\"trapCount1\":\"11\",\"operatorBox\":\"AND\",\"connectTrap2\":\"Fault2\","
+ + "\"trapCount2\":\"12\"}],\"jsonBodyData\":{\"trapMaxAge\":\"300\",\"vnfType\":\"Test\",\"closedLoopPolicyStatus\":\"Active\","
+ + "\"vUSP\":true,\"trinity\":true,\"vDNS\":true,\"mcr\":true,\"gamma\":true,\"actions\":\"Test\",\"timeInterval\":\"11\","
+ + "\"timeOutvPRO\":\"11\",\"timeOutRuby\":\"11\",\"retrys\":\"1\",\"agingWindow\":\"12\",\"geoLink\":\"test\","
+ + "\"emailAddress\":\"aa@test.com\",\"pepName\":\"Test\",\"pepAction\":\"test\",\"conditions\":\"SEND\"},"
+ + "\"policyName\":\"SampleTest\",\"policyDescription\":\"SampleTest\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"1\","
+ + "\"guard\":\"True\",\"onapName\":\"SampleDemo\",\"ttlDate\":\"14/09/2017\",\"clearTimeOut\":\"123\",\"trapMaxAge\":\"11\","
+ + "\"verificationclearTimeOut\":\"13\"}},\"trapData\":{\"trap1\":[{\"id\":\"A1\",\"$$hashKey\":\"object:1528\","
+ + "\"notBox\":\"NOT\",\"trigger1\":\"Test\",\"operatorBox\":\"AND\",\"trigger2\":\"Test\"}],\"trap2\":[{\"id\":\"A1\","
+ + "\"$$hashKey\":\"object:1536\",\"notBox\":\"NOT\",\"trigger1\":\"Test\",\"operatorBox\":\"AND\",\"trigger2\":\"Test\"},"
+ + "{\"id\":\"A2\",\"$$hashKey\":\"object:1542\",\"notBox\":\"NOT\",\"trigger1\":\"A1\",\"operatorBox\":\"AND\",\"trigger2\":"
+ + "\"Test\"},{\"id\":\"A3\",\"$$hashKey\":\"object:1548\",\"notBox\":\"NOT\",\"trigger1\":\"A1\",\"operatorBox\":\"OR\","
+ + "\"trigger2\":\"A2\"}]},\"faultData\":{\"trap1\":[{\"id\":\"A1\",\"$$hashKey\":\"object:1568\",\"notBox\":\"NOT\","
+ + "\"trigger1\":\"Test\",\"operatorBox\":\"AND\",\"trigger2\":\"Test\"}],\"trap2\":[{\"id\":\"A1\",\"$$hashKey\":\"object:1577\","
+ + "\"notBox\":\"NOT\",\"trigger1\":\"Test\",\"operatorBox\":\"AND\",\"trigger2\":\"Test\"},{\"id\":\"A2\",\"$$hashKey\":"
+ + "\"object:1583\",\"notBox\":\"NOT\",\"trigger1\":\"Test\",\"operatorBox\":\"OR\",\"trigger2\":\"Test\"},{\"id\":\"A3"
+ + "\",\"$$hashKey\":\"object:1589\",\"notBox\":\"NOT\",\"trigger1\":\"A1\",\"operatorBox\":\"AND\",\"trigger2\":\"A2\"}]}}";
+
+
+ fwRequestString = "{\"policyData\":{\"error\":\"\",\"inprocess\":false,\"model\":{\"name\":\"com\",\"subScopename\":\"\",\"path\":[],"
+ + "\"type\":\"dir\",\"size\":0,\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\",\"modifiedBy\":"
+ + "\"Demo\",\"content\":\"\",\"recursive\":false},\"tempModel\":{\"name\":\"com\",\"subScopename\":\"\",\"path\":[],\"type\":"
+ + "\"dir\",\"size\":0,\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\",\"modifiedBy\":\"Demo\","
+ + "\"content\":\"\",\"recursive\":false},\"$$hashKey\":\"object:260\",\"policy\":{\"policyType\":\"Config\",\"configPolicyType"
+ + "\":\"Firewall Config\",\"attributes\":[{\"id\":\"choice1\",\"$$hashKey\":\"object:338\",\"key\":\"Test\",\"value\":\"Test\"}],"
+ + "\"fwattributes\":[],\"policyName\":\"SampleTest\",\"policyDescription\":\"SampleTest\",\"riskType\":\"SampleRiskType\","
+ + "\"riskLevel\":\"1\",\"guard\":\"True\",\"configName\":\"SampleTest\",\"ttlDate\":\"14/09/2017\",\"securityZone\":\"Test\"}}}";
+
+ fwViewRequestString = "{\"policyData\":{\"policyType\":\"Config\",\"configPolicyType\":\"Firewall Config\",\"attributes\":[{\"id\":"
+ + "\"choice1\",\"$$hashKey\":\"object:338\",\"key\":\"Test\",\"value\":\"Test\"}],\"fwattributes\":[],\"policyName\":"
+ + "\"SampleTest\",\"policyDescription\":\"SampleTest\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"1\",\"guard\":\"True\","
+ + "\"configName\":\"SampleTest\",\"ttlDate\":\"14/09/2017\",\"securityZone\":\"Test\"}}";
+
+
+
+ prefixListData = new ArrayList<>();
+ PrefixList prefixList = new PrefixList();
+ prefixList.setPrefixListName("Test");
+ prefixList.setPrefixListValue("10.10.10.10/12");
+ prefixListData.add(prefixList);
+ when(commonClassDao.getData(PrefixList.class)).thenReturn(prefixListData);
+
+ actionListData = new ArrayList<>();
+ ActionList actionList = new ActionList();
+ actionList.setActionName("Test");
+ actionListData.add(actionList);
+ when(commonClassDao.getData(ActionList.class)).thenReturn(actionListData);
+
+ serviceListData = new ArrayList<>();
+ ServiceList serviceList = new ServiceList();
+ serviceList.setServiceName("Test");
+ serviceList.setServiceType("SERVICE");
+ serviceList.setServiceTransProtocol("Test");
+ serviceList.setServiceAppProtocol("Test");
+ serviceList.setServicePorts("8080");
+ serviceListData.add(serviceList);
+ when(commonClassDao.getData(ServiceList.class)).thenReturn(serviceListData);
+
+ addressGroupData = new ArrayList<>();
+ AddressGroup addressGroup = new AddressGroup();
+ addressGroup.setGroupName("Group_Test");
+ addressGroup.setServiceList("Test");
+ addressGroupData.add(addressGroup);
+ when(commonClassDao.getData(AddressGroup.class)).thenReturn(addressGroupData);
+
+ securityZoneData = new ArrayList<>();
+ SecurityZone securityZone = new SecurityZone();
+ securityZone.setZoneName("Test");
+ securityZone.setZoneValue("Test");
+ securityZoneData.add(securityZone);
+ when(commonClassDao.getData(SecurityZone.class)).thenReturn(securityZoneData);
+
+ serviceGroupData = new ArrayList<>();
+ GroupServiceList serviceGroup = new GroupServiceList();
+ serviceGroup.setGroupName("Group_Test");
+ serviceGroup.setServiceList("Test");
+ serviceGroupData.add(serviceGroup);
+ when(commonClassDao.getData(GroupServiceList.class)).thenReturn(serviceGroupData);
+
+ tagListData = new ArrayList<>();
+ FWTagPicker fwPicker = new FWTagPicker();
+ fwPicker.setTagPickerName("Test");
+ fwPicker.setTagValues("Test:8080");
+ tagListData.add(fwPicker);
+ when(commonClassDao.getData(FWTagPicker.class)).thenReturn(tagListData);
+
+ termListData = new ArrayList<>();
+ TermList termList = new TermList();
+ termList.setTermName("Test");
+ termList.setFromZones("Test");
+ termList.setToZones("Test");
+ termList.setSrcIPList("Test");
+ termList.setDestIPList("Test");
+ termList.setSrcPortList("Test");
+ termList.setDestPortList("Test");
+ termList.setAction("Test");
+ termListData.add(termList);
+ when(commonClassDao.getData(TermList.class)).thenReturn(termListData);
+ when(commonClassDao.getDataById(TermList.class, "termName", "Test")).thenReturn(termListData);
+ }
+
+ @Test
+ public final void testPolicyCreationController() {
+ PolicyRestController controller = new PolicyRestController();
+ BufferedReader reader = new BufferedReader(new StringReader(clRequestString));
+ try {
+ Mockito.when(request.getReader()).thenReturn(reader);
+ controller.policyCreationController(request, response);
+ } catch (IOException e) {
+ fail();
+ }
+ PolicyRestController controller1 = new PolicyRestController();
+ CreateFirewallController.setCommonClassDao(commonClassDao);
+ BufferedReader reader1 = new BufferedReader(new StringReader(fwRequestString));
+ try {
+ Mockito.when(request.getReader()).thenReturn(reader1);
+ controller1.policyCreationController(request, response);
+ } catch (IOException e) {
+ fail();
+ }
+
+ CreateFirewallController fwController = new CreateFirewallController();
+ CreateFirewallController.setCommonClassDao(commonClassDao);
+ BufferedReader reader2 = new BufferedReader(new StringReader(fwViewRequestString));
+ try {
+ Mockito.when(request.getReader()).thenReturn(reader2);
+ fwController.setFWViewRule(request, response);
+ } catch (IOException e) {
+ fail();
+ }
+ }
+
+ @Test
+ public final void testDeleteElasticData() {
+ PolicyRestController controller = new PolicyRestController();
+ try {
+ controller.deleteElasticData("Test");
+ } catch (Exception e) {
+ fail();
+ }
+ }
+
+}
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java
index 4931d20d7..f4acaeb9a 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java
@@ -41,12 +41,12 @@ public class PolicyUserInfoControllerTest {
@Before
public void setUp() throws Exception {
HttpSession mockSession = mock(HttpSession.class);
- request = mock(HttpServletRequest.class);
- response = new MockHttpServletResponse();
- User user = new User();
- user.setOrgUserId("Test");
- Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))).thenReturn(user);
- Mockito.when(request.getSession(false)).thenReturn(mockSession);
+ request = mock(HttpServletRequest.class);
+ response = new MockHttpServletResponse();
+ User user = new User();
+ user.setOrgUserId("Test");
+ Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))).thenReturn(user);
+ Mockito.when(request.getSession(false)).thenReturn(mockSession);
}
@Test
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java
index d4b0c650b..63ca29d90 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java
@@ -20,9 +20,13 @@
package org.onap.policy.daoImp;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
@@ -39,9 +43,9 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.conf.HibernateSession;
import org.onap.policy.controller.PolicyController;
-import org.onap.policy.daoImp.CommonClassDaoImpl;
import org.onap.policy.rest.jpa.OnapName;
import org.onap.policy.rest.jpa.PolicyEntity;
+import org.onap.policy.rest.jpa.PolicyRoles;
import org.onap.policy.rest.jpa.PolicyVersion;
import org.onap.policy.rest.jpa.SystemLogDB;
import org.onap.policy.rest.jpa.UserInfo;
@@ -392,11 +396,49 @@ public class CommonClassDaoImplTest{
fail();
}
}
+
+ @Test
+ public void testCommonClassDaoImplMethods(){
+ try{
+ UserInfo userInfo = new UserInfo();
+ userInfo.setUserLoginId("TestID");
+ userInfo.setUserName("Test");
+ commonClassDao.save(userInfo);
+ List<Object> data = commonClassDao.getDataById(UserInfo.class, "userLoginId:userName", "TestID:Test");
+ assertTrue(data.size() == 1);
+ UserInfo userInfoUpdate = (UserInfo) data.get(0);
+ userInfoUpdate.setUserName("Test1");
+ commonClassDao.update(userInfoUpdate);
+ List<String> data1 = commonClassDao.getDataByColumn(UserInfo.class, "userLoginId");
+ assertTrue(data1.size() == 1);
+ UserInfo data2 = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName", "TestID:Test1");
+ assertTrue("TestID".equals(data2.getUserLoginId()));
+ List<Object> data3 = commonClassDao.checkDuplicateEntry("TestID:Test1", "userLoginId:userName", UserInfo.class);
+ assertTrue(data3.size() == 1);
+ PolicyRoles roles = new PolicyRoles();
+ roles.setRole("admin");
+ roles.setLoginId(userInfo);
+ roles.setScope("test");
+ commonClassDao.save(roles);
+ List<PolicyRoles> roles1 = commonClassDao.getUserRoles();
+ assertTrue(roles1.size() == 1);
+ List<String> multipleData = new ArrayList<>();
+ multipleData.add("TestID:Test1");
+ List<Object> data4 = commonClassDao.getMultipleDataOnAddingConjunction(UserInfo.class, "userLoginId:userName", multipleData);
+ assertTrue(data4.size() == 1);
+ commonClassDao.delete(data2);
+ }catch(Exception e){
+ logger.debug("Exception Occured"+e);
+ fail();
+ }
+ }
+
+
@Test
public final void testGetLoggingData() {
SystemLogDbDaoImpl system = new SystemLogDbDaoImpl();
- SystemLogDbDaoImpl.setjUnit(true);
+ PolicyController.setjUnit(true);
try{
assertTrue(system.getLoggingData() != null);
}catch(Exception e){
@@ -407,7 +449,7 @@ public class CommonClassDaoImplTest{
@Test
public final void testGetSystemAlertData() {
SystemLogDbDaoImpl system = new SystemLogDbDaoImpl();
- SystemLogDbDaoImpl.setjUnit(true);
+ PolicyController.setjUnit(true);
try{
assertTrue(system.getSystemAlertData() != null);
}catch(Exception e){
diff --git a/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt b/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt
index 6ff244ea4..63f93cbe2 100644
--- a/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt
+++ b/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt
@@ -88,7 +88,7 @@ import org.onap.policy.drools.system.PolicyEngine;
//
// These parameters are required to build the runtime policy
//
-declare Params
+declare PapParams
closedLoopControlName : String
actor : String
aaiURL : String
diff --git a/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt b/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt
index 6924fc3a9..a3cdb7851 100644
--- a/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt
+++ b/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt
@@ -1,7 +1,7 @@
package com.sample
import com.sample.DroolsTest.Message;
// Declare the Parameters here.
-declare Params
+declare PapParams
samPoll : int
value : String
end
diff --git a/POLICY-SDK-APP/src/test/resources/test.properties b/POLICY-SDK-APP/src/test/resources/test.properties
new file mode 100644
index 000000000..e882dfd20
--- /dev/null
+++ b/POLICY-SDK-APP/src/test/resources/test.properties
@@ -0,0 +1,21 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP Policy Engine
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+PDP_URL=http://localhost:8082/pdp/, testpdp, alpha456;http://localhost:8081/pdp/, testpdp, alpha456
diff --git a/POLICY-SDK-APP/src/test/resources/xacml.admin.properties b/POLICY-SDK-APP/src/test/resources/xacml.admin.properties
index 0f285b694..333da49a5 100644
--- a/POLICY-SDK-APP/src/test/resources/xacml.admin.properties
+++ b/POLICY-SDK-APP/src/test/resources/xacml.admin.properties
@@ -87,8 +87,8 @@ xacml.log.db.password=policy_user
xacml.att.log.timeframe=150
-javax.persistence.jdbc.driver=com.mysql.jdbc.Driver
-javax.persistence.jdbc.url=jdbc:mysql://localhost:3306/onap_sdk
+javax.persistence.jdbc.driver=org.mariadb.jdbc.Driver
+javax.persistence.jdbc.url=jdbc:mariadb://localhost:3306/onap_sdk
javax.persistence.jdbc.user=policy_user
javax.persistence.jdbc.password=policy_user
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyParameters.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyParameters.java
index 2062638cf..ae9ba8a88 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyParameters.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyParameters.java
@@ -40,6 +40,7 @@ public class PolicyParameters {
private String onapName;
private String configName;
private Map<AttributeType, Map<String,String>> attributes;
+ private Map<String, String> treatments;
private String configBody;
private PolicyType configBodyType;
private String actionPerformer;
@@ -568,6 +569,24 @@ public class PolicyParameters {
this.extendedOption = extendedOption;
}
+ /**
+ * Gets Allowed Treatments Map for Rainy Day Decision Policy
+ *
+ * @return Map of String format for treatments per errorcode
+ */
+ public Map<String, String> getTreatments() {
+ return treatments;
+ }
+
+ /**
+ * Sets Allowed Treatments Map for Rainy Day Decision Policy
+ *
+ * @param treatments Map that contains the treatment per errorcode
+ */
+ public void setTreatments(Map<String, String> treatments) {
+ this.treatments = treatments;
+ }
+
@Override
public String toString() {
return "PolicyParameters [ policyName=" + policyName + ", policyDescription=" + policyDescription + ", onapName="+ onapName
@@ -576,6 +595,6 @@ public class PolicyParameters {
+ ",dynamicRuleAlgorithmField1=" + dynamicRuleAlgorithmField1 + ",dynamicRuleAlgorithmField2=" + dynamicRuleAlgorithmField2
+ ", actionPerformer=" + actionPerformer + ", actionAttribute=" + actionAttribute + ", priority=" + priority
+ ", ruleProvider= " + ruleProvider + ", riskLevel= " + riskLevel + ", riskType= " + riskType + ", extendedOption= " + extendedOption
- + "]";
+ + ", treatments= " + treatments + "]";
}
}
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java
index 94ad67861..2e45549fc 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java
@@ -44,7 +44,11 @@ public enum RuleProvider {
/**
* Indicates Guard BLACKLIST YAML
*/
- GUARD_BL_YAML("GUARD_BL_YAML")
+ GUARD_BL_YAML("GUARD_BL_YAML"),
+ /**
+ * Indicates Guard BLACKLIST YAML
+ */
+ RAINY_DAY("Rainy_Day")
;
private String name;
diff --git a/PolicyEngineClient/testResources/test.drl b/PolicyEngineClient/testResources/test.drl
index 7accc63ae..10cd5b717 100644
--- a/PolicyEngineClient/testResources/test.drl
+++ b/PolicyEngineClient/testResources/test.drl
@@ -83,7 +83,7 @@ import org.onap.policy.drools.system.PolicyEngine;
//
// These parameters are required to build the runtime policy
//
-declare Params
+declare PapParams
closedLoopControlName : String
actor : String
aaiURL : String
diff --git a/PolicyEngineUtils/pom.xml b/PolicyEngineUtils/pom.xml
index effaf5b9d..df846eec7 100644
--- a/PolicyEngineUtils/pom.xml
+++ b/PolicyEngineUtils/pom.xml
@@ -102,6 +102,10 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/api/LoadedPolicy.java b/PolicyEngineUtils/src/main/java/org/onap/policy/api/LoadedPolicy.java
index 25636fb45..862b654b8 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/api/LoadedPolicy.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/api/LoadedPolicy.java
@@ -21,37 +21,39 @@
package org.onap.policy.api;
import java.util.Map;
+
/**
* <code>LoadedPolicy</code> defines the Policy that has been Loaded into the PDP.
- *
- * @version 0.2
+ *
+ * @version 0.2
*/
public interface LoadedPolicy {
- /**
- * Gets the <code>String</code> format of the Policy Name that has been Loaded into the PDP.
- *
- * @return <code>String</code> format of Policy Name
- */
- public String getPolicyName();
-
- /**
- * Gets the <code>String</code> format of the Policy Version that has been Loaded into the PDP.
- *
- * @return <code>String</code> format of the Policy Version.
- */
- public String getVersionNo();
-
- /**
- * Gets the <code>Map</code> of <code>String,String</code> format of the Matches if the policy Loaded is of Config Type.
- *
- * @return the <code>Map</code> of <code>String,String</code> format of the matches in the policy.
- */
- public Map<String, String> getMatches();
-
- /**
- * Gets the <code>UpdateType</code> of {@link org.onap.policy.api.UpdateType} received.
- *
- * @return <code>UpdateType</code> associated with this <code>PDPNotification</code>
- */
- public UpdateType getUpdateType();
+
+ /**
+ * Gets the <code>String</code> format of the Policy Name that has been Loaded into the PDP.
+ *
+ * @return <code>String</code> format of Policy Name
+ */
+ String getPolicyName();
+
+ /**
+ * Gets the <code>String</code> format of the Policy Version that has been Loaded into the PDP.
+ *
+ * @return <code>String</code> format of the Policy Version.
+ */
+ String getVersionNo();
+
+ /**
+ * Gets the <code>Map</code> of <code>String,String</code> format of the Matches if the policy Loaded is of Config Type.
+ *
+ * @return the <code>Map</code> of <code>String,String</code> format of the matches in the policy.
+ */
+ Map<String, String> getMatches();
+
+ /**
+ * Gets the <code>UpdateType</code> of {@link org.onap.policy.api.UpdateType} received.
+ *
+ * @return <code>UpdateType</code> associated with this <code>PDPNotification</code>
+ */
+ UpdateType getUpdateType();
}
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationHandler.java b/PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationHandler.java
index 837eba967..78b79a08f 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationHandler.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationHandler.java
@@ -19,17 +19,20 @@
*/
package org.onap.policy.api;
+
/**
* Defines the methods which need to run when an Event or Notification is received.
- *
+ *
* @version 0.1
*/
@FunctionalInterface
public interface NotificationHandler {
- /**
- * <code>notificationReceived</code> method will be triggered automatically whenever a Notification is received by the PEP.
- *
- * @param notification <code>PDPNotification</code> of {@link org.onap.policy.api.PDPNotification} is the object that has information of the notification.
- */
- public void notificationReceived(PDPNotification notification);
+
+ /**
+ * <code>notificationReceived</code> method will be triggered automatically whenever a Notification is received by the PEP.
+ *
+ * @param notification <code>PDPNotification</code> of {@link org.onap.policy.api.PDPNotification}
+ * is the object that has information of the notification.
+ */
+ void notificationReceived(PDPNotification notification);
}
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationType.java b/PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationType.java
index 730ad022d..8b65a420d 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationType.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/api/NotificationType.java
@@ -23,36 +23,35 @@ package org.onap.policy.api;
/**
* Enumeration of the Update Type that has occurred in the <code>PDPNotification</code> of
* {@link org.onap.policy.api.PDPNotification}
- *
+ *
* @version 0.1
*/
public enum NotificationType {
- /**
- * Indicates that a policy has been updated
- */
- UPDATE("update"),
- /**
- * Indicates that a policy has been removed
- */
- REMOVE("remove"),
- /**
- * Indicates that both update and removal of policy events has occurred.
- */
- BOTH("both")
- ;
-
- private String name;
-
- private NotificationType(String name){
- this.name = name;
- }
-
- /**
- * Returns the <code>String</code> format of the Type for this <code>UpdateType</code>
- * @return the <code>String</code> Type of <code>UpdateType</code>
- */
- @Override
- public String toString(){
- return this.name;
- }
+ /**
+ * Indicates that a policy has been updated
+ */
+ UPDATE("update"),
+ /**
+ * Indicates that a policy has been removed
+ */
+ REMOVE("remove"),
+ /**
+ * Indicates that both update and removal of policy events has occurred.
+ */
+ BOTH("both");
+
+ private String name;
+
+ NotificationType(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the <code>String</code> format of the Type for this <code>UpdateType</code>
+ * @return the <code>String</code> Type of <code>UpdateType</code>
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
}
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/api/PDPNotification.java b/PolicyEngineUtils/src/main/java/org/onap/policy/api/PDPNotification.java
index a88ec06cb..9ab508281 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/api/PDPNotification.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/api/PDPNotification.java
@@ -24,29 +24,29 @@ import java.util.Collection;
/**
* Defines the <code>Notification</code> event sent from PDP to Client PEP.
- *
+ *
* @version 0.2
*/
public interface PDPNotification {
- /**
- * Gets the <code>Collection</code> of {@link org.onap.policy.api.RemovedPolicy} objects received.
- *
- * @return the <code>Collection</code> which consists of <code>RemovedPolicy</code> objects.
- */
- public Collection<RemovedPolicy> getRemovedPolicies();
-
- /**
- * Gets the <code>Collection</code> of {@link org.onap.policy.api.LoadedPolicy} objects receieved.
- *
- * @return the <code>Collection</code> which consists of <code>UpdatedPolicy</code> objects.
- */
- public Collection<LoadedPolicy> getLoadedPolicies();
-
- /**
- * Gets the <code>NotificationType</code> of {@link org.onap.policy.api.NotificationType} received.
- *
- * @return <code>NotificationType</code> associated with this <code>PDPNotification</code>
- */
- public NotificationType getNotificationType();
-
+
+ /**
+ * Gets the <code>Collection</code> of {@link org.onap.policy.api.RemovedPolicy} objects received.
+ *
+ * @return the <code>Collection</code> which consists of <code>RemovedPolicy</code> objects.
+ */
+ Collection<RemovedPolicy> getRemovedPolicies();
+
+ /**
+ * Gets the <code>Collection</code> of {@link org.onap.policy.api.LoadedPolicy} objects receieved.
+ *
+ * @return the <code>Collection</code> which consists of <code>UpdatedPolicy</code> objects.
+ */
+ Collection<LoadedPolicy> getLoadedPolicies();
+
+ /**
+ * Gets the <code>NotificationType</code> of {@link org.onap.policy.api.NotificationType} received.
+ *
+ * @return <code>NotificationType</code> associated with this <code>PDPNotification</code>
+ */
+ NotificationType getNotificationType();
}
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/api/RemovedPolicy.java b/PolicyEngineUtils/src/main/java/org/onap/policy/api/RemovedPolicy.java
index f26c1499a..e8125a1dc 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/api/RemovedPolicy.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/api/RemovedPolicy.java
@@ -19,23 +19,25 @@
*/
package org.onap.policy.api;
+
/**
* <code>RemovedPolicy</code> defines the Policy that has been removed
- *
+ *
* @version 0.1
*/
public interface RemovedPolicy {
- /**
- * Gets the <code>String</code> format of the Policy Name that has been removed.
- *
- * @return <code>String</code> format of Policy Name
- */
- public String getPolicyName();
-
- /**
- * Gets the <code>String</code> format of the Policy Version that has been removed.
- *
- * @return <code>String</code> format of Policy Version
- */
- public String getVersionNo();
+
+ /**
+ * Gets the <code>String</code> format of the Policy Name that has been removed.
+ *
+ * @return <code>String</code> format of Policy Name
+ */
+ String getPolicyName();
+
+ /**
+ * Gets the <code>String</code> format of the Policy Version that has been removed.
+ *
+ * @return <code>String</code> format of Policy Version
+ */
+ String getVersionNo();
}
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/api/UpdateType.java b/PolicyEngineUtils/src/main/java/org/onap/policy/api/UpdateType.java
index deeecddd0..7f401fec0 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/api/UpdateType.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/api/UpdateType.java
@@ -23,32 +23,31 @@ package org.onap.policy.api;
/**
* Enumeration of the Update Type that has occurred in the <code>UpdatedPolicy</code> of
* {@link org.onap.policy.api.LoadedPolicy}
- *
+ *
* @version 0.1
*/
public enum UpdateType {
- /**
- * Indicates that a policy has been updated
- */
- UPDATE("update"),
- /**
- * Indicates that a policy is new
- */
- NEW("new")
- ;
-
- private String name;
-
- private UpdateType(String name){
- this.name = name;
- }
-
- /**
- * Returns the <code>String</code> format of the Type for this <code>UpdateType</code>
- * @return the <code>String</code> Type of <code>UpdateType</code>
- */
- @Override
- public String toString(){
- return this.name;
- }
+ /**
+ * Indicates that a policy has been updated
+ */
+ UPDATE("update"),
+ /**
+ * Indicates that a policy is new
+ */
+ NEW("new");
+
+ private String name;
+
+ UpdateType(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the <code>String</code> format of the Type for this <code>UpdateType</code>
+ * @return the <code>String</code> Type of <code>UpdateType</code>
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
}
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/jpa/BackUpMonitorEntity.java b/PolicyEngineUtils/src/main/java/org/onap/policy/jpa/BackUpMonitorEntity.java
index f2e7f3ff8..1bfffce6c 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/jpa/BackUpMonitorEntity.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/jpa/BackUpMonitorEntity.java
@@ -22,7 +22,6 @@ package org.onap.policy.jpa;
import java.io.Serializable;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -38,80 +37,81 @@ import javax.persistence.TemporalType;
@Entity
-@Table(name="BackUpMonitorEntity")
-@NamedQuery(name="BackUpMonitorEntity.findAll", query= "SELECT b FROM BackUpMonitorEntity b ")
-public class BackUpMonitorEntity implements Serializable{
- private static final long serialVersionUID = -9190606334322230630L;
-
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name="id")
- private int id;
-
- @Column(name="node_name", nullable=false)
- private String resourceNodeName;
-
- @Column(name="resource_name", nullable=false, unique=true)
- private String resourceName;
-
- @Column(name="flag", nullable=false)
- private String flag;
-
- @Lob
- @Column(name="notification_record")
- private String notificationRecord;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="last_seen")
- private Date timeStamp;
-
- @PrePersist
- public void prePersist(){
- this.timeStamp = new Date();
- }
-
- @PreUpdate
- public void preUpdate(){
- this.timeStamp = new Date();
- }
-
- public String getResourceName(){
- return this.resourceName;
- }
-
- public String getResourceNodeName(){
- return this.resourceNodeName;
- }
-
- public String getFlag(){
- return this.flag;
- }
-
- public String getNotificationRecord(){
- return this.notificationRecord;
- }
-
- public Date getTimeStamp(){
- return this.timeStamp;
- }
-
- public void setResourceName(String resourceName){
- this.resourceName = resourceName;
- }
-
- public void setResoruceNodeName(String resourceNodeName){
- this.resourceNodeName = resourceNodeName;
- }
-
- public void setFlag(String flag){
- this.flag = flag;
- }
-
- public void setNotificationRecord(String notificationRecord){
- this.notificationRecord = notificationRecord;
- }
-
- public void setTimeStamp(Date timeStamp){
- this.timeStamp = timeStamp;
- }
+@Table(name = "BackUpMonitorEntity")
+@NamedQuery(name = "BackUpMonitorEntity.findAll", query = "SELECT b FROM BackUpMonitorEntity b ")
+public class BackUpMonitorEntity implements Serializable {
+
+ private static final long serialVersionUID = -9190606334322230630L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "id")
+ private int id;
+
+ @Column(name = "node_name", nullable = false)
+ private String resourceNodeName;
+
+ @Column(name = "resource_name", nullable = false, unique = true)
+ private String resourceName;
+
+ @Column(name = "flag", nullable = false)
+ private String flag;
+
+ @Lob
+ @Column(name = "notification_record")
+ private String notificationRecord;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "last_seen")
+ private Date timeStamp;
+
+ @PrePersist
+ public void prePersist() {
+ this.timeStamp = new Date();
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.timeStamp = new Date();
+ }
+
+ public String getResourceName() {
+ return this.resourceName;
+ }
+
+ public String getResourceNodeName() {
+ return this.resourceNodeName;
+ }
+
+ public String getFlag() {
+ return this.flag;
+ }
+
+ public String getNotificationRecord() {
+ return this.notificationRecord;
+ }
+
+ public Date getTimeStamp() {
+ return this.timeStamp;
+ }
+
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ public void setResourceNodeName(String resourceNodeName) {
+ this.resourceNodeName = resourceNodeName;
+ }
+
+ public void setFlag(String flag) {
+ this.flag = flag;
+ }
+
+ public void setNotificationRecord(String notificationRecord) {
+ this.notificationRecord = notificationRecord;
+ }
+
+ public void setTimeStamp(Date timeStamp) {
+ this.timeStamp = timeStamp;
+ }
}
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/std/NotificationStore.java b/PolicyEngineUtils/src/main/java/org/onap/policy/std/NotificationStore.java
index 259a70d37..8c6c9580d 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/std/NotificationStore.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/std/NotificationStore.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
-
import org.onap.policy.api.LoadedPolicy;
import org.onap.policy.api.NotificationType;
import org.onap.policy.api.PDPNotification;
@@ -38,229 +37,221 @@ import org.onap.policy.api.RemovedPolicy;
*
*/
public class NotificationStore {
- private static StdPDPNotification notificationRecord = new StdPDPNotification();
-
- public static StdPDPNotification getDeltaNotification(StdPDPNotification newNotification){
- StdPDPNotification notificationDelta = new StdPDPNotification();
- ArrayList<StdRemovedPolicy> removedDelta = new ArrayList<>();
- ArrayList<StdLoadedPolicy> updatedDelta = new ArrayList<>();
- Collection<StdLoadedPolicy> newUpdatedPolicies = new ArrayList<>();
- Collection<StdRemovedPolicy> newRemovedPolicies = new ArrayList<>();
- Collection<LoadedPolicy> oldUpdatedLostPolicies = notificationRecord.getLoadedPolicies();
- Collection<RemovedPolicy> oldRemovedPolicies = notificationRecord.getRemovedPolicies();
- Collection<LoadedPolicy> oldUpdatedPolicies = notificationRecord.getLoadedPolicies();
- Boolean update = false;
- Boolean remove = false;
- // if the NotificationRecord is empty
- if(notificationRecord.getRemovedPolicies()==null || notificationRecord.getLoadedPolicies()==null){
- if(newNotification!=null){
- notificationRecord = newNotification;
- }
- return notificationDelta;
- }
- // do the Delta operation.
- if(newNotification!=null){
- // check for old removed policies.
- if(!newNotification.getRemovedPolicies().isEmpty()){
- for(RemovedPolicy newRemovedPolicy: newNotification.getRemovedPolicies()){
- //Look for policy Not in Remove
- Boolean removed = true;
- for(RemovedPolicy oldRemovedPolicy: notificationRecord.getRemovedPolicies()){
- if(newRemovedPolicy.getPolicyName().equals(oldRemovedPolicy.getPolicyName())){
- if(newRemovedPolicy.getVersionNo().equals(oldRemovedPolicy.getVersionNo())){
- removed = false;
- // Don't want a duplicate.
- oldRemovedPolicies.remove(oldRemovedPolicy);
- }
- }
- }
- //We need to change our record we have an Update record of this remove.
- for(LoadedPolicy oldUpdatedPolicy: notificationRecord.getLoadedPolicies()){
- if(newRemovedPolicy.getPolicyName().equals(oldUpdatedPolicy.getPolicyName())){
- if(newRemovedPolicy.getVersionNo().equals(oldUpdatedPolicy.getVersionNo())){
- oldUpdatedPolicies.remove(oldUpdatedPolicy);
- oldUpdatedLostPolicies.remove(oldUpdatedPolicy);
- }
- }
- }
- if(removed){
- remove = true;
- notificationRecord.getRemovedPolicies().add(newRemovedPolicy);
- removedDelta.add((StdRemovedPolicy)newRemovedPolicy);
- }
- // This will be converted to New Later.
- oldRemovedPolicies.add(newRemovedPolicy);
- }
- }
- // Check for old Updated Policies.
- if(!newNotification.getLoadedPolicies().isEmpty()){
- for(LoadedPolicy newUpdatedPolicy: newNotification.getLoadedPolicies()){
- // Look for policies which are not in Update
- Boolean updated = true;
- for(LoadedPolicy oldUpdatedPolicy: notificationRecord.getLoadedPolicies()){
- if(newUpdatedPolicy.getPolicyName().equals(oldUpdatedPolicy.getPolicyName())){
- if(newUpdatedPolicy.getVersionNo().equals(oldUpdatedPolicy.getVersionNo())){
- updated = false;
- // Remove the policy from copy.
- oldUpdatedLostPolicies.remove(oldUpdatedPolicy);
- // Eliminating Duplicate.
- oldUpdatedPolicies.remove(oldUpdatedPolicy);
- }
- }
- }
- // Change the record if the policy has been Removed earlier.
- for(RemovedPolicy oldRemovedPolicy: notificationRecord.getRemovedPolicies()){
- if(oldRemovedPolicy.getPolicyName().equals(newUpdatedPolicy.getPolicyName())){
- if(oldRemovedPolicy.getVersionNo().equals(newUpdatedPolicy.getVersionNo())){
- oldRemovedPolicies.remove(oldRemovedPolicy);
- }
- }
- }
- if(updated){
- update = true;
- updatedDelta.add((StdLoadedPolicy)newUpdatedPolicy);
- }
- // This will be converted to new Later
- oldUpdatedPolicies.add(newUpdatedPolicy);
- }
- // Conversion of Update to Remove if that occurred.
- if(!oldUpdatedLostPolicies.isEmpty()){
- for(LoadedPolicy updatedPolicy: oldUpdatedLostPolicies){
- StdRemovedPolicy removedPolicy = new StdRemovedPolicy();
- removedPolicy.setPolicyName(updatedPolicy.getPolicyName());
- removedPolicy.setVersionNo(updatedPolicy.getVersionNo());
- removedDelta.add(removedPolicy);
- remove = true;
- }
- }
- }
- // Update our Record.
- if(!oldUpdatedPolicies.isEmpty()){
- for(LoadedPolicy updatedPolicy: oldUpdatedPolicies){
- newUpdatedPolicies.add((StdLoadedPolicy)updatedPolicy);
- }
- }
- if(!oldRemovedPolicies.isEmpty()){
- for(RemovedPolicy removedPolicy: oldRemovedPolicies){
- newRemovedPolicies.add((StdRemovedPolicy)removedPolicy);
- }
- }
- notificationRecord.setRemovedPolicies(newRemovedPolicies);
- notificationRecord.setLoadedPolicies(newUpdatedPolicies);
- // Update the notification Result.
- notificationDelta.setRemovedPolicies(removedDelta);
- notificationDelta.setLoadedPolicies(updatedDelta);
- if(remove&&update){
- notificationDelta.setNotificationType(NotificationType.BOTH);
- }else if(remove){
- notificationDelta.setNotificationType(NotificationType.REMOVE);
- }else if(update){
- notificationDelta.setNotificationType(NotificationType.UPDATE);
- }
- }
- return notificationDelta;
- }
-
- public static void recordNotification(StdPDPNotification notification){
- if(notification!=null){
- if(notificationRecord.getRemovedPolicies()==null || notificationRecord.getLoadedPolicies()==null){
- notificationRecord = notification;
- }else{
- // Check if there is anything new and update the record.
- if(notificationRecord.getLoadedPolicies()!=null || notificationRecord.getRemovedPolicies()!=null){
- HashSet<StdRemovedPolicy> removedPolicies = new HashSet<>();
- for(RemovedPolicy rPolicy: notificationRecord.getRemovedPolicies()){
- StdRemovedPolicy sRPolicy = new StdRemovedPolicy();
- sRPolicy.setPolicyName(rPolicy.getPolicyName());
- sRPolicy.setVersionNo(rPolicy.getVersionNo());
- removedPolicies.add(sRPolicy);
- }
- HashSet<StdLoadedPolicy> updatedPolicies = new HashSet<>();
- for(LoadedPolicy uPolicy: notificationRecord.getLoadedPolicies()){
- StdLoadedPolicy sUPolicy = new StdLoadedPolicy();
- sUPolicy.setMatches(uPolicy.getMatches());
- sUPolicy.setPolicyName(uPolicy.getPolicyName());
- sUPolicy.setVersionNo(uPolicy.getVersionNo());
- sUPolicy.setUpdateType(uPolicy.getUpdateType());
- updatedPolicies.add(sUPolicy);
- }
-
- // Checking with the new updated policies.
- if(notification.getLoadedPolicies()!=null && !notification.getLoadedPolicies().isEmpty()){
- for(LoadedPolicy newUpdatedPolicy: notification.getLoadedPolicies()){
- // If it was removed earlier then we need to remove from our record
- Iterator<StdRemovedPolicy> oldRemovedPolicy = removedPolicies.iterator();
- while(oldRemovedPolicy.hasNext()){
- RemovedPolicy policy = oldRemovedPolicy.next();
- if(newUpdatedPolicy.getPolicyName().equals(policy.getPolicyName())) {
- if(newUpdatedPolicy.getVersionNo().equals(policy.getVersionNo())) {
- oldRemovedPolicy.remove();
- }
- }
- }
- // If it was previously updated need to Overwrite it to the record.
- Iterator<StdLoadedPolicy> oldUpdatedPolicy = updatedPolicies.iterator();
- while(oldUpdatedPolicy.hasNext()){
- LoadedPolicy policy = oldUpdatedPolicy.next();
- if(newUpdatedPolicy.getPolicyName().equals(policy.getPolicyName())) {
- if(newUpdatedPolicy.getVersionNo().equals(policy.getVersionNo())) {
- oldUpdatedPolicy.remove();
- }
- }
- }
- StdLoadedPolicy sUPolicy = new StdLoadedPolicy();
- sUPolicy.setMatches(newUpdatedPolicy.getMatches());
- sUPolicy.setPolicyName(newUpdatedPolicy.getPolicyName());
- sUPolicy.setVersionNo(newUpdatedPolicy.getVersionNo());
- sUPolicy.setUpdateType(newUpdatedPolicy.getUpdateType());
- updatedPolicies.add(sUPolicy);
- }
- }
- // Checking with New Removed Policies.
- if(notification.getRemovedPolicies()!=null && !notification.getRemovedPolicies().isEmpty()){
- for(RemovedPolicy newRemovedPolicy : notification.getRemovedPolicies()){
- // If it was previously removed Overwrite it to the record.
- Iterator<StdRemovedPolicy> oldRemovedPolicy = removedPolicies.iterator();
- while(oldRemovedPolicy.hasNext()){
- RemovedPolicy policy = oldRemovedPolicy.next();
- if(newRemovedPolicy.getPolicyName().equals(policy.getPolicyName())) {
- if(newRemovedPolicy.getVersionNo().equals(policy.getVersionNo())) {
- oldRemovedPolicy.remove();
- }
- }
- }
- // If it was added earlier then we need to remove from our record.
- Iterator<StdLoadedPolicy> oldUpdatedPolicy = updatedPolicies.iterator();
- while(oldUpdatedPolicy.hasNext()){
- LoadedPolicy policy = oldUpdatedPolicy.next();
- if(newRemovedPolicy.getPolicyName().equals(policy.getPolicyName())) {
- if(newRemovedPolicy.getVersionNo().equals(policy.getVersionNo())) {
- oldUpdatedPolicy.remove();
- }
- }
- }
- StdRemovedPolicy sRPolicy = new StdRemovedPolicy();
- sRPolicy.setPolicyName(newRemovedPolicy.getPolicyName());
- sRPolicy.setVersionNo(newRemovedPolicy.getVersionNo());
- removedPolicies.add(sRPolicy);
- }
- }
- notificationRecord.setRemovedPolicies(removedPolicies);
- notificationRecord.setLoadedPolicies(updatedPolicies);
- }
- if(!notificationRecord.getLoadedPolicies().isEmpty() && !notificationRecord.getRemovedPolicies().isEmpty()){
- notificationRecord.setNotificationType(NotificationType.BOTH);
- }else if(!notificationRecord.getLoadedPolicies().isEmpty()){
- notificationRecord.setNotificationType(NotificationType.UPDATE);
- }else if(!notificationRecord.getRemovedPolicies().isEmpty()){
- notificationRecord.setNotificationType(NotificationType.REMOVE);
- }
- }
- }
- }
-
- // This should return the current Notification Record.
- public static PDPNotification getNotificationRecord(){
- return notificationRecord;
- }
+
+ private static StdPDPNotification notificationRecord = new StdPDPNotification();
+
+ public static StdPDPNotification getDeltaNotification(StdPDPNotification newNotification) {
+ StdPDPNotification notificationDelta = new StdPDPNotification();
+ ArrayList<StdRemovedPolicy> removedDelta = new ArrayList<>();
+ ArrayList<StdLoadedPolicy> updatedDelta = new ArrayList<>();
+ Collection<StdLoadedPolicy> newUpdatedPolicies = new ArrayList<>();
+ Collection<StdRemovedPolicy> newRemovedPolicies = new ArrayList<>();
+ Collection<LoadedPolicy> oldUpdatedLostPolicies = notificationRecord.getLoadedPolicies();
+ Collection<RemovedPolicy> oldRemovedPolicies = notificationRecord.getRemovedPolicies();
+ Collection<LoadedPolicy> oldUpdatedPolicies = notificationRecord.getLoadedPolicies();
+ Boolean update = false;
+ Boolean remove = false;
+ // if the NotificationRecord is empty
+ if (notificationRecord.getRemovedPolicies() == null || notificationRecord.getLoadedPolicies() == null) {
+ if (newNotification != null) {
+ notificationRecord = newNotification;
+ }
+ return notificationDelta;
+ }
+ // do the Delta operation.
+ if (newNotification != null) {
+ // check for old removed policies.
+ if (!newNotification.getRemovedPolicies().isEmpty()) {
+ for (RemovedPolicy newRemovedPolicy : newNotification.getRemovedPolicies()) {
+ //Look for policy Not in Remove
+ Boolean removed = true;
+ String policyName = newRemovedPolicy.getPolicyName();
+ String ver = newRemovedPolicy.getVersionNo();
+ for (RemovedPolicy oldRemovedPolicy : notificationRecord.getRemovedPolicies()) {
+ if (policyName.equals(oldRemovedPolicy.getPolicyName())
+ && ver.equals(oldRemovedPolicy.getVersionNo())) {
+ removed = false;
+ // Don't want a duplicate.
+ oldRemovedPolicies.remove(oldRemovedPolicy);
+ }
+ }
+ //We need to change our record we have an Update record of this remove.
+ for (LoadedPolicy oldUpdatedPolicy : notificationRecord.getLoadedPolicies()) {
+ if (policyName.equals(oldUpdatedPolicy.getPolicyName())
+ && ver.equals(oldUpdatedPolicy.getVersionNo())) {
+ oldUpdatedPolicies.remove(oldUpdatedPolicy);
+ oldUpdatedLostPolicies.remove(oldUpdatedPolicy);
+ }
+ }
+ if (removed) {
+ remove = true;
+ notificationRecord.getRemovedPolicies().add(newRemovedPolicy);
+ removedDelta.add((StdRemovedPolicy) newRemovedPolicy);
+ }
+ // This will be converted to New Later.
+ oldRemovedPolicies.add(newRemovedPolicy);
+ }
+ }
+ // Check for old Updated Policies.
+ if (!newNotification.getLoadedPolicies().isEmpty()) {
+ for (LoadedPolicy newUpdatedPolicy : newNotification.getLoadedPolicies()) {
+ // Look for policies which are not in Update
+ Boolean updated = true;
+ String policyName = newUpdatedPolicy.getPolicyName();
+ String ver = newUpdatedPolicy.getVersionNo();
+ for (LoadedPolicy oldUpdatedPolicy : notificationRecord.getLoadedPolicies()) {
+ if (policyName.equals(oldUpdatedPolicy.getPolicyName())
+ && ver.equals(oldUpdatedPolicy.getVersionNo())) {
+ updated = false;
+ // Remove the policy from copy.
+ oldUpdatedLostPolicies.remove(oldUpdatedPolicy);
+ // Eliminating Duplicate.
+ oldUpdatedPolicies.remove(oldUpdatedPolicy);
+ }
+ }
+ // Change the record if the policy has been Removed earlier.
+ for (RemovedPolicy oldRemovedPolicy : notificationRecord.getRemovedPolicies()) {
+ if (oldRemovedPolicy.getPolicyName().equals(policyName)
+ && oldRemovedPolicy.getVersionNo().equals(ver)) {
+ oldRemovedPolicies.remove(oldRemovedPolicy);
+ }
+ }
+ if (updated) {
+ update = true;
+ updatedDelta.add((StdLoadedPolicy) newUpdatedPolicy);
+ }
+ // This will be converted to new Later
+ oldUpdatedPolicies.add(newUpdatedPolicy);
+ }
+ // Conversion of Update to Remove if that occurred.
+ if (!oldUpdatedLostPolicies.isEmpty()) {
+ for (LoadedPolicy updatedPolicy : oldUpdatedLostPolicies) {
+ StdRemovedPolicy removedPolicy = new StdRemovedPolicy();
+ removedPolicy.setPolicyName(updatedPolicy.getPolicyName());
+ removedPolicy.setVersionNo(updatedPolicy.getVersionNo());
+ removedDelta.add(removedPolicy);
+ remove = true;
+ }
+ }
+ }
+ // Update our Record.
+ if (!oldUpdatedPolicies.isEmpty()) {
+ for (LoadedPolicy updatedPolicy : oldUpdatedPolicies) {
+ newUpdatedPolicies.add((StdLoadedPolicy) updatedPolicy);
+ }
+ }
+ if (!oldRemovedPolicies.isEmpty()) {
+ for (RemovedPolicy removedPolicy : oldRemovedPolicies) {
+ newRemovedPolicies.add((StdRemovedPolicy) removedPolicy);
+ }
+ }
+ notificationRecord.setRemovedPolicies(newRemovedPolicies);
+ notificationRecord.setLoadedPolicies(newUpdatedPolicies);
+ // Update the notification Result.
+ notificationDelta.setRemovedPolicies(removedDelta);
+ notificationDelta.setLoadedPolicies(updatedDelta);
+ if (remove && update) {
+ notificationDelta.setNotificationType(NotificationType.BOTH);
+ } else if (remove) {
+ notificationDelta.setNotificationType(NotificationType.REMOVE);
+ } else if (update) {
+ notificationDelta.setNotificationType(NotificationType.UPDATE);
+ }
+ }
+ return notificationDelta;
+ }
+
+ public static void recordNotification(StdPDPNotification notification) {
+ if (notification != null) {
+ if (notificationRecord.getRemovedPolicies() == null || notificationRecord.getLoadedPolicies() == null) {
+ notificationRecord = notification;
+ } else {
+ // Check if there is anything new and update the record.
+ if (notificationRecord.getLoadedPolicies() != null || notificationRecord.getRemovedPolicies() != null) {
+ HashSet<StdRemovedPolicy> removedPolicies = new HashSet<>();
+ for (RemovedPolicy rPolicy : notificationRecord.getRemovedPolicies()) {
+ StdRemovedPolicy sRPolicy = new StdRemovedPolicy();
+ sRPolicy.setPolicyName(rPolicy.getPolicyName());
+ sRPolicy.setVersionNo(rPolicy.getVersionNo());
+ removedPolicies.add(sRPolicy);
+ }
+ HashSet<StdLoadedPolicy> updatedPolicies = new HashSet<>();
+ for (LoadedPolicy uPolicy : notificationRecord.getLoadedPolicies()) {
+ StdLoadedPolicy sUPolicy = new StdLoadedPolicy();
+ sUPolicy.setMatches(uPolicy.getMatches());
+ sUPolicy.setPolicyName(uPolicy.getPolicyName());
+ sUPolicy.setVersionNo(uPolicy.getVersionNo());
+ sUPolicy.setUpdateType(uPolicy.getUpdateType());
+ updatedPolicies.add(sUPolicy);
+ }
+
+ // Checking with the new updated policies.
+ if (notification.getLoadedPolicies() != null && !notification.getLoadedPolicies().isEmpty()) {
+ for (LoadedPolicy newUpdatedPolicy : notification.getLoadedPolicies()) {
+ // If it was removed earlier then we need to remove from our record
+ Iterator<StdRemovedPolicy> oldRemovedPolicy = removedPolicies.iterator();
+ String policyName = newUpdatedPolicy.getPolicyName();
+ String ver = newUpdatedPolicy.getVersionNo();
+ while (oldRemovedPolicy.hasNext()) {
+ RemovedPolicy policy = oldRemovedPolicy.next();
+ if (policyName.equals(policy.getPolicyName())
+ && ver.equals(policy.getVersionNo())) {
+ oldRemovedPolicy.remove();
+ }
+ }
+ // If it was previously updated need to Overwrite it to the record.
+ updatedPolicies.removeIf(policy -> policyName.equals(policy.getPolicyName())
+ && ver.equals(policy.getVersionNo()));
+
+ StdLoadedPolicy sUPolicy = new StdLoadedPolicy();
+ sUPolicy.setMatches(newUpdatedPolicy.getMatches());
+ sUPolicy.setPolicyName(newUpdatedPolicy.getPolicyName());
+ sUPolicy.setVersionNo(newUpdatedPolicy.getVersionNo());
+ sUPolicy.setUpdateType(newUpdatedPolicy.getUpdateType());
+ updatedPolicies.add(sUPolicy);
+ }
+ }
+ // Checking with New Removed Policies.
+ if (notification.getRemovedPolicies() != null && !notification.getRemovedPolicies().isEmpty()) {
+ for (RemovedPolicy newRemovedPolicy : notification.getRemovedPolicies()) {
+ // If it was previously removed Overwrite it to the record.
+ Iterator<StdRemovedPolicy> oldRemovedPolicy = removedPolicies.iterator();
+ String policyName = newRemovedPolicy.getPolicyName();
+ String ver = newRemovedPolicy.getVersionNo();
+ while (oldRemovedPolicy.hasNext()) {
+ RemovedPolicy policy = oldRemovedPolicy.next();
+ if (policyName.equals(policy.getPolicyName())
+ && ver.equals(policy.getVersionNo())) {
+ oldRemovedPolicy.remove();
+ }
+ }
+ // If it was added earlier then we need to remove from our record.
+ updatedPolicies.removeIf(policy -> policyName.equals(policy.getPolicyName())
+ && ver.equals(policy.getVersionNo()));
+
+ StdRemovedPolicy sRPolicy = new StdRemovedPolicy();
+ sRPolicy.setPolicyName(policyName);
+ sRPolicy.setVersionNo(ver);
+ removedPolicies.add(sRPolicy);
+ }
+ }
+ notificationRecord.setRemovedPolicies(removedPolicies);
+ notificationRecord.setLoadedPolicies(updatedPolicies);
+ }
+ if (!notificationRecord.getLoadedPolicies().isEmpty() && !notificationRecord.getRemovedPolicies()
+ .isEmpty()) {
+ notificationRecord.setNotificationType(NotificationType.BOTH);
+ } else if (!notificationRecord.getLoadedPolicies().isEmpty()) {
+ notificationRecord.setNotificationType(NotificationType.UPDATE);
+ } else if (!notificationRecord.getRemovedPolicies().isEmpty()) {
+ notificationRecord.setNotificationType(NotificationType.REMOVE);
+ }
+ }
+ }
+ }
+
+ // This should return the current Notification Record.
+ public static PDPNotification getNotificationRecord() {
+ return notificationRecord;
+ }
}
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/std/StdPDPNotification.java b/PolicyEngineUtils/src/main/java/org/onap/policy/std/StdPDPNotification.java
index fe7807185..1640fe8db 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/std/StdPDPNotification.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/std/StdPDPNotification.java
@@ -22,59 +22,53 @@ package org.onap.policy.std;
import java.util.Collection;
import java.util.HashSet;
-
import org.onap.policy.api.LoadedPolicy;
import org.onap.policy.api.NotificationType;
import org.onap.policy.api.PDPNotification;
import org.onap.policy.api.RemovedPolicy;
-public class StdPDPNotification implements PDPNotification{
- private Collection<StdRemovedPolicy> removedPolicies = null;
- private Collection<StdLoadedPolicy> loadedPolicies = null;
- private Collection<RemovedPolicy> removed = null;
- private Collection<LoadedPolicy> updated = null;
- private NotificationType notificationType= null;
-
- @Override
- public Collection<RemovedPolicy> getRemovedPolicies() {
- removed = new HashSet<RemovedPolicy>();
- if(removedPolicies!=null){
- for(RemovedPolicy removedPolicy: removedPolicies){
- removed.add(removedPolicy);
- }
- return this.removed;
- }else{
- return null;
- }
- }
+public class StdPDPNotification implements PDPNotification {
+
+ private Collection<StdRemovedPolicy> removedPolicies = null;
+ private Collection<StdLoadedPolicy> loadedPolicies = null;
+ private Collection<RemovedPolicy> removed = null;
+ private Collection<LoadedPolicy> updated = null;
+ private NotificationType notificationType = null;
+
+ @Override
+ public Collection<RemovedPolicy> getRemovedPolicies() {
+ removed = new HashSet<>();
+ if (removedPolicies != null) {
+ removed.addAll(removedPolicies);
+ return this.removed;
+ }
+ return null;
+ }
+
+ @Override
+ public Collection<LoadedPolicy> getLoadedPolicies() {
+ updated = new HashSet<>();
+ if (loadedPolicies != null) {
+ updated.addAll(loadedPolicies);
+ return updated;
+ }
+ return null;
+ }
+
+ @Override
+ public NotificationType getNotificationType() {
+ return notificationType;
+ }
- @Override
- public Collection<LoadedPolicy> getLoadedPolicies() {
- updated = new HashSet<LoadedPolicy>();
- if(loadedPolicies!=null){
- for(LoadedPolicy updatedPolicy: loadedPolicies){
- updated.add(updatedPolicy);
- }
- return updated;
- }else{
- return null;
- }
- }
+ public void setNotificationType(NotificationType notificationType) {
+ this.notificationType = notificationType;
+ }
- @Override
- public NotificationType getNotificationType() {
- return notificationType;
- }
+ public void setLoadedPolicies(Collection<StdLoadedPolicy> loadedPolicies) {
+ this.loadedPolicies = loadedPolicies;
+ }
- public void setNotificationType(NotificationType notificationType){
- this.notificationType= notificationType;
- }
-
- public void setLoadedPolicies(Collection<StdLoadedPolicy> loadedPolicies) {
- this.loadedPolicies = loadedPolicies;
- }
-
- public void setRemovedPolicies(Collection<StdRemovedPolicy> removedPolicies) {
- this.removedPolicies = removedPolicies;
- }
+ public void setRemovedPolicies(Collection<StdRemovedPolicy> removedPolicies) {
+ this.removedPolicies = removedPolicies;
+ }
}
diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/BackUpMonitor.java b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/BackUpMonitor.java
index 3cdb51577..9aab2ad45 100644
--- a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/BackUpMonitor.java
+++ b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/BackUpMonitor.java
@@ -248,7 +248,7 @@ public class BackUpMonitor {
// This is New. create an entry as Master.
LOGGER.info("Adding resource " + resourceName + " to Database");
BackUpMonitorEntity bMEntity = new BackUpMonitorEntity();
- bMEntity.setResoruceNodeName(resourceNodeName);
+ bMEntity.setResourceNodeName(resourceNodeName);
bMEntity.setResourceName(resourceName);
bMEntity = setMaster(bMEntity);
bMEntity.setTimeStamp(new Date());
@@ -297,7 +297,7 @@ public class BackUpMonitor {
} else {
// Resource name is null -> No resource with same name.
selfEntity = new BackUpMonitorEntity();
- selfEntity.setResoruceNodeName(resourceNodeName);
+ selfEntity.setResourceNodeName(resourceNodeName);
selfEntity.setResourceName(resourceName);
selfEntity.setTimeStamp(new Date());
selfEntity = setSlave(selfEntity);
diff --git a/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/PolicyUtilsTest.java b/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/PolicyUtilsTest.java
index 586ab356d..34ed6b8b8 100644
--- a/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/PolicyUtilsTest.java
+++ b/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/PolicyUtilsTest.java
@@ -148,7 +148,7 @@ public class PolicyUtilsTest {
public void testBRMSValidate(){
String rule = "package com.sample;\n"
+ "import com.sample.DroolsTest.Message;\n"
- + "declare Params\n"
+ + "declare PapParams\n"
+ "samPoll : int\n"
+ "value : String\n"
+ "end\n"
diff --git a/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/testBackUpMonitor.java b/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/testBackUpMonitor.java
index afc3d0dce..39434a7e7 100644
--- a/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/testBackUpMonitor.java
+++ b/PolicyEngineUtils/src/test/java/org/onap/policy/utils/test/testBackUpMonitor.java
@@ -61,8 +61,8 @@ public class testBackUpMonitor {
@Test (expected = PersistenceException.class)
public void backUpMonitorTestFail() throws Exception{
Properties properties = new Properties();
- properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
- properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
+ properties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver");
+ properties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/onap_sdk");
properties.setProperty("javax.persistence.jdbc.user", "policy_user");
properties.setProperty("javax.persistence.jdbc.password", "");
BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), "brms_test" , properties, new Handler());
@@ -71,8 +71,8 @@ public class testBackUpMonitor {
@Test
public void backUpMonitorTestFailNoUser() throws Exception{
Properties properties = new Properties();
- properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
- properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
+ properties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver");
+ properties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/onap_sdk");
properties.setProperty("javax.persistence.jdbc.user", "");
properties.setProperty("javax.persistence.jdbc.password", "password");
BackUpMonitor bum = BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), "brms_test" , properties, new Handler());
@@ -82,7 +82,7 @@ public class testBackUpMonitor {
@Test
public void backUpMonitorTestFailNoURL() throws Exception{
Properties properties = new Properties();
- properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
+ properties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver");
properties.setProperty("javax.persistence.jdbc.url", "");
properties.setProperty("javax.persistence.jdbc.user", "test");
properties.setProperty("javax.persistence.jdbc.password", "password");
@@ -95,7 +95,7 @@ public class testBackUpMonitor {
public void backUpMonitorTestFailNoDriver() throws Exception{
Properties properties = new Properties();
properties.setProperty("javax.persistence.jdbc.driver", "");
- properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
+ properties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/onap_sdk");
properties.setProperty("javax.persistence.jdbc.user", "test");
properties.setProperty("javax.persistence.jdbc.password", "password");
properties.setProperty("ping_interval", "500");
@@ -106,8 +106,8 @@ public class testBackUpMonitor {
@Test
public void backUpMonitorTestFailNoNode() throws Exception{
Properties properties = new Properties();
- properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
- properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
+ properties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver");
+ properties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/onap_sdk");
properties.setProperty("javax.persistence.jdbc.user", "test");
properties.setProperty("javax.persistence.jdbc.password", "password");
properties.setProperty("ping_interval", "");
@@ -118,8 +118,8 @@ public class testBackUpMonitor {
@Test
public void backUpMonitorTestFailNoResource() throws Exception{
Properties properties = new Properties();
- properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
- properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
+ properties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver");
+ properties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/onap_sdk");
properties.setProperty("javax.persistence.jdbc.user", "test");
properties.setProperty("javax.persistence.jdbc.password", "password");
BackUpMonitor bum = BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), null , properties, new Handler());
@@ -135,8 +135,8 @@ public class testBackUpMonitor {
@Test
public void backUpMonitorTestFailNoHandler() throws Exception{
Properties properties = new Properties();
- properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver");
- properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost:3306/xacml");
+ properties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver");
+ properties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/onap_sdk");
properties.setProperty("javax.persistence.jdbc.user", "test");
properties.setProperty("javax.persistence.jdbc.password", "password");
properties.setProperty("ping_interval", "500");
@@ -252,7 +252,7 @@ public class testBackUpMonitor {
origBM.setFlag("SLAVE");
origBM.setTimeStamp(new Date());
BackUpMonitorEntity bMEntity = new BackUpMonitorEntity();
- bMEntity.setResoruceNodeName(ResourceNode.BRMS.toString());
+ bMEntity.setResourceNodeName(ResourceNode.BRMS.toString());
bMEntity.setResourceName("brms_test2");
bMEntity.setFlag("MASTER");
bMEntity.setTimeStamp(new Date());
diff --git a/docs/index.rst b/docs/index.rst
index 4df15fc8d..f3d2bdb79 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -4,6 +4,7 @@ Policy Engine
-------------
.. toctree::
- :maxdepth: 1
-
+ :maxdepth: 2
+ platform/index
+ release-notes/index
diff --git a/docs/platform/PolicyArchitectureDetails.png b/docs/platform/PolicyArchitectureDetails.png
new file mode 100755
index 000000000..39705465d
--- /dev/null
+++ b/docs/platform/PolicyArchitectureDetails.png
Binary files differ
diff --git a/docs/platform/PolicyEngineApiList.png b/docs/platform/PolicyEngineApiList.png
new file mode 100755
index 000000000..deb38b9ae
--- /dev/null
+++ b/docs/platform/PolicyEngineApiList.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Access.png b/docs/platform/PolicyGUI_Access.png
new file mode 100755
index 000000000..781ce918a
--- /dev/null
+++ b/docs/platform/PolicyGUI_Access.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Admin.png b/docs/platform/PolicyGUI_Admin.png
new file mode 100755
index 000000000..0465a07bc
--- /dev/null
+++ b/docs/platform/PolicyGUI_Admin.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Dashboard.png b/docs/platform/PolicyGUI_Dashboard.png
new file mode 100755
index 000000000..ece03ba78
--- /dev/null
+++ b/docs/platform/PolicyGUI_Dashboard.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Dictionary.png b/docs/platform/PolicyGUI_Dictionary.png
new file mode 100755
index 000000000..53a604f08
--- /dev/null
+++ b/docs/platform/PolicyGUI_Dictionary.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Editor.png b/docs/platform/PolicyGUI_Editor.png
new file mode 100755
index 000000000..ce579749f
--- /dev/null
+++ b/docs/platform/PolicyGUI_Editor.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Editor_CreatePolicy.png b/docs/platform/PolicyGUI_Editor_CreatePolicy.png
new file mode 100755
index 000000000..f09bb90ad
--- /dev/null
+++ b/docs/platform/PolicyGUI_Editor_CreatePolicy.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Editor_PolicyActions.png b/docs/platform/PolicyGUI_Editor_PolicyActions.png
new file mode 100755
index 000000000..7b376f3e8
--- /dev/null
+++ b/docs/platform/PolicyGUI_Editor_PolicyActions.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Editor_PolicyActionsDetail.png b/docs/platform/PolicyGUI_Editor_PolicyActionsDetail.png
new file mode 100755
index 000000000..4cfbbbac5
--- /dev/null
+++ b/docs/platform/PolicyGUI_Editor_PolicyActionsDetail.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Editor_Scope.png b/docs/platform/PolicyGUI_Editor_Scope.png
new file mode 100755
index 000000000..09de9669d
--- /dev/null
+++ b/docs/platform/PolicyGUI_Editor_Scope.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_PDP.png b/docs/platform/PolicyGUI_PDP.png
new file mode 100755
index 000000000..af575d262
--- /dev/null
+++ b/docs/platform/PolicyGUI_PDP.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Push.png b/docs/platform/PolicyGUI_Push.png
new file mode 100755
index 000000000..ccf092a71
--- /dev/null
+++ b/docs/platform/PolicyGUI_Push.png
Binary files differ
diff --git a/docs/platform/PolicyGUI_Roles.png b/docs/platform/PolicyGUI_Roles.png
new file mode 100755
index 000000000..d1ef99c47
--- /dev/null
+++ b/docs/platform/PolicyGUI_Roles.png
Binary files differ
diff --git a/docs/platform/PolicyR1Architecture.png b/docs/platform/PolicyR1Architecture.png
new file mode 100755
index 000000000..def3d2aae
--- /dev/null
+++ b/docs/platform/PolicyR1Architecture.png
Binary files differ
diff --git a/docs/platform/PolicyTargetArchitecture.png b/docs/platform/PolicyTargetArchitecture.png
new file mode 100755
index 000000000..74e05da31
--- /dev/null
+++ b/docs/platform/PolicyTargetArchitecture.png
Binary files differ
diff --git a/docs/platform/api-docs.json b/docs/platform/api-docs.json
new file mode 100755
index 000000000..55726b271
--- /dev/null
+++ b/docs/platform/api-docs.json
@@ -0,0 +1 @@
+{"swagger":"2.0","info":{"description":"This API helps to make queries against Policy Engine","version":"3.0","title":"Policy Engine REST API"},"host":"104.239.197.207:8081","basePath":"/pdp/api","tags":[{"name":"policy-engine-services","description":"Policy Engine Services"}],"paths":{"/createConfig":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Config Policy based on given Policy Parameters.","operationId":"createConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configPolicyAPIRequest","description":"configPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/createDictionaryItem":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Dictionary Item for a specific dictionary based on given Parameters.","operationId":"createDictionaryItemUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"dictionaryParameters","description":"dictionaryParameters","required":true,"schema":{"$ref":"#/definitions/DictionaryParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/createFirewallConfig":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Config Firewall Policy","operationId":"createFirewallConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configFirewallPolicyAPIRequest","description":"configFirewallPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigFirewallPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/createPolicy":{"put":{"tags":["policy-engine-services"],"summary":"Creates a Policy based on given Policy Parameters.","operationId":"createPolicyUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"policyParameters","description":"policyParameters","required":true,"schema":{"$ref":"#/definitions/PolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/deletePolicy":{"delete":{"tags":["policy-engine-services"],"summary":"Deletes the specified policy from the PDP Group or PAP.","operationId":"deletePolicyUsingDELETE","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"deletePolicyParameters","description":"deletePolicyParameters","required":true,"schema":{"$ref":"#/definitions/DeletePolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"401":{"description":"Unauthorized"},"204":{"description":"No Content"},"403":{"description":"Forbidden"}}}},"/getConfig":{"post":{"tags":["policy-engine-services"],"summary":"Gets the configuration from the PolicyDecisionPoint(PDP)","operationId":"getConfigUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configRequestParameters","description":"configRequestParameters","required":true,"schema":{"$ref":"#/definitions/ConfigRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«PolicyConfig»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getConfigByPolicyName":{"post":{"tags":["policy-engine-services"],"summary":"Gets the configuration from the PolicyDecisionPoint(PDP) using PolicyName","operationId":"getConfigByPolicyNameUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configNameRequest","description":"configNameRequest","required":true,"schema":{"$ref":"#/definitions/ConfigNameRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«PolicyConfig»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/getDecision":{"post":{"tags":["policy-engine-services"],"summary":"Gets the Decision using specified decision parameters","operationId":"getDecisionUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"decisionRequestParameters","description":"decisionRequestParameters","required":true,"schema":{"$ref":"#/definitions/DecisionRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/DecisionResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getDictionaryItems":{"post":{"tags":["policy-engine-services"],"summary":"Gets the dictionary items from the PAP","operationId":"getDictionaryItemsUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"dictionaryParameters","description":"dictionaryParameters","required":true,"schema":{"$ref":"#/definitions/DictionaryParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/DictionaryResponse"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getMetrics":{"get":{"tags":["policy-engine-services"],"summary":"Gets the policy metrics from the PolicyAccessPoint(PAP)","operationId":"getMetricsUsingGET","consumes":["application/json"],"produces":["*/*"],"parameters":[{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/MetricsResponse"}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/getNotification":{"post":{"tags":["policy-engine-services"],"summary":"Registers DMaaP Topic to recieve notification from Policy Engine","operationId":"getNotificationUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"notificationTopic","description":"notificationTopic","required":true,"schema":{"type":"string"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/listConfig":{"post":{"tags":["policy-engine-services"],"summary":"Gets the list of configuration policies from the PDP","operationId":"listConfigUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configRequestParameters","description":"configRequestParameters","required":true,"schema":{"$ref":"#/definitions/ConfigRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«string»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/policyEngineImport":{"post":{"tags":["policy-engine-services"],"summary":"Imports Policy based on the parameters which represent the service used to create a policy Service.","operationId":"policyEngineImportUsingPOST","consumes":["multipart/form-data"],"produces":["*/*"],"parameters":[{"name":"importParametersJson","in":"query","description":"importParametersJson","required":true,"type":"string"},{"name":"file","in":"formData","description":"file","required":true,"type":"file"},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/pushPolicy":{"put":{"tags":["policy-engine-services"],"summary":"Pushes the specified policy to the PDP Group.","operationId":"pushPolicyUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"pushPolicyParameters","description":"pushPolicyParameters","required":true,"schema":{"$ref":"#/definitions/PushPolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/sendEvent":{"post":{"tags":["policy-engine-services"],"summary":"Sends the Events specified to the Policy Engine","operationId":"sendEventUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"eventRequestParameters","description":"eventRequestParameters","required":true,"schema":{"$ref":"#/definitions/EventRequestParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/Collection«PolicyResponse»"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/sendHeartbeat":{"post":{"tags":["policy-engine-services"],"summary":"Sends Heartbeat to DMaaP Topic Registry to continue recieving notifications from Policy Engine","operationId":"sendHeartbeatUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"notificationTopic","description":"notificationTopic","required":true,"schema":{"type":"string"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/stopNotification":{"post":{"tags":["policy-engine-services"],"summary":"De-Registers DMaaP Topic to stop recieving notifications from Policy Engine","operationId":"stopNotificationUsingPOST","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"notificationTopic","description":"notificationTopic","required":true,"schema":{"type":"string"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/updateConfig":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Config Policy based on given Policy Parameters.","operationId":"updateConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configPolicyAPIRequest","description":"configPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/updateDictionaryItem":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Dictionary Item for a specific dictionary based on given Parameters.","operationId":"updateDictionaryItemUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"dictionaryParameters","description":"dictionaryParameters","required":true,"schema":{"$ref":"#/definitions/DictionaryParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}},"/updateFirewallConfig":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Config Firewall Policy","operationId":"updateFirewallConfigUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"configFirewallPolicyAPIRequest","description":"configFirewallPolicyAPIRequest","required":true,"schema":{"$ref":"#/definitions/ConfigFirewallPolicyAPIRequest"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}},"deprecated":true}},"/updatePolicy":{"put":{"tags":["policy-engine-services"],"summary":"Updates a Policy based on given Policy Parameters.","operationId":"updatePolicyUsingPUT","consumes":["application/json"],"produces":["*/*"],"parameters":[{"in":"body","name":"policyParameters","description":"policyParameters","required":true,"schema":{"$ref":"#/definitions/PolicyParameters"}},{"name":"ClientAuth","in":"header","description":"ClientAuth","required":true,"type":"string"},{"name":"X-ECOMP-RequestID","in":"header","description":"X-ECOMP-RequestID","required":false,"type":"string"},{"name":"Authorization","in":"header","required":true,"type":"string"},{"name":"Environment","in":"header","required":true,"type":"string"}],"responses":{"200":{"description":"OK","schema":{"type":"string"}},"201":{"description":"Created"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Not Found"}}}}},"definitions":{"PolicyParameters":{"type":"object","properties":{"actionAttribute":{"type":"string"},"actionPerformer":{"type":"string"},"attributes":{"type":"object","additionalProperties":{"$ref":"#/definitions/Map«string,string»"}},"configBody":{"type":"string"},"configBodyType":{"type":"string","enum":["Properties","json","xml","other"]},"configName":{"type":"string"},"controllerName":{"type":"string"},"dependencyNames":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmField1":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmField2":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmFunctions":{"type":"array","items":{"type":"string"}},"dynamicRuleAlgorithmLabels":{"type":"array","items":{"type":"string"}},"ecompName":{"type":"string"},"extendedOption":{"type":"string"},"guard":{"type":"boolean"},"onapName":{"type":"string"},"policyClass":{"type":"string","enum":["Config","Action","Decision"]},"policyConfigType":{"type":"string","enum":["Base","Fault","PM","FW","BRMS_Raw","BRMS_Param","MS","EXTENDED"]},"policyDescription":{"type":"string"},"policyName":{"type":"string"},"priority":{"type":"string"},"requestID":{"type":"string"},"riskLevel":{"type":"string"},"riskType":{"type":"string"},"ruleProvider":{"type":"string","enum":["Custom","AAF","GUARD_YAML","GUARD_BL_YAML"]},"ttlDate":{"type":"string","format":"date-time"}}},"ConfigRequestParameters":{"type":"object","properties":{"configAttributes":{"type":"object","additionalProperties":{"type":"string"}},"configName":{"type":"string"},"ecompName":{"type":"string"},"onapName":{"type":"string"},"policyName":{"type":"string"},"requestID":{"type":"string"},"unique":{"type":"boolean"}}},"Collection«PolicyResponse»":{"type":"object"},"DecisionResponse":{"type":"object","properties":{"decision":{"type":"string","enum":["permit","deny","error"]},"details":{"type":"string"}}},"DictionaryParameters":{"type":"object","properties":{"dictionary":{"type":"string"},"dictionaryJson":{"type":"string"},"dictionaryType":{"type":"string","enum":["Common","Action","ClosedLoop","Firewall","Decision","BRMS","MicroService","DescriptiveScope","PolicyScope","Enforcer","SafePolicy","Extended"]},"requestID":{"type":"string"}}},"JsonValue":{"type":"object","properties":{"valueType":{"type":"string","enum":["ARRAY","OBJECT","STRING","NUMBER","TRUE","FALSE","NULL"]}}},"DecisionRequestParameters":{"type":"object","properties":{"decisionAttributes":{"type":"object","additionalProperties":{"type":"string"}},"ecompcomponentName":{"type":"string"},"onapName":{"type":"string"},"requestID":{"type":"string"}}},"ConfigPolicyAPIRequest":{"type":"object","properties":{"body":{"type":"string"},"configAttributes":{"type":"object","additionalProperties":{"type":"string"}},"configName":{"type":"string"},"configType":{"type":"string"},"ecompName":{"type":"string"},"guard":{"type":"string"},"onapName":{"type":"string"},"policyDescription":{"type":"string"},"policyName":{"type":"string"},"policyScope":{"type":"string"},"riskLevel":{"type":"string"},"riskType":{"type":"string"},"ttlDate":{"type":"string"}}},"PushPolicyParameters":{"type":"object","properties":{"pdpGroup":{"type":"string"},"policyName":{"type":"string"},"policyType":{"type":"string"},"requestID":{"type":"string"}}},"ConfigFirewallPolicyAPIRequest":{"type":"object","properties":{"firewallJson":{"type":"string"},"guard":{"type":"string"},"policyName":{"type":"string"},"policyScope":{"type":"string"},"riskLevel":{"type":"string"},"riskType":{"type":"string"},"ttlDate":{"type":"string"}}},"PolicyConfig":{"type":"object","properties":{"config":{"type":"string"},"matchingConditions":{"type":"object","additionalProperties":{"type":"string"}},"policyConfigMessage":{"type":"string"},"policyConfigStatus":{"type":"string","enum":["retrieved","not_found"]},"policyName":{"type":"string"},"policyVersion":{"type":"string"},"property":{"type":"object","additionalProperties":{"type":"string"}},"responseAttributes":{"type":"object","additionalProperties":{"type":"string"}},"type":{"type":"string","enum":["Properties","json","xml","other"]}}},"EventRequestParameters":{"type":"object","properties":{"eventAttributes":{"type":"object","additionalProperties":{"type":"string"}},"requestID":{"type":"string"}}},"Map«string,string»":{"type":"object","additionalProperties":{"type":"string"}},"Collection«PolicyConfig»":{"type":"object"},"DictionaryResponse":{"type":"object","properties":{"dictionaryData":{"type":"object","additionalProperties":{"type":"string"}},"dictionaryJson":{"type":"object","additionalProperties":{"$ref":"#/definitions/JsonValue"}},"responseCode":{"type":"integer","format":"int32"},"responseMessage":{"type":"string"}}},"ConfigNameRequest":{"type":"object","properties":{"policyName":{"type":"string"}}},"MetricsResponse":{"type":"object","properties":{"metricsTotal":{"type":"integer","format":"int32"},"papMetrics":{"type":"integer","format":"int32"},"pdpMetrics":{"type":"integer","format":"int32"},"responseCode":{"type":"integer","format":"int32"},"responseMessage":{"type":"string"}}},"Collection«string»":{"type":"object"},"PolicyResponse":{"type":"object","properties":{"actionAdvised":{"type":"object","additionalProperties":{"type":"string"}},"actionTaken":{"type":"object","additionalProperties":{"type":"string"}},"policyResponseMessage":{"type":"string"},"policyResponseStatus":{"type":"string","enum":["no_action","action_advised","action_taken"]},"requestAttributes":{"type":"object","additionalProperties":{"type":"string"}}}},"DeletePolicyParameters":{"type":"object","properties":{"deleteCondition":{"type":"string","enum":["Current Version","All Versions"]},"pdpGroup":{"type":"string"},"policyComponent":{"type":"string"},"policyName":{"type":"string"},"policyType":{"type":"string"},"requestID":{"type":"string"}}}}} \ No newline at end of file
diff --git a/docs/platform/architecture.rst b/docs/platform/architecture.rst
new file mode 100644
index 000000000..d9ce3c8cb
--- /dev/null
+++ b/docs/platform/architecture.rst
@@ -0,0 +1,98 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+
+
+Architecture
+------------
+
+.. contents::
+ :depth: 3
+
+POLICY is a subsystem of ONAP that maintains, distributes, and operates on the set of rules that underlie ONAP’s control, orchestration, and management functions.
+
+POLICY provides a logically centralized environment for the creation and management of policies, including conditional rules. This provides the capability to **create** and **validate** policies/rules, **identify overlaps**, **resolve conflicts**, and **derive** additional policies as needed. Policies are used to **control**, **influence**, and help **ensure compliance** with goals. Policies can support infrastructure, products and services, operation automation, and security. Users, including network and service designers, operations engineers, and security experts, can easily **create**, **change**, and **manage** policy rules from the POLICY Manager in the ONAP Portal.
+
+The figure below represents the target POLICY Architecture.
+
+.. image:: PolicyTargetArchitecture.png
+
+
+The figure below represents the current POLICY Architecture.
+
+.. image:: PolicyR1Architecture.png
+
+
+A policy is defined to create a condition, requirement, constraint, decision, or a need that must be provided, evaluated, maintained, and/or enforced. The policy is validated and corrected for any conflicts, and then placed in the appropriate repository, and made available for use by other subsystems and components. Alternately, some policies are directly distributed to policy decision engines such as Drools or XACML. In this manner, the constraints, decisions and actions to be taken are distributed.
+
+
+System Architecture
+^^^^^^^^^^^^^^^^^^^
+
+ONAP POLICY is composed of several subcomponents: the **Policy Administration Point (PAP)**, which offers interfaces for policy creation, and two types of **Policy Decision Point (PDP)**, each based on a specific rules technology. PDP-X is based on XACML technology and PDP-D is based on Drools technology. PDP-X is **stateless** and can be deployed as a resource pool of PDP-X servers. The number of servers can be grown to increase both capacity (horizontal scalability) and to increase availability. The PDP-D is **stateful**, as it utilizes Drools in its native, stateful way and transactions persist so long as the PDP-D is active. Persistent Drools sessions, state management, local and geo-redundancy have been deactivated for the initial release of ONAP POLICY and can be turned on in a future release. Additional instances of XACML/Drools engines and assigned roles/purposes may also be added in the future to provide a flexible, expandable policy capability.
+
+As illustrated in the Figure below, the POLICY components are supported by a number of interfaces and subsystems. The ONAP Portal provides a human interface for the creation, management and deployment of policies. It is a web-based system that utilizes internal APIs in the PAP.
+
+.. image:: PolicyArchitectureDetails.png
+
+
+The PAP provides interfaces for the management of policies. It utilizes the XACML database to store policies, which are then distributed to the PDPs.
+
+The XACML and Drools databases are hosted in a MariaDB cluster. The XACML database is used to persist policies and policy dictionaries and provide a point for PDPs to retrieve policies. The XACML database also has tables used for node state management, detection of node failure and failover. As indicated above, the state management tables will only include entries for the PAP and PDP-X as the testing is not yet complete for the PDP-D.
+
+The PDP-X receives deployed policies and has interfaces to handle XACML policy transactions. These transactions are stateless and once complete, they are removed from memory. If a policy that is deployed to the PDP-X is of an operational nature it will contain Drools rules and Java executables. These artifacts are processed into Maven artifacts and pushed to the Maven repository. The PDP-D is then notified a new policy has been deployed.
+
+When the PDP-D is notified a new policy has been deployed, it downloads it from the Maven repository and assigns it to an internal controller. This controller provides the external Closed Loop interfaces to the DMaaP message bus over which events and messages are exchanged with external systems. As events or messages arrive at the PDP-D, they are assigned to the appropriate controller and a Drools session is either created or retrieved from memory. The events, messages or facts are passed to the Drools session and the corresponding rule is fired, resulting in a change of internal session state and possibly actions taken in response to the rule processing. Response messages and requests are passed by the controller back over the DMaaP message bus to the appropriate system. The Drools session can also have timers and autonomous events. In a future release the PDP-D can enable the node state management and session persistence in the Drools DB.
+
+
+Policy Creation
+^^^^^^^^^^^^^^^
+The Policy Creation component of the Policy subsystem enables creation of new policies and modification of existing polices, both during the design phase and during runtime. Policy Creation is targeted to be integrated to a unified Service Design and Creation (SDC) environment.
+
+A policy can be defined at a high level to create a condition, requirement, constraint, decision or a need that must be provided, evaluated, maintained, and/or enforced. A policy can also be defined at a lower or functional level, such as a machine-readable rule or software condition/assertion which enables actions to be taken based on a trigger or request, specific to particular selected conditions in effect at that time.
+
+Some examples of types of policies are:
+
+* VNF placement — rules governing where VNFs should be placed, including affinity rules
+* Data and feed management — what data to collect and when, retention periods, and when to send alarms about issues
+* Access control — who (or what) can have access to which data
+* Trigger conditions and actions — what conditions are actionable, and what to do under those conditions
+* Interactions — how interactions between change management and fault/performance management are handled (for example, should closed loops be disabled during maintenance?)
+
+
+Policy Distribution
+^^^^^^^^^^^^^^^^^^^
+
+After a policy has been initially created or an existing policy has been modified, the Policy Distribution Framework sends the policy from the repository to its points of use, which include Policy Decision Points (PDPs) and Policy enforcement points (DCAE, Controllers, etc), before the policy is actually needed.
+
+The decisions and actions taken by the policy are distributed. Policies are distributed either in conjunction with installation packages (for example, related to service instantiation) or independently, if unrelated to a particular service. Some policies can be configured (e.g., configuring policy parameters within microservices), while other polices are delivered to policy engines such as XAMCL and Drools. With this methodology, policies will already be available when needed by a component, minimizing real-time requests to a central policy engine or PDP (Policy Decision Point). This improves scalability and reduces latency.
+
+Separate notifications or events communicate the link or URL for a policy to the components that need it. Then, when a component needs the policy, it uses the link to fetch it. Components in some cases might also publish events indicating that they need new policies, eliciting a response with updated links or URLs. Also, in some cases, policies can indicate to components that they should subscribe to one or more policies, so that they receive automatic updates to those policies as they become available.
+
+
+Policy Decision and Enforcement
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Run-time policy enforcement is performed by ONAP subsystems that are policy-enabled or can respond to commands from a policy-enabled element such as a PDP. For example, policy rules for data collection are enforced by the data collection functionality of DCAE. Analytic policy rules, identification of anomalous or abnormal conditions, and publication of events signaling detection of such conditions are enforced by DCAE analytic applications. Policy rules for associated remedial actions, or for further diagnostics, are enforced by the correct component in a control loop such as the MSO, a Controller, or DCAE. Policy engines such as XACML and Drools also enforce policies and can trigger other components as a result (for example, causing a controller to take specific actions specified by the policy). Additionally, some policies (“Guard Policies”) may enforce checks against decided actions.
+
+
+Policy Unification and Organization
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Because the POLICY framework is expandable and multipurpose, it is likely to contain many types of policies which require organization according to some useful dimensions. Users can define attributes that specify the scope of policies, and these attributes can be extended to the policy-enabled functions and components. Useful policy organizing dimensions might include:
+
+* Policy type or category (taxonomical)
+* Policy life cycle
+* Policy ownership or administrative domain
+* Geographic area or location,
+* Technology type
+* Policy language and version
+* Security level or other security-related values, specifiers, or limiters
+
+Attributes can be specified for each dimension. In addition to being defined for individual policies themselves, these attributes can be used to define the scope of these additional additional policy-related functions:
+
+* Policy events or requests/triggers
+* Policy decision, enforcement, or other functions
+* Virtual functions of any type
+
+Policy writers can define attributes so that policy events or requests self-indicate their scope. The scope is then examined by a suitable function and subsequently acted upon accordingly. Policy decisions and enforcement functions can self-indicate their scope of decision-making, enforcement, or other capabilities. Virtual functions can be automatically attached to the appropriate POLICY Framework and distribution mechanisms.
+
+
diff --git a/docs/platform/index.rst b/docs/platform/index.rst
new file mode 100644
index 000000000..b489b2fb3
--- /dev/null
+++ b/docs/platform/index.rst
@@ -0,0 +1,12 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+Policy Engine
+-------------
+
+.. toctree::
+ :maxdepth: 1
+
+ architecture.rst
+ offeredapis.rst
+ installation.rst
+ policygui.rst
diff --git a/docs/platform/installation.rst b/docs/platform/installation.rst
new file mode 100644
index 000000000..a10f02689
--- /dev/null
+++ b/docs/platform/installation.rst
@@ -0,0 +1,315 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+
+Installation
+------------
+
+.. contents::
+ :depth: 3
+
+The installation of ONAP Policy is **automated** by design and can be done via Docker as a standalone system.
+Various tools, including healthcheck, logs, and Swagger can be used to ensure proper operation.
+
+ONAP Policy Framework: Standalone Quick Start
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+This procedure explains how build the ONAP Policy Framework and get it running in Docker as a standalone system.
+This procedure assumes that:
+
+* You are using a *\*nix* operating system such as linux or macOS.
+* You are using a directory called *git* off your home directory *(~/git)* for your git repositories
+* Your local maven repository is in the location *~/.m2/repository*
+
+The procedure documented here has been verified to work on a MacBook laptop running macOS Sierra Version 10.12.6 and a HP Z600 desktop running Ubuntu 16.04.3 LTS.
+
+
+.. code-block:: bash
+ :caption: Typical ONAP Policy Framework Clone Script
+ :linenos:
+
+ #!/usr/bin/env bash
+
+ ## script name for output
+ MOD_SCRIPT_NAME=`basename $0`
+
+ ## the ONAP clone directory, defaults to "onap"
+ clone_dir="onap"
+
+ ## the ONAP repos to clone
+ onap_repos="\
+ oparent \
+ ecompsdkos \
+ policy/api \
+ policy/common \
+ policy/docker \
+ policy/drools-applications \
+ policy/drools-pdp \
+ policy/engine \
+ policy/gui \
+ policy/pap \
+ policy/pdp"
+
+ ##
+ ## Help screen and exit condition (i.e. too few arguments)
+ ##
+ Help()
+ {
+ echo ""
+ echo "$MOD_SCRIPT_NAME - clones all required ONAP git repositories"
+ echo ""
+ echo " Usage: $MOD_SCRIPT_NAME [-options]"
+ echo ""
+ echo " Options"
+ echo " -d - the ONAP clone directory, defaults to '.'"
+ echo " -h - this help screen"
+ echo ""
+ exit 255;
+ }
+
+ ##
+ ## read command line
+ ##
+ while [ $# -gt 0 ]
+ do
+ case $1 in
+ #-d ONAP clone directory
+ -d)
+ shift
+ if [ -z "$1" ]; then
+ echo "$MOD_SCRIPT_NAME: no clone directory"
+ exit 1
+ fi
+ clone_dir=$1
+ shift
+ ;;
+
+ #-h prints help and exists
+ -h)
+ Help;exit 0;;
+
+ *) echo "$MOD_SCRIPT_NAME: undefined CLI option - $1"; exit 255;;
+ esac
+ done
+
+ if [ -f "$clone_dir" ]; then
+ echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as file"
+ exit 2
+ fi
+ if [ -d "$clone_dir" ]; then
+ echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as directory"
+ exit 2
+ fi
+
+ mkdir $clone_dir
+ if [ $? != 0 ]
+ then
+ echo cannot clone ONAP repositories, could not create directory '"'$clone_dir'"'
+ exit 3
+ fi
+
+ for repo in $onap_repos
+ do
+ repoDir=`dirname "$repo"`
+ repoName=`basename "$repo"`
+
+ if [ ! -z $dirName ]
+ then
+ mkdir "$clone_dir/$repoDir"
+ if [ $? != 0 ]
+ then
+ echo cannot clone ONAP repositories, could not create directory '"'$clone_dir/repoDir'"'
+ exit 4
+ fi
+ fi
+
+ git clone https://gerrit.onap.org/r/${repo} $clone_dir/$repo
+ done
+
+ echo ONAP has been cloned into '"'$clone_dir'"'
+
+Execution of the script above results in the following directory hierarchy in your *~/git* directory:
+
+ * ~/git/onap
+ * ~/git/onap/ecompsdkos
+ * ~/git/onap/oparent
+ * ~/git/onap/policy
+ * ~/git/onap/policy/api
+ * ~/git/onap/policy/common
+ * ~/git/onap/policy/docker
+ * ~/git/onap/policy/drools-applications
+ * ~/git/onap/policy/drools-pdp
+ * ~/git/onap/policy/engine
+ * ~/git/onap/policy/gui
+ * ~/git/onap/policy/pap
+ * ~/git/onap/policy/pdp
+
+
+
+Building ONAP
+^^^^^^^^^^^^^
+
+**Step 1.** Optionally, for a completely clean build, remove the ONAP built modules from your local repository.
+
+ * rm -fr ~/.m2/repository/org/onap
+ * rm -fr ~/.m2/repository/org/openecomp
+
+
+**Step 2**. A pom such as the one below can be used to build all the ONAP policy modules and their dependencies. Create the *pom.xml* file in the directory *~/git/onap*.
+
+.. code-block:: xml
+ :caption: Typical pom.xml to build the ONAP Policy Framework
+ :linenos:
+
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap</groupId>
+ <artifactId>onap-policy_standalone</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>${project.artifactId}</name>
+ <inceptionYear>2017</inceptionYear>
+ <organization>
+ <name>ONAP</name>
+ </organization>
+
+ <profiles>
+ <profile>
+ <id>policy-dependencies</id>
+ <activation>
+ <property>
+ <name>policyDeps</name>
+ </property>
+ </activation>
+ <modules>
+ <module>oparent</module>
+ <module>ecompsdkos/ecomp-sdk</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>policy</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>oparent</module>
+ <module>ecompsdkos/ecomp-sdk</module>
+ <module>policy</module>
+ </modules>
+ </profile>
+ </profiles>
+ </project>
+
+
+
+**Step 3**. A pom such as the one below can be used to build the ONAP Policy Framework modules. Create the *pom.xml* file in the directory *~/git/onap/policy*
+
+.. code-block:: xml
+ :caption: Typical pom.xml to build the ONAP Policy Framework Policy Modules
+ :linenos:
+
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.onap</groupId>
+ <artifactId>onap-policy</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>${project.artifactId}</name>
+ <inceptionYear>2017</inceptionYear>
+ <organization>
+ <name>ONAP</name>
+ </organization>
+
+ <modules>
+ <module>common</module>
+ <module>engine</module>
+ <module>pdp</module>
+ <module>pap</module>
+ <module>drools-pdp</module>
+ <module>drools-applications</module>
+ <module>api</module>
+ <module>gui</module>
+ <module>docker</module>
+ </modules>
+ </project>
+
+**Step 4**. The build cannot currently find the *org.onap.oparent:version-check-maven-plugin* plugin so, for now, comment that plugin out in the POMs *policy/drools-pdp/pom.xml* and *policy/drools-applications/pom.xml*.
+
+**Step 5**. Build the ONAP dependencies that are required for the ONAP policy framework and which must be built first to be available to the ONAP Policy Framework proper.
+
+ * cd ~/git/onap
+ * mvn clean install -DpolicyDeps
+
+**Step 6**. You can now build the ONAP framework
+
+ * On *Ubuntu*, just build the Policy Framework tests and all
+
+ - cd ~/git/onap
+ - mvn clean install
+
+ * On *macOS*, you must build build the ONAP framework with tests turned off first. Then rebuild the framework with tests turned on and all tests will pass. Note: The reason for this behaviour will be explored later.
+
+ - cd ~/git/onap
+ - mvn clean install -DskipTests
+ - mvn install
+
+
+Building the ONAP Policy Framework Docker Images
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The instructions here are based on the instructions in the file *~/git/onap/policy/docker/README*.
+
+**Step 1.** Prepare the Docker packages. This will pull the installation zip files needed for building the policy-pe and policy-drools Docker images into the target directory. It will not actually build the docker images; the additional steps below must be followed to actually build the Docker images.
+
+ * cd ~/git/onap/policy/docker
+ * mvn prepare-package
+
+**Step 2**. Copy the files under *policy-pe* to *target/policy-pe*.
+
+ * cp policy-pe/* target/policy-pe
+
+**Step 3**. Copy the files under *policy-drools* to *target/policy-drools*.
+
+ * cp policy-drools/* target/policy-drools
+
+**Step 4**. Run the *docker build* command on the following directories in the order below.
+Note that on some systems you may have to run the *docker* command as root or using *sudo*.
+
+ * docker build -t onap/policy/policy-os policy-os
+ * docker build -t onap/policy/policy-db policy-db
+ * docker build -t onap/policy/policy-nexus policy-nexus
+ * docker build -t onap/policy/policy-base policy-base
+ * docker build -t onap/policy/policy-pe target/policy-pe
+ * docker build -t onap/policy/policy-drools target/policy-drools
+
+Starting the ONAP Policy Framework Docker Images
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+In order to run the containers, you can use *docker-compose*. This uses the *docker-compose.yml* yaml file to bring up the ONAP Policy Framework.
+
+**Step 1.** Make the file *config/drools/drools-tweaks.sh* executable
+
+ * chmod +x config/drools/drools-tweaks.sh
+
+**Step 2**. Set the IP address to use to be an IP address of a suitable interface on your machine. Save the IP address into the file *config/pe/ip_addr.txt*.
+
+**Step 3**. Set the environment variable *MTU* to be a suitable MTU size for the application.
+
+ * export MTU=9126
+
+**Step 4**. Run the system using *docker-compose*. Note that on some systems you may have to run the *docker-compose* command as root or using *sudo*. Note that this command takes a number of minutes to execute on a laptop or desktop computer.
+
+ * docker-compose up
+
+
+Installation Complete
+^^^^^^^^^^^^^^^^^^^^^
+
+**You now have a full standalone ONAP Policy framework up and running!**
+
+
+.. _Standalone Quick Start : https://wiki.onap.org/display/DW/ONAP+Policy+Framework%3A+Standalone+Quick+Start
+
+
diff --git a/docs/platform/offeredapis.rst b/docs/platform/offeredapis.rst
new file mode 100644
index 000000000..8d4cfebd1
--- /dev/null
+++ b/docs/platform/offeredapis.rst
@@ -0,0 +1,49 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+
+
+Offered APIs
+============
+
+.. contents::
+ :depth: 2
+
+The Policy subsystem of ONAP maintains, distributes, and operates on the set of rules that underlie ONAP’s control, orchestration, and management functions. Policy provides a centralized environment for the creation and management of easily-updatable conditional rules. It enables users to validate policies and rules, identify and resolve overlaps and conflicts, and derive additional policies where needed. The following operations are supported by the policy API:
+
+* Create policies on the PAP
+* Update policies on the PAP
+* Delete policies on the PAP or PDP
+* Push policies from the PAP to the PDP
+* List policies on the PDP
+* Get config data of policies on the PDP
+* Create Dictionary Items
+* Update Dictionary Items
+* Retrieve Dictionary Items
+* Import Micro Services Models
+* Retrieve Metrics for policy counts from PDP and PAP
+
+
+POLICY Engine Services
+^^^^^^^^^^^^^^^^^^^^^^
+
+.. image:: PolicyEngineApiList.png
+
+POLICY API Details
+^^^^^^^^^^^^^^^^^^
+
+.. swaggerv2doc:: api-docs.json
+
+
+Additional Information
+^^^^^^^^^^^^^^^^^^^^^^
+
+Additional information, including examples, can be found at `PolicyApi link`_.
+
+.. _PolicyApi link: https://wiki.onap.org/display/DW/Policy+API
+
+
+
+
+
+End of document
+
diff --git a/docs/platform/policygui.rst b/docs/platform/policygui.rst
new file mode 100644
index 000000000..dbfb2740b
--- /dev/null
+++ b/docs/platform/policygui.rst
@@ -0,0 +1,136 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+.. http://creativecommons.org/licenses/by/4.0
+
+**********
+Policy GUI
+**********
+
+.. contents::
+ :depth: 3
+
+| The POLICY GUI is a graphical user interface, available via web-access, for **creating and managing** policies.
+|
+| The targeted users are those responsible for creating and managing policies that control network operations, including policy based network configuration and auto-corrective actions. This typically includes network and service designers, operations engineers and security experts.
+|
+| The GUI consists of the **Editor, Dictionary, PDP, Push, Roles, Admin** and **Dashboard** Tabs; which provide for an intuitive manner for policy rules to be created, changed, and managed.
+
+
+Access to the POLICY GUI
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+The POLICY GUI can be accessed via the ONAP Portal.
+
+.. image:: PolicyGUI_Access.png
+
+
+POLICY Editor
+^^^^^^^^^^^^^
+
+The POLICY **Editor** tab supports the following **key** functionality:
+
+• Create Policies and Scopes
+• Edit, View and Describe Policies
+• Rename, Move and Clone Policies
+• Switch Versions of Policies
+• Delete Policies and Scopes
+• List Policies and Scopes
+• Export and Import Policies
+• Search for Policies
+
+.. image:: PolicyGUI_Editor.png
+
+
+Scope Management
+----------------
+
+A Scope must exist before a policy can be created. The figure below shows how to add and manage Scopes.
+
+.. image:: PolicyGUI_Editor_Scope.png
+
+
+Policy Creation
+---------------
+
+The most important function of the GUI is to facilitate the creation of policies.
+The figure below specifies how a policy can be created.
+
+.. image:: PolicyGUI_Editor_CreatePolicy.png
+
+
+Managing a Policy
+-----------------
+
+The GUI provides actions (Edit, Clone, Move, Rename, Describe, View etc) to support maintaining
+the policy after it has been created. The figure below specifies how to initiate an action.
+
+.. image:: PolicyGUI_Editor_PolicyActions.png
+
+
+The next step of the selected action is shown below.
+
+.. image:: PolicyGUI_Editor_PolicyActionsDetail.png
+
+|
+
+POLICY Dictionary
+^^^^^^^^^^^^^^^^^
+
+| The POLICY **Dictionary** tab is used to create and manage attributes in the dictionaries.
+| Each policy type has one or more dictionaries associated with it. Policy writers have the ability to easily define and add attributes into the dictionary as shown below.
+
+.. image:: PolicyGUI_Dictionary.png
+
+|
+
+POLICY PDP
+^^^^^^^^^^
+
+| The POLICY **PDP** tab is used to manage **PDP Groups** and **PDPs in the group**.
+| This tab provides the capability to create, edit and delete PDP groups and associated PDPs. This tab also provides the ability to check status and view policies in a PDP groups.
+
+.. image:: PolicyGUI_PDP.png
+
+|
+
+POLICY Push
+^^^^^^^^^^^
+
+| The POLICY **Push** tab allows policies to be selectively pushed to the all PDPs.
+| Once pushed, the policies can be seen on the PDP tab. A Status of the PDPs indicate “UP-TO-DATE” if the policy has been pushed correctly. A Status of “LAST-UPDATE-FAILED” indicates an error occurred in pushing the policies.
+
+.. image:: PolicyGUI_Push.png
+
+|
+
+POLICY Dashboard
+^^^^^^^^^^^^^^^^
+
+| The POLICY **Dashboard** shows the **status** and **health** of the system through metrics logs and status update messages. The dashboard consists of two tabs, a **Logging** tab and a **Health** tab.
+
+.. image:: PolicyGUI_Dashboard.png
+
+|
+
+POLICY Admin
+^^^^^^^^^^^^
+
+| The POLICY **Admin** tab houses functionality that is performed by an administrator.
+| Only super users have access to the Admin Tab. The Lockdown feature is accessed from this tab.
+
+.. image:: PolicyGUI_Admin.png
+
+|
+
+POLICY Roles
+^^^^^^^^^^^^
+
+| The POLICY **Roles** tab allows system administrators to assign roles for system access.
+| The GUI options vary depending on the role.
+
+.. image:: PolicyGUI_Roles.png
+
+|
+
+
+
+End of Document
diff --git a/docs/release-notes/bug-fixes.rst b/docs/release-notes/bug-fixes.rst
new file mode 100644
index 000000000..24ec32c42
--- /dev/null
+++ b/docs/release-notes/bug-fixes.rst
@@ -0,0 +1,86 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+Bug Fixes
+---------
+
+ONAP POLICY Framework items for: (Last Updated: 10/23/2017)
+
+* **Version**: Amsterdam Release
+* **Release Date**: 02 November, 2017
+* **Description**: R1
+
+Bug
+^^^
+
+ * [POLICY-12] - Clean up warnings in drools-pdp project
+ * [POLICY-14] - Fix docker-compose to use onap/* instead of openecomp/*
+ * [POLICY-15] - 1.1.0-SNAPSHOT bring up issues
+ * [POLICY-16] - correct problems introduced by swagger addition to pdp-d
+ * [POLICY-19] - PDP-X getConfig API Authentication error
+ * [POLICY-20] - PDP-X getConfig - Configuration Policy not found
+ * [POLICY-21] - PDP-D occasionally stuck during shutdown
+ * [POLICY-23] - PDP-X getConfig issues
+ * [POLICY-24] - PDP-X pushPolicy problems
+ * [POLICY-27] - excessive long idle timeouts in DB introduced unnecessarily
+ * [POLICY-29] - BRMS GW - client configuration
+ * [POLICY-74] - policy-engine build failure
+ * [POLICY-75] - KieScanner repeatedly updating Drools container
+ * [POLICY-84] - Query Name validation before execution
+ * [POLICY-91] - drools-applications - vFW/vDNS dependencies issues
+ * [POLICY-92] - brmsgw - vFW/vDNS dependency rename issue
+ * [POLICY-94] - Health check failure in R1.1.0 in DFW on Rackspace
+ * [POLICY-134] - PolicyLogger.info(Object arg0) executes recursively causing stack overflow error.
+ * [POLICY-144] - PAP: console: browser access: 500 code
+ * [POLICY-145] - Healthcheck functionality not working
+ * [POLICY-146] - brmsgw: vFW/vDNS rules jars not generated
+ * [POLICY-165] - Support Backward compatibility for the Policy Interface
+ * [POLICY-170] - policy build by vagrant fails
+ * [POLICY-175] - 0% Code Coverage in some projects
+ * [POLICY-191] - PDP-D: Enhancement: feature session-persistence
+ * [POLICY-192] - verify and/or merge job hang running JUnit test
+ * [POLICY-194] - policy/drools-applications: fix template to enable JUnits
+ * [POLICY-195] - policy/drools-pdp/session-persistence: remove new sonar blocker and criticals
+ * [POLICY-197] - drools-applications: logger change breaks junit on drl template
+ * [POLICY-199] - Policy UI page displays blank in ONAP
+ * [POLICY-203] - Test case testGetPropertiesValue fails if we run test case or build code other than C:
+ * [POLICY-205] - policy/engine: missing license files
+ * [POLICY-206] - Missing license for drools-applications
+ * [POLICY-211] - Policy Fails Robot Health Check
+ * [POLICY-213] - remove sonar blocker/criticals introduced by feature-test-transaction
+ * [POLICY-221] - Policy GUI Cosmetic Issues
+ * [POLICY-223] - PDP Health Check Fail
+ * [POLICY-229] - Policy healthcheck failure in RS ORD ONAP 1.1.0
+ * [POLICY-234] - PDP-D: drools session remains hung on an update
+ * [POLICY-275] - pdp-x: automated pushing of policies shows that some operations failed
+ * [POLICY-276] - brmsgw: not generating amsterdam rules jar
+ * [POLICY-278] - console: sql injection protection not working properly
+ * [POLICY-295] - brmsgw: amsterdam controller rules generation cannot be built
+ * [POLICY-296] - pdp-d guard db access causes control loop failures
+ * [POLICY-298] - pdp-d: drl template drops messages in clean up rules
+ * [POLICY-299] - Policy CSIT tests are running over 15 hours long
+ * [POLICY-300] - Use correct format for messages from Policy to APPC_LCM_READ
+ * [POLICY-301] - DB sessionpersistence.sessioninfo to mediumblob
+ * [POLICY-302] - brmsgw: set up rules should not be generated
+ * [POLICY-305] - Policy Guard Deny response
+ * [POLICY-306] - vDNS yaml that is pushed should contain "SO" as actor not "MSO"
+ * [POLICY-310] - Policy GUI Fixes
+ * [POLICY-313] - Update MicroService vCPE Config Policy with new values
+ * [POLICY-314] - pdp-d: better handling of unsuccessful AAI responses
+ * [POLICY-315] - Change back docker compose version to 2 from 3
+ * [POLICY-339] - pdp-d apps aai vdns : update aai interface from v8 to v11
+ * [POLICY-340] - console: upgrade to latest portal sdk
+ * [POLICY-341] - pdp-d apps vfw: subsequent onsets on same resource not discarded
+ * [POLICY-342] - docker push-policies : config and operational policies must use the same control loop name
+ * [POLICY-343] - console: displaying corporate logo
+ * [POLICY-344] - Operations History Persistence Unit Not Found
+ * [POLICY-345] - Operations History Table is not written to
+ * [POLICY-350] - pdp-d apps drl: resiliency to exceptions and null values returned/thrown from java models
+ * [POLICY-353] - Bug in UebTopicSinkFactory
+ * [POLICY-354] - Update the latest Portal Properties
+ * [POLICY-356] - pdp-d apps: print networked messages over http interface
+ * [POLICY-357] - pdp-d db-migrator when ALL dbs flag is used upgrade not working properly
+ * [POLICY-363] - docker pdp-d: set DCAE DMaaP Server default to vm1.mr.simpledemo.openecomp.org
+ * [POLICY-364] - Policy template should not reject Event if A&AI lookup fails.
+
+
+
diff --git a/docs/release-notes/deprecation-notes.rst b/docs/release-notes/deprecation-notes.rst
new file mode 100644
index 000000000..e954e8764
--- /dev/null
+++ b/docs/release-notes/deprecation-notes.rst
@@ -0,0 +1,5 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+Deprecation Notes
+-----------------
+
diff --git a/docs/release-notes/index.rst b/docs/release-notes/index.rst
new file mode 100644
index 000000000..0ac56af2f
--- /dev/null
+++ b/docs/release-notes/index.rst
@@ -0,0 +1,11 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+Release Notes
+=============
+
+.. toctree::
+ :maxdepth: 1
+
+ new-features.rst
+ bug-fixes.rst
+ known-issues.rst
diff --git a/docs/release-notes/known-issues.rst b/docs/release-notes/known-issues.rst
new file mode 100644
index 000000000..b4ee9540c
--- /dev/null
+++ b/docs/release-notes/known-issues.rst
@@ -0,0 +1,17 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+Known Issues
+------------
+
+ONAP POLICY Framework items for: (Last Updated: 10/10/2017)
+
+* **Version**: Amsterdam Release
+* **Release Date**: 02 November, 2017
+* **Description**: R1
+
+Issues
+^^^^^^
+
+* No known issues at this time
+
+
diff --git a/docs/release-notes/new-features.rst b/docs/release-notes/new-features.rst
new file mode 100644
index 000000000..e72f9262c
--- /dev/null
+++ b/docs/release-notes/new-features.rst
@@ -0,0 +1,140 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+New Features
+------------
+
+ONAP POLICY Framework items for: (Last Updated: 10/23/2017)
+
+* **Version**: Amsterdam Release
+* **Release Date**: 02 November, 2017
+* **Description**: R1
+
+.. contents::
+ :depth: 2
+
+Epic
+^^^^
+
+ * [POLICY-31] - Stabilization of Seed Code
+ * [POLICY-33] - This epic covers the body of work involved in deploying the Policy Platform components
+ * [POLICY-34] - This epic covers the work required to support a Policy developer environment in which Policy Developers can create, update policy templates/rules separate from the policy Platform runtime platform.
+ * [POLICY-35] - This epic covers the body of work involved in supporting policy that is platform specific.
+ * [POLICY-37] - This epic covers the work required to capture, update, extend Policy(s) during Service Design.
+ * [POLICY-39] - This epic covers the work required to support the Policy Platform during runtime.
+ * [POLICY-76] - This epic covers the body of work involved in supporting R1 Amsterdam Milestone Release Planning Milestone Tasks.
+
+Story
+^^^^^
+
+ * [POLICY-25] - Replace any remaining openecomp reference by onap
+ * [POLICY-32] - JUnit test code coverage
+ * [POLICY-40] - MSB Integration
+ * [POLICY-41] - OOM Integration
+ * [POLICY-43] - Amsterdam Use Case Template
+ * [POLICY-48] - CLAMP Configuration and Operation Policies for vCPE Use Case
+ * [POLICY-51] - Runtime Policy Update Support
+ * [POLICY-57] - VF-C Actor code development
+ * [POLICY-59] - vCPE Use Case - Runtime
+ * [POLICY-60] - VOLTE Use Case - Runtime
+ * [POLICY-61] - vFW Use Case - Runtime
+ * [POLICY-62] - vDNS Use Case - Runtime
+ * [POLICY-63] - CLAMP Configuration and Operation Policies for VOLTE Use Case
+ * [POLICY-64] - CLAMP Configuration and Operation Policies for vFW Use Case
+ * [POLICY-65] - CLAMP Configuration and Operation Policies for vDNS Use Case
+ * [POLICY-66] - PDP-D Feature mechanism enhancements
+ * [POLICY-67] - Rainy Day Decision Policy
+ * [POLICY-68] - TOSCA Parsing for nested objects for Microservice Policies
+ * [POLICY-77] - Functional Test case definition for Control Loops
+ * [POLICY-93] - Notification API
+ * [POLICY-119] - PDP-D: noop sinks
+ * [POLICY-121] - Update POM to inherit from oparent
+ * [POLICY-124] - Integration with oparent
+ * [POLICY-158] - policy/engine: SQL injection Mitigation
+ * [POLICY-161] - Security Event Logging
+ * [POLICY-173] - Deployment of Operational Policies Documentation
+ * [POLICY-210] - Independent Versioning and Release Process
+ * [POLICY-316] - vCPE Use Case - Runtime Testing
+ * [POLICY-320] - VOLTE Use Case - Runtime Testing
+ * [POLICY-324] - vFW Use Case - Runtime Testing
+ * [POLICY-328] - vDNS Use Case - Runtime Testing
+
+
+Task
+^^^^
+
+ * [POLICY-3] - Add appropriate unit tests back into the distribution
+ * [POLICY-6] - Updates to License and Trademark in the Policy Source Code
+ * [POLICY-8] - Fix PDP-D Sonar Blocker Issues
+ * [POLICY-11] - Enhancements to extract fact information for a given Drools Application
+ * [POLICY-17] - Removal of ECOMP-SDK-APP dbscripts
+ * [POLICY-18] - Enhancement: Add additional feature hooks in Drools PDP
+ * [POLICY-22] - drools-applications reorganization and template upgrade
+ * [POLICY-26] - PDP-D Telemetry REST CLI
+ * [POLICY-30] - PDP-D Logging Enhancements
+ * [POLICY-53] - Update drools-application docker scripts to find reorganized pom changes
+ * [POLICY-54] - POLICY-54 Add HTTP Proxy Support to docker image builds
+ * [POLICY-55] - Ensure drools-application JUnit test works on ONAP JJB using in memory database
+ * [POLICY-58] - Update Policy Engine dependencies and use case policies to support the latest drools-application code
+ * [POLICY-70] - Add vagrant functionality to build/setup policy
+ * [POLICY-78] - Update Drools version to 6.5.0.Final
+ * [POLICY-80] - Policy Guard
+ * [POLICY-87] - Implement Recommended Fix for Portal
+ * [POLICY-88] - Delete the yaml sdk and sdc projects located in policy/engine
+ * [POLICY-95] - Fix policy/commons sonar blocker issues with exception of integrity-monitor/audit
+ * [POLICY-96] - Fix policy/common integrity-[monitor/audit] sonar blockers
+ * [POLICY-97] - Fix policy/engine sonar blockers
+ * [POLICY-98] - policy/commons critical sonar issues - NON integrity/monitor related
+ * [POLICY-100] - fix policy/common critical sonar items - integrity monitor/audit related
+ * [POLICY-105] - Common-Modules changes to RefreshStateAudit
+ * [POLICY-111] - policy/drools-applications: sonar blockers
+ * [POLICY-113] - policy/engine: sonar critical
+ * [POLICY-114] - policy/drools-pdp: sonar critical
+ * [POLICY-115] - policy/drools-application: sonar critical
+ * [POLICY-116] - Remove MojoHaus Maven plug-in from pom file
+ * [POLICY-117] - Resolve Policy Sonar Critical issues
+ * [POLICY-122] - Policy GUI Fixes for Dictionary and Dashboard tabs
+ * [POLICY-125] - Update Project FOSS Table
+ * [POLICY-126] - Identify and outline the set of documentations to be delivered in this Release
+ * [POLICY-133] - Addition of policy-persistence feature
+ * [POLICY-154] - policy/engine finish eclipse warnings for unused imports/variables
+ * [POLICY-155] - Addition of state-management feature
+ * [POLICY-156] - Addition of active-standby-management feature
+ * [POLICY-163] - Add 'install' and 'uninstall' option to DroolsPDP 'features' script
+ * [POLICY-167] - Clean additional pom warnings policy/engine
+ * [POLICY-168] - Clean pom warnings policy/drools-applications
+ * [POLICY-171] - Update policy/docker README to reflect current project paths
+ * [POLICY-176] - policy/drools-applications: convert System.out, System.err to use slf4j/logback
+ * [POLICY-177] - test-transaction feature to check on the healthiness of policy controllers
+ * [POLICY-178] - policy/common: convert integrity monitor to use slf4j/logback as in drools-pdp
+ * [POLICY-180] - Upgrade policy/engine release build to use more memory
+ * [POLICY-181] - Policy/common change jenkins job to not ignore JUnit tests for verify job.
+ * [POLICY-193] - Created a new cleanup process
+ * [POLICY-196] - Enhancement on MS JSON File
+ * [POLICY-218] - LF Open Source License Issues
+ * [POLICY-228] - Create common object to consolidate AAI response
+ * [POLICY-231] - Remove Binary files from Policy Repo
+ * [POLICY-237] - Address remaining sonar/critical for policy/common
+ * [POLICY-239] - Address sonar major issues
+ * [POLICY-247] - Modify docker push-policies to push the Amsterdam Template and latest policies
+ * [POLICY-253] - Modify policy/engine pom.xml to remove sonar scan on 3rd party code.
+ * [POLICY-261] - policy/drools-pdp last remaining sonar critical
+ * [POLICY-266] - feature-state-management JUnit coverage
+ * [POLICY-273] - Revert the SDK properties from onap to ecomp
+ * [POLICY-274] - .gitignore policy/engine directories/files created after running mvn clean install or mvn test
+ * [POLICY-297] - policy/drools-applications stage-site build is failing due to heap space
+ * [POLICY-304] - Add ability for Docker scripts to NOT pre-load policies for testing
+ * [POLICY-307] - Delete the pre-Amsterdam policy template etc.
+ * [POLICY-312] - Change Policy CSIT Integration Tests to utilize the PRELOAD_POLICIES=false
+ * [POLICY-335] - Add more documentation details
+ * [POLICY-337] - Update CSIT Integration Tests with latest Config/Operational Policies
+ * [POLICY-355] - Exclude dependencies for mysql and iText
+
+
+Additional Information
+^^^^^^^^^^^^^^^^^^^^^^
+
+Latest details for Policy Framework Amsterdam Release can be found at `PolicyReleaseNotes`_.
+
+.. _PolicyReleaseNotes: https://jira.onap.org/secure/ReleaseNote.jspa?projectId=10106&version=10300
+
+
diff --git a/docs/release-notes/other.rst b/docs/release-notes/other.rst
new file mode 100644
index 000000000..2ce683b5b
--- /dev/null
+++ b/docs/release-notes/other.rst
@@ -0,0 +1,5 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+Other
+-----
+
diff --git a/docs/release-notes/security-issues.rst b/docs/release-notes/security-issues.rst
new file mode 100644
index 000000000..96e1fe95e
--- /dev/null
+++ b/docs/release-notes/security-issues.rst
@@ -0,0 +1,5 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+Security Issues
+---------------
+
diff --git a/docs/release-notes/upgrade-notes.rst b/docs/release-notes/upgrade-notes.rst
new file mode 100644
index 000000000..f31c74a69
--- /dev/null
+++ b/docs/release-notes/upgrade-notes.rst
@@ -0,0 +1,5 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+
+Upgrade Notes
+-------------
+
diff --git a/packages/base/src/files/install/mysql/data/161000_upgrade_script.sql b/packages/base/src/files/install/mysql/data/161000_upgrade_script.sql
index 70dae61f1..4c64c6420 100755
--- a/packages/base/src/files/install/mysql/data/161000_upgrade_script.sql
+++ b/packages/base/src/files/install/mysql/data/161000_upgrade_script.sql
@@ -6361,20 +6361,6 @@ INSERT INTO `microservicelocation` VALUES (1,'SampleServiceLocation','demo');
INSERT INTO `risktype` VALUES (1,'demo','2016-12-29 20:20:48','demo','SampleRiskType','demo','2016-12-29 20:20:48');
-INSERT INTO `brmsparamtemplate` VALUES (2,'ControlLoopDemo__closedLoopControlName','ControlLoopDemo__closedLoopControlName','\r\n\r\n/*-\n * ============LICENSE_START=======================================================\n * archetype-closed-loop-demo-rules\n * ================================================================================\n * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ============LICENSE_END=========================================================\n */\n\npackage org.onap.policy.controlloop;\n\nimport java.util.List;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.HashMap;\nimport java.util.UUID;\n\nimport org.onap.policy.controlloop.VirtualControlLoopEvent;\nimport org.onap.policy.controlloop.ControlLoopEventStatus;\nimport org.onap.policy.controlloop.VirtualControlLoopNotification;\nimport org.onap.policy.controlloop.ControlLoopNotificationType;\nimport org.onap.policy.controlloop.ControlLoopOperation;\nimport org.onap.policy.controlloop.ControlLoopOperationWrapper;\nimport org.onap.policy.template.demo.ControlLoopException;\n\nimport org.onap.policy.aai.AAINQF199.AAINQF199CloudRegion;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperties;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperty;\nimport org.onap.policy.aai.AAINQF199.AAINQF199GenericVNF;\nimport org.onap.policy.aai.AAINQF199.AAINQF199InstanceFilters;\nimport org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;\nimport org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItems;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Manager;\nimport org.onap.policy.aai.AAINQF199.AAINQF199NamedQuery;\nimport org.onap.policy.aai.AAINQF199.AAINQF199QueryParameters;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Request;\nimport org.onap.policy.aai.AAINQF199.AAINQF199RequestWrapper;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Response;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ResponseWrapper;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ServiceInstance;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Tenant;\nimport org.onap.policy.aai.AAINQF199.AAINQF199VfModule;\nimport org.onap.policy.aai.AAINQF199.AAINQF199VServer;\nimport org.onap.policy.aai.util.Serialization;\n\nimport org.onap.policy.appc.CommonHeader;\nimport org.onap.policy.appc.Request;\nimport org.onap.policy.appc.Response;\nimport org.onap.policy.appc.ResponseCode;\nimport org.onap.policy.appc.ResponseStatus;\nimport org.onap.policy.appc.ResponseValue;\n\nimport org.onap.policy.template.demo.EventManager;\nimport org.onap.policy.vnf.trafficgenerator.PGRequest;\nimport org.onap.policy.vnf.trafficgenerator.PGStream;\nimport org.onap.policy.vnf.trafficgenerator.PGStreams;\n\nimport org.onap.policy.mso.MSOManager;\nimport org.onap.policy.mso.MSORequest;\nimport org.onap.policy.mso.MSORequestStatus;\nimport org.onap.policy.mso.MSORequestDetails;\nimport org.onap.policy.mso.MSOModelInfo;\nimport org.onap.policy.mso.MSOCloudConfiguration;\nimport org.onap.policy.mso.MSORequestInfo;\nimport org.onap.policy.mso.MSORequestParameters;\nimport org.onap.policy.mso.MSORelatedInstanceListElement;\nimport org.onap.policy.mso.MSORelatedInstance;\nimport org.onap.policy.mso.MSOResponse;\n\nimport org.onap.policy.drools.system.PolicyEngine;\n\n//\n// These parameters are required to build the runtime policy\n//\ndeclare Params\n closedLoopControlName : String\n actor : String\n aaiURL : String\n aaiUsername : String\n aaiPassword : String\n msoURL : String\n msoUsername : String\n msoPassword : String\n aaiNamedQueryUUID : String\n aaiPatternMatch : int \n notificationTopic : String\n appcTopic : String\nend\n\n/*\n*\n* Called once and only once to insert the parameters into working memory for this Closed Loop policy.\n* (Comment SETUP rule out for the first ONAP opensource release since policy BRMS_GW already puts a Params fact in there)\n*\n*\n*rule \"${policyName}.SETUP\"\n* when\n* then\n* System.out.println(\"rule SETUP is triggered.\");\n* Params params = new Params();\n* params.setClosedLoopControlName(\"${closedLoopControlName}\");\n* params.setActor(\"${actor}\");\n* params.setAaiURL(\"${aaiURL}\");\n* params.setAaiUsername(\"${aaiUsername}\");\n* params.setAaiPassword(\"${aaiPassword}\");\n* params.setMsoURL(\"${msoURL}\");\n* params.setMsoUsername(\"${msoUsername}\");\n* params.setMsoPassword(\"${msoPassword}\");\n* params.setAaiNamedQueryUUID(\"${aaiNamedQueryUUID}\");\n* params.setAaiPatternMatch(${aaiPatternMatch});\n* params.setNotificationTopic(\"${notificationTopic}\");\n* params.setAppcTopic(\"${appcTopic}\");\n* //\n* // This stays in memory as long as the rule is alive and running\n* //\n* insert(params);\n*end\n*/\n/*\n*\n* This rule responds to DCAE Events\n*\n*/\nrule \"${policyName}.EVENT\"\n when\n $params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n not ( EventManager( closedLoopControlName == $event.closedLoopControlName ))\n then\n System.out.println(\"rule EVENT is triggered.\");\n try {\n // \n // Check the requestID in the event to make sure it is not null before we create the EventManager. \n // The EventManager will do extra syntax checking as well check if the closed loop is disabled/\n //\n if ($event.requestID == null) {\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.REJECTED;\n notification.from = \"policy\";\n notification.message = \"Missing requestID from DCAE event\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"${policyScope}\";\n notification.policyVersion = \"${policyVersion}\";\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver notification: \" + notification);\n }\n //\n // Retract it from memory\n //\n retract($event);\n System.out.println(\"Event with requestID=null has been retracted.\");\n } else {\n //\n // Create an EventManager\n //\n EventManager manager = new EventManager($params.getClosedLoopControlName(), $event.requestID, $event.target);\n //\n // Determine if EventManager can actively process the event (i.e. syntax)\n //\n VirtualControlLoopNotification notification = manager.activate($event);\n notification.from = \"policy\"; \n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"${policyScope}\";\n notification.policyVersion = \"${policyVersion}\";\n //\n // Are we actively pursuing this event?\n //\n if (notification.notification == ControlLoopNotificationType.ACTIVE) {\n //\n // Insert Event Manager into memory, this will now kick off processing.\n //\n insert(manager);\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver notification: \" + notification);\n } \n } else {\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver notification: \" + notification);\n }\n //\n // Retract it from memory\n //\n retract($event);\n }\n //\n // Now that the manager is inserted into Drools working memory, we\'ll wait for\n // another rule to fire in order to continue processing. This way we can also\n // then screen for additional ONSET and ABATED events for this same RequestIDs \n // and for different RequestIDs but with the same closedLoopControlName and target.\n //\n }\n //\n } catch (Exception e) {\n e.printStackTrace();\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.REJECTED;\n notification.message = \"Exception occurred \" + e.getMessage();\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"${policyScope}\";\n notification.policyVersion = \"${policyVersion}\";\n //\n //\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e1) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e1.printStackTrace();\n }\n //\n // Retract the event\n //\n retract($event);\n }\nend\n\n/*\n*\n* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager\n* is created. We can start the operations for this closed loop.\n*\n*/\nrule \"${policyName}.EVENT.MANAGER\"\n when\n $params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName, controlLoopResult == null)\n then\n System.out.println(\"rule EVENT.MANAGER is triggered.\");\n //\n // Check which event this is.\n //\n EventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);\n //\n // We only want the initial ONSET event in memory,\n // all the other events need to be retracted to support\n // cleanup and avoid the other rules being fired for this event.\n //\n if (eventStatus != EventManager.NEW_EVENT_STATUS.FIRST_ONSET) {\n System.out.println(\"Retracting \"+eventStatus+\" Event.\");\n retract($event);\n return;\n }\n //\n // Now the event in memory is first onset event\n //\n try {\n //\n // Pull the known AAI field from the Event\n //\n // generic-vnf is needed for vFirewall case\n // vserver-name is needed for vLoadBalancer case\n //\n String genericVNF = $event.AAI.get(\"generic-vnf.vnf-id\");\n String vserver = $event.AAI.get(\"vserver.vserver-name\");\n //\n // Check if we are implementing a simple pattern match.\n //\n if ($params.getAaiPatternMatch() == 1) {\n //\n // Yes\n //\n //Basic naming characteristics:\n //VF Name (9 char)+VM name (13 char total)+VFC (19 char total)\n //Example: \n //VF Name (9 characters): cscf0001v\n //VM Name(13 characters): cscf0001vm001\n //VFC name(19 characters): cscf0001vm001cfg001\n //\n // zdfw1fwl01fwl02 or zdfw1fwl01fwl01 \n // replaced with\n // zdfw1fwl01pgn02 or zdfw1fwl01pgn01\n //\n int index = genericVNF.lastIndexOf(\"fwl\");\n if (index == -1) {\n System.err.println(\"The generic-vnf.vnf-id from DCAE Event is not valid.\");\n } else {\n genericVNF = genericVNF.substring(0, index) + \"pgn\" + genericVNF.substring(index+\"fwl\".length());\n }\n //\n // Construct an APPC request\n //\n ControlLoopOperation operation = new ControlLoopOperation();\n operation.actor = $params.getActor();\n operation.operation = \"ModifyConfig\";\n operation.target = $event.target;\n //\n // Create operationWrapper\n //\n ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\n //\n // insert operationWrapper into memory\n //\n insert(operationWrapper);\n //\n Request request = new Request();\n request.CommonHeader = new CommonHeader();\n request.CommonHeader.RequestID = $event.requestID;\n request.Action = operation.operation;\n request.Payload = new HashMap<String, Object>();\n //\n // Fill in the payload\n //\n request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\n //\n PGRequest pgRequest = new PGRequest();\n pgRequest.pgStreams = new PGStreams();\n \n PGStream pgStream;\n for(int i = 0; i < 5; i++){\n pgStream = new PGStream();\n pgStream.streamId = \"fw_udp\"+(i+1);\n pgStream.isEnabled = \"true\";\n pgRequest.pgStreams.pgStream.add(pgStream);\n }\n request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\n \n if (request != null) {\n //\n // Insert request into memory\n //\n insert(request);\n //\n // Tell interested parties we are performing this Operation\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.OPERATION;\n // message and history ??\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"${policyScope}\";\n notification.policyVersion = \"${policyVersion}\";\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Now send the operation request\n //\n if (request instanceof Request) {\n try {\n System.out.println(\"APPC request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(request));\n PolicyEngine.manager.deliver($params.getAppcTopic(), request);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver request: \" + request);\n }\n }\n } else {\n //\n // what happens if it is null\n //\n }\n //\n } else {\n //\n // create AAI named-query request with UUID started with \"F199\"\n //\n AAINQF199Request aainqf199request = new AAINQF199Request();\n AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();\n AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();\n AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();\n //\n // queryParameters\n //\n aainqf199namedquery.namedQueryUUID = UUID.fromString($params.getAaiNamedQueryUUID()); \n aainqf199queryparam.namedQuery = aainqf199namedquery;\n aainqf199request.queryParameters = aainqf199queryparam;\n //\n // instanceFilters\n //\n Map aainqf199instancefiltermap = new HashMap();\n Map aainqf199instancefiltermapitem = new HashMap();\n aainqf199instancefiltermapitem.put(\"vserver-name\", vserver); \n aainqf199instancefiltermap.put(\"vserver\", aainqf199instancefiltermapitem);\n aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);\n aainqf199request.instanceFilters = aainqf199instancefilter;\n //\n // print aainqf199request for debug\n //\n System.out.println(\"AAI Request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(aainqf199request));\n //\n // Create AAINQF199RequestWrapper\n //\n AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper($event.requestID, aainqf199request);\n //\n // insert aainqf199request into memory\n //\n insert(aainqf199RequestWrapper);\n }\n //\n } catch (Exception e) {\n e.printStackTrace();\n }\nend\n\n/*\n*\n* This rule happens when we got a valid ONSET, closed loop is enabled, an Event Manager\n* is created, AAI Manager and AAI Request are ready in memory. We can start sending query to AAI and then wait for response.\n*\n*/\nrule \"${policyName}.EVENT.MANAGER.AAINQF199REQUEST\"\n when\n $params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\n then\n System.out.println(\"rule EVENT.MANAGER.AAINQF199REQUEST is triggered.\");\n //\n // send the request\n //\n AAINQF199Response aainqf199response = AAINQF199Manager.postQuery($params.getAaiURL(), $params.getAaiUsername(), $params.getAaiPassword(),\n $aainqf199RequestWrapper.aainqf199request, $event.requestID);\n //\n // Check AAI response\n //\n if (aainqf199response == null) {\n System.err.println(\"Failed to get AAI response\");\n //\n // Fail and retract everything\n //\n retract($event);\n retract($manager);\n retract($aainqf199RequestWrapper);\n } else {\n //\n // Create AAINQF199ResponseWrapper\n //\n AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper($event.requestID, aainqf199response);\n //\n // insert aainqf199ResponseWrapper to memeory\n //\n insert(aainqf199ResponseWrapper);\n }\nend\n\n/*\n*\n* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.\n*\n*/\nrule \"${policyName}.EVENT.MANAGER.AAINQF199RESPONSE\"\n when \n $params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\n $aainqf199ResponseWrapper : AAINQF199ResponseWrapper(requestID == $event.requestID)\n then\n System.out.println(\"rule EVENT.MANAGER.AAINQF199RESPONSE is triggered.\");\n //\n // Extract related fields out of AAINQF199RESPONSE\n //\n String vnfItemVnfId, vnfItemVnfType, vnfItemPersonaModelId, vnfItemPersonaModelVersion, vnfItemModelName, \n vnfItemModelVersion, vnfItemModelNameVersionId, serviceItemServiceInstanceId, serviceItemPersonaModelId,\n serviceItemModelName, serviceItemModelType, serviceItemModelVersion, serviceItemModelNameVersionId,\n vfModuleItemVfModuleName, vfModuleItemPersonaModelId, vfModuleItemPersonaModelVersion, vfModuleItemModelName, \n vfModuleItemModelNameVersionId, tenantItemTenantId, cloudRegionItemCloudRegionId;\n try {\n //\n // vnfItem\n //\n vnfItemVnfId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID;\n vnfItemVnfType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType;\n vnfItemVnfType = vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf(\"/\")+1);\n vnfItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId;\n vnfItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion;\n vnfItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\n vnfItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue;\n vnfItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\n //\n // serviceItem\n //\n serviceItemServiceInstanceId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID;\n serviceItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId;\n serviceItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\n serviceItemModelType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue;\n serviceItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion;\n serviceItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\n //\n // Find the index for base vf module and non-base vf module\n //\n int baseIndex = -1;\n int nonBaseIndex = -1;\n List<AAINQF199InventoryResponseItem> inventoryItems = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems;\n for (AAINQF199InventoryResponseItem m : inventoryItems) {\n if (m.vfModule != null && m.vfModule.isBaseVfModule == true) {\n baseIndex = inventoryItems.indexOf(m);\n } else if (m.vfModule != null && m.vfModule.isBaseVfModule == false && m.vfModule.orchestrationStatus == null) {\n nonBaseIndex = inventoryItems.indexOf(m);\n }\n //\n if (baseIndex != -1 && nonBaseIndex != -1) {\n break;\n }\n }\n //\n // Report the error if either base vf module or non-base vf module is not found\n //\n if (baseIndex == -1 || nonBaseIndex == -1) {\n System.err.println(\"Either base or non-base vf module is not found from AAI response.\");\n retract($aainqf199RequestWrapper);\n retract($aainqf199ResponseWrapper);\n retract($manager);\n retract($event);\n return;\n }\n //\n // This comes from the base module\n //\n vfModuleItemVfModuleName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.vfModuleName;\n vfModuleItemVfModuleName = vfModuleItemVfModuleName.replace(\"Vfmodule\", \"vDNS\");\n //\n // vfModuleItem - NOT the base module\n //\n vfModuleItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelId;\n vfModuleItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelVersion;\n vfModuleItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(0).propertyValue;\n vfModuleItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue;\n //\n // tenantItem\n //\n tenantItemTenantId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId;\n //\n // cloudRegionItem\n //\n cloudRegionItemCloudRegionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;\n //\n } catch (Exception e) {\n e.printStackTrace();\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.REJECTED;\n notification.message = \"Exception occurred \" + e.getMessage();\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"${policyScope}\";\n notification.policyVersion = \"${policyVersion}\";\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e1) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e1.printStackTrace();\n }\n //\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n notification.message = \"Invalid named-query response from AAI\";\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e1) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e1.printStackTrace();\n }\n //\n // Retract everything\n //\n retract($aainqf199RequestWrapper);\n retract($aainqf199ResponseWrapper);\n retract($manager);\n retract($event);\n return;\n } \n //\n // Extracted fields should not be null\n //\n if ((vnfItemVnfId == null) || (vnfItemVnfType == null) ||\n (vnfItemPersonaModelId == null) || (vnfItemModelName == null) ||\n (vnfItemModelVersion == null) || (vnfItemModelNameVersionId == null) ||\n (serviceItemServiceInstanceId == null) || (serviceItemModelName == null) ||\n (serviceItemModelType == null) || (serviceItemModelVersion == null) ||\n (serviceItemModelNameVersionId == null) || (vfModuleItemVfModuleName == null) ||\n (vfModuleItemPersonaModelId == null) || (vfModuleItemPersonaModelVersion == null) ||\n (vfModuleItemModelName == null) || (vfModuleItemModelNameVersionId == null) ||\n (tenantItemTenantId == null) || (cloudRegionItemCloudRegionId == null)) {\n //\n System.err.println(\"some fields are missing from AAI response.\");\n //\n // Fail and retract everything\n //\n retract($aainqf199RequestWrapper);\n retract($aainqf199ResponseWrapper);\n retract($manager);\n retract($event);\n return;\n }\n //\n // We don\'t need them any more\n //\n retract($aainqf199ResponseWrapper);\n retract($aainqf199RequestWrapper); \n //\n // check the actor of this closed loop\n //\n switch ($params.getActor()) {\n case \"APPC\":\n {\n //\n // Construct an APPC request\n //\n ControlLoopOperation operation = new ControlLoopOperation();\n operation.actor = $params.getActor();\n operation.operation = \"ModifyConfig\";\n operation.target = $event.target;\n //\n // Create operationWrapper\n //\n ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\n //\n // insert operationWrapper into memory\n //\n insert(operationWrapper);\n //\n Request request = new Request();\n request.CommonHeader = new CommonHeader();\n request.CommonHeader.RequestID = $event.requestID;\n request.Action = operation.operation;\n request.Payload = new HashMap<String, Object>();\n //\n // Fill in the payload\n // Hardcode genericVNF for now since AAI has not been ready for vFirewall demo case\n //\n String genericVNF = \"zdfw1fwl01pgn02\";\n request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\n //\n PGRequest pgRequest = new PGRequest();\n pgRequest.pgStreams = new PGStreams();\n \n PGStream pgStream;\n for(int i = 0; i < 5; i++){\n pgStream = new PGStream();\n pgStream.streamId = \"fw_udp\"+(i+1);\n pgStream.isEnabled = \"true\";\n pgRequest.pgStreams.pgStream.add(pgStream);\n }\n request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\n \n if (request != null) {\n //\n // Insert request into memory\n //\n insert(request);\n //\n // Tell interested parties we are performing this Operation\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.OPERATION;\n // message and history ??\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"${policyScope}\";\n notification.policyVersion = \"${policyVersion}\";\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Now send the operation request\n //\n if (request instanceof Request) {\n try {\n System.out.println(\"APPC request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(request));\n PolicyEngine.manager.deliver($params.getAppcTopic(), request);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver request: \" + request);\n }\n }\n } else {\n //\n // what happens if it is null\n //\n }\n }\n break;\n case \"MSO\":\n {\n //\n // Construct an operation\n //\n ControlLoopOperation operation = new ControlLoopOperation();\n operation.actor = $params.getActor();\n operation.operation = \"createModuleInstance\";\n operation.target = $event.target;\n //\n // Create operationWrapper\n //\n ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\n //\n // Construct an MSO request\n //\n MSORequest request = new MSORequest();\n request.requestDetails = new MSORequestDetails();\n request.requestDetails.modelInfo = new MSOModelInfo();\n request.requestDetails.cloudConfiguration = new MSOCloudConfiguration();\n request.requestDetails.requestInfo = new MSORequestInfo();\n request.requestDetails.requestParameters = new MSORequestParameters();\n request.requestDetails.requestParameters.userParams = null;\n //\n // cloudConfiguration\n //\n request.requestDetails.cloudConfiguration.lcpCloudRegionId = cloudRegionItemCloudRegionId;\n request.requestDetails.cloudConfiguration.tenantId = tenantItemTenantId;\n //\n // modelInfo\n //\n request.requestDetails.modelInfo.modelType = \"vfModule\";\n request.requestDetails.modelInfo.modelInvariantId = vfModuleItemPersonaModelId;\n request.requestDetails.modelInfo.modelNameVersionId = vfModuleItemModelNameVersionId;\n request.requestDetails.modelInfo.modelName = vfModuleItemModelName;\n request.requestDetails.modelInfo.modelVersion = vfModuleItemPersonaModelVersion;\n //\n // requestInfo\n //\n request.requestDetails.requestInfo.instanceName = vfModuleItemVfModuleName;\n request.requestDetails.requestInfo.source = \"POLICY\";\n request.requestDetails.requestInfo.suppressRollback = false;\n //\n // relatedInstanceList\n //\n MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();\n MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();\n relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();\n relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();\n //\n relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;\n relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();\n relatedInstanceListElement1.relatedInstance.modelInfo.modelType = \"service\";\n relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;\n relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;\n relatedInstanceListElement1.relatedInstance.modelInfo.modelName = serviceItemModelName;\n relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;\n //\n relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;\n relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();\n relatedInstanceListElement2.relatedInstance.modelInfo.modelType = \"vnf\";\n relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelName = vnfItemModelName;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = vnfItemModelVersion;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = vnfItemVnfType;\n // \n request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);\n request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);\n //\n // print MSO request for debug\n //\n System.out.println(\"MSO request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(request));\n //\n //\n //\n if (request != null) {\n //\n // Tell interested parties we are performing this Operation\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.OPERATION;\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"${policyScope}\";\n notification.policyVersion = \"${policyVersion}\";\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL\n //\n String MSOUrl = $params.getMsoURL() + \"/serviceInstances/v2/\" + serviceItemServiceInstanceId + \"/vnfs/\" + vnfItemVnfId + \"/vfModules\";\n //\n // Call MSO\n //\n MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);\n //\n if (response != null) {\n //\n // Assign requestId\n //\n request.requestId = $event.requestID.toString(); \n response.request.requestId = $event.requestID.toString();\n //\n // Insert facts\n //\n insert(operationWrapper);\n insert(request);\n insert(response);\n } else {\n //\n // MSO request not even accepted\n //\n notification.message = operationWrapper.operation.toMessage();\n operationWrapper.operation.message = operationWrapper.operation.toMessage();\n operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n notification.history.add(operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Retract everything\n //\n retract($event);\n retract($manager);\n }\n } else {\n System.err.println(\"constructed MSO request is invalid.\");\n }\n }\n break; \n } \nend\n \n/*\n*\n* This rule responds to APPC Response Events\n*\n*/\nrule \"${policyName}.APPC.RESPONSE\"\n when\n $params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\n $request : Request( getCommonHeader().RequestID == $event.requestID )\n $response : Response( getCommonHeader().RequestID == $event.requestID ) \n then\n System.out.println(\"rule APPC.RESPONSE is triggered.\");\n if ($response.Status == null) {\n $operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n } \n //\n // Get the Response Code\n //\n ResponseCode code = ResponseCode.toResponseCode($response.Status.Code);\n if (code == null) {\n $operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n }\n //\n // Construct notification\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"${policyScope}\";\n notification.policyVersion = \"${policyVersion}\";\n notification.message = $operationWrapper.operation.toMessage();\n $operationWrapper.operation.message = $operationWrapper.operation.toMessage();\n //\n // Ok, let\'s figure out what APP-C\'s response is\n //\n switch (code) {\n case ACCEPT:\n $operationWrapper.operation.outcome = \"PROCESSING\";\n break;\n case ERROR:\n case REJECT:\n $operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n break;\n case SUCCESS:\n $operationWrapper.operation.outcome = \"SUCCESS\";\n $manager.setControlLoopResult(\"SUCCESS\");\n break;\n case FAILURE:\n $operationWrapper.operation.outcome = \"FAILURE\";\n $manager.setControlLoopResult(\"FAILURE\");\n break;\n }\n if ($operationWrapper.operation.outcome.equals(\"SUCCESS\")) {\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n } else if ($operationWrapper.operation.outcome.equals(\"PROCESSING\")) {\n retract($response);\n } else {\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n }\n \nend \n\n/*\n*\n* This rule is used to clean up APPC response\n*\n*/ \nrule \"${policyName}.APPC.RESPONSE.CLEANUP\"\n when\n $params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\n $response : Response($id : getCommonHeader().RequestID )\n not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) ) \n then\n System.out.println(\"rule APPC.RESPONSE.CLEANUP is triggered.\");\n retract($response);\nend\n\n/*\n*\n* This rule responds to MSO Response Events\n*\n*/\nrule \"${policyName}.MSO.RESPONSE\"\n when\n $params : Params( getClosedLoopControlName() == \"${closedLoopControlName}\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\n $request : MSORequest( requestId == $event.requestID.toString() )\n $response : MSOResponse( request.requestId == $event.requestID.toString() ) \n then\n System.out.println(\"rule MSO.RESPONSE is triggered.\");\n //\n // Construct notification\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"${policyScope}\";\n notification.policyVersion = \"${policyVersion}\";\n notification.message = $operationWrapper.operation.toMessage();\n $operationWrapper.operation.message = $operationWrapper.operation.toMessage();\n //\n // The operation can either be succeeded or failed\n // \n if($response.request.requestStatus.requestState.equals(\"COMPLETE\")) {\n $operationWrapper.operation.outcome = \"SUCCESS\";\n $manager.setControlLoopResult(\"SUCCESS\");\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n } else {\n $operationWrapper.operation.outcome = \"FAILURE\";\n $manager.setControlLoopResult(\"FAILURE\");\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n }\n \nend ','2017-03-14 19:55:47','demo');
-
-INSERT INTO `policyentity` VALUES (3156,'doACPolicyPut','2017-03-03 17:26:24',0,'Micro Service vFirewall Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:','doACPolicyPut','2017-03-03 17:26:24','<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:34928b05-b0f6-4974-8458-f4d34a2a1764\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n <Description>Micro Service vFirewall Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>\n <Target>\n <AnyOf>\n <AllOf>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_MS_vFirewall.1.xml</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"PolicyName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n <AllOf>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DCAE</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ONAPName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleConfigName</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ConfigName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">TcaMetrics-v1.0.0.5</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"service\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"uuid\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleServiceLocation</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"location\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskType\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskLevel\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"guard\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"TTLDate\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n </AnyOf>\n </Target>\n <Rule RuleId=\"urn:com:xacml:rule:id:063161de-0534-4989-bd01-42f784daf21e\" Effect=\"Permit\">\n <Target>\n <AnyOf>\n <AllOf>\n <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">ACCESS</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Config</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n </AnyOf>\n </Target>\n <AdviceExpressions>\n <AdviceExpression AdviceId=\"MSID\" AppliesTo=\"Permit\">\n <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Configuration</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"URLID\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URL/Config/com.Config_MS_vFirewall.1.json</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"PolicyName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_MS_vFirewall.1.xml</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"VersionNumber\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:ONAPName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DCAE</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:ConfigName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleConfigName</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:service\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">TcaMetrics-v1.0.0.5</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:uuid\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:Location\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleServiceLocation</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"Priority\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"RiskType\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"RiskLevel\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"guard\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"TTLDate\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n </AttributeAssignmentExpression>\n </AdviceExpression>\n </AdviceExpressions>\n </Rule>\n</Policy>\n','Config_MS_vFirewall.1.xml',0,'com',1,NULL,3155),(3158,'doACPolicyPut','2017-03-03 17:28:10',0,'Micro Service vLoadBalancer Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:','doACPolicyPut','2017-03-03 17:28:10','<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:c220802a-70ee-4ca8-9f1e-f8a515650381\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n <Description>Micro Service vLoadBalancer Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>\n <Target>\n <AnyOf>\n <AllOf>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_MS_vLoadBalancer.1.xml</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"PolicyName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n <AllOf>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DCAE</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ONAPName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleConfigName</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ConfigName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">TcaMetrics-v1.0.0.5</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"service\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"uuid\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleServiceLocation</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"location\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskType\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskLevel\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"guard\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"TTLDate\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n </AnyOf>\n </Target>\n <Rule RuleId=\"urn:com:xacml:rule:id:fca27dab-6c09-4541-8136-328abaec2656\" Effect=\"Permit\">\n <Target>\n <AnyOf>\n <AllOf>\n <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">ACCESS</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Config</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n </AnyOf>\n </Target>\n <AdviceExpressions>\n <AdviceExpression AdviceId=\"MSID\" AppliesTo=\"Permit\">\n <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Configuration</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"URLID\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URL/Config/com.Config_MS_vLoadBalancer.1.json</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"PolicyName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_MS_vLoadBalancer.1.xml</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"VersionNumber\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:ONAPName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DCAE</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:ConfigName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleConfigName</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:service\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">TcaMetrics-v1.0.0.5</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:uuid\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:Location\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleServiceLocation</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"Priority\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"RiskType\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"RiskLevel\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"guard\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"TTLDate\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n </AttributeAssignmentExpression>\n </AdviceExpression>\n </AdviceExpressions>\n </Rule>\n</Policy>\n','Config_MS_vLoadBalancer.1.xml',0,'com',1,NULL,3157);
-
-INSERT INTO `configurationdataentity` VALUES (3155,'{\"service\":\"TcaMetrics\",\"location\":\"SampleServiceLocation\",\"uuid\":\"/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall\",\"policyName\":\"vFirewall\",\"description\":\"Micro Service vFirewall Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:\",\"configName\":\"SampleConfigName\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"1.0.0.5\",\"priority\":\"1\",\"policyScope\":\"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\",\"content\":{\"thresholds\":[{\"severity\":\"MAJOR\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].packetsIn\",\"thresholdValue\":\"300\",\"closedLoopControlName\":\"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\":\"1.0.2\",\"direction\":\"LESS_OR_EQUAL\"},{\"severity\":\"CRITICAL\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].packetsIn\",\"thresholdValue\":\"700\",\"closedLoopControlName\":\"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\":\"1.0.2\",\"direction\":\"GREATER_OR_EQUAL\"}],\"functionalRole\":\"vFirewall\",\"name\":\"0\"}}\r\n','JSON','com.Config_MS_vFirewall.1.json','doACPolicyPut','2017-03-03 17:26:24',0,'','doACPolicyPut','2017-03-03 17:26:24',1),(3157,'{\"service\":\"TcaMetrics\",\"location\":\"SampleServiceLocation\",\"uuid\":\"/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer\",\"policyName\":\"vLoadBalancer\",\"description\":\"Micro Service vLoadBalancer Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:\",\"configName\":\"SampleConfigName\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"1.0.0.5\",\"priority\":\"1\",\"policyScope\":\"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop\",\"content\":{\"thresholds\":[{\"severity\":\"MAJOR\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.vNicUsageArray[*].packetsIn\",\"thresholdValue\":\"200\",\"closedLoopControlName\":\"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\",\"version\":\"1.0.2\",\"direction\":\"GREATER_OR_EQUAL\"}],\"functionalRole\":\"vLoadBalancer\",\"name\":\"0\"}}\r\n','JSON','com.Config_MS_vLoadBalancer.1.json','doACPolicyPut','2017-03-03 17:28:10',0,'','doACPolicyPut','2017-03-03 17:28:10',1);
-
-INSERT INTO `configurationdataentity` VALUES (3201,'/* Autogenerated Code Please Don\'t change/remove this comment section. This is for the UI purpose. \n <$%BRMSParamTemplate=ControlLoopDemo__closedLoopControlName%$> \n */ \n\r\n\r\n/*-\n * ============LICENSE_START=======================================================\n * archetype-closed-loop-demo-rules\n * ================================================================================\n * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ============LICENSE_END=========================================================\n */\n\npackage org.onap.policy.controlloop;\n\nimport java.util.List;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.HashMap;\nimport java.util.UUID;\n\nimport org.onap.policy.controlloop.VirtualControlLoopEvent;\nimport org.onap.policy.controlloop.ControlLoopEventStatus;\nimport org.onap.policy.controlloop.VirtualControlLoopNotification;\nimport org.onap.policy.controlloop.ControlLoopNotificationType;\nimport org.onap.policy.controlloop.ControlLoopOperation;\nimport org.onap.policy.controlloop.ControlLoopOperationWrapper;\nimport org.onap.policy.template.demo.ControlLoopException;\n\nimport org.onap.policy.aai.AAINQF199.AAINQF199CloudRegion;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperties;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperty;\nimport org.onap.policy.aai.AAINQF199.AAINQF199GenericVNF;\nimport org.onap.policy.aai.AAINQF199.AAINQF199InstanceFilters;\nimport org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;\nimport org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItems;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Manager;\nimport org.onap.policy.aai.AAINQF199.AAINQF199NamedQuery;\nimport org.onap.policy.aai.AAINQF199.AAINQF199QueryParameters;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Request;\nimport org.onap.policy.aai.AAINQF199.AAINQF199RequestWrapper;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Response;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ResponseWrapper;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ServiceInstance;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Tenant;\nimport org.onap.policy.aai.AAINQF199.AAINQF199VfModule;\nimport org.onap.policy.aai.AAINQF199.AAINQF199VServer;\nimport org.onap.policy.aai.util.Serialization;\n\nimport org.onap.policy.appc.CommonHeader;\nimport org.onap.policy.appc.Request;\nimport org.onap.policy.appc.Response;\nimport org.onap.policy.appc.ResponseCode;\nimport org.onap.policy.appc.ResponseStatus;\nimport org.onap.policy.appc.ResponseValue;\n\nimport org.onap.policy.template.demo.EventManager;\nimport org.onap.policy.vnf.trafficgenerator.PGRequest;\nimport org.onap.policy.vnf.trafficgenerator.PGStream;\nimport org.onap.policy.vnf.trafficgenerator.PGStreams;\n\nimport org.onap.policy.mso.MSOManager;\nimport org.onap.policy.mso.MSORequest;\nimport org.onap.policy.mso.MSORequestStatus;\nimport org.onap.policy.mso.MSORequestDetails;\nimport org.onap.policy.mso.MSOModelInfo;\nimport org.onap.policy.mso.MSOCloudConfiguration;\nimport org.onap.policy.mso.MSORequestInfo;\nimport org.onap.policy.mso.MSORequestParameters;\nimport org.onap.policy.mso.MSORelatedInstanceListElement;\nimport org.onap.policy.mso.MSORelatedInstance;\nimport org.onap.policy.mso.MSOResponse;\n\nimport org.onap.policy.drools.system.PolicyEngine;\n\n//\n// These parameters are required to build the runtime policy\n//\ndeclare Params\n closedLoopControlName : String\n actor : String\n aaiURL : String\n aaiUsername : String\n aaiPassword : String\n msoURL : String\n msoUsername : String\n msoPassword : String\n aaiNamedQueryUUID : String\n aaiPatternMatch : int \n notificationTopic : String\n appcTopic : String\nend\n\n/*\n*\n* Called once and only once to insert the parameters into working memory for this Closed Loop policy.\n* (Comment SETUP rule out for the first ONAP opensource release since policy BRMS_GW already puts a Params fact in there)\n*\n*\n*rule \"BRMSParamvFWDemoPolicy.SETUP\"\n* when\n* then\n* System.out.println(\"rule SETUP is triggered.\");\n* Params params = new Params();\n* params.setClosedLoopControlName(\"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\");\n* params.setActor(\"APPC\");\n* params.setAaiURL(\"null\");\n* params.setAaiUsername(\"null\");\n* params.setAaiPassword(\"null\");\n* params.setMsoURL(\"null\");\n* params.setMsoUsername(\"null\");\n* params.setMsoPassword(\"null\");\n* params.setAaiNamedQueryUUID(\"null\");\n* params.setAaiPatternMatch(1);\n* params.setNotificationTopic(\"POLICY-CL-MGT\");\n* params.setAppcTopic(\"APPC-CL\");\n* //\n* // This stays in memory as long as the rule is alive and running\n* //\n* insert(params);\n*end\n*/\n/*\n*\n* This rule responds to DCAE Events\n*\n*/\nrule \"BRMSParamvFWDemoPolicy.EVENT\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n not ( EventManager( closedLoopControlName == $event.closedLoopControlName ))\n then\n System.out.println(\"rule EVENT is triggered.\");\n try {\n // \n // Check the requestID in the event to make sure it is not null before we create the EventManager. \n // The EventManager will do extra syntax checking as well check if the closed loop is disabled/\n //\n if ($event.requestID == null) {\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.REJECTED;\n notification.from = \"policy\";\n notification.message = \"Missing requestID from DCAE event\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver notification: \" + notification);\n }\n //\n // Retract it from memory\n //\n retract($event);\n System.out.println(\"Event with requestID=null has been retracted.\");\n } else {\n //\n // Create an EventManager\n //\n EventManager manager = new EventManager($params.getClosedLoopControlName(), $event.requestID, $event.target);\n //\n // Determine if EventManager can actively process the event (i.e. syntax)\n //\n VirtualControlLoopNotification notification = manager.activate($event);\n notification.from = \"policy\"; \n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n //\n // Are we actively pursuing this event?\n //\n if (notification.notification == ControlLoopNotificationType.ACTIVE) {\n //\n // Insert Event Manager into memory, this will now kick off processing.\n //\n insert(manager);\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver notification: \" + notification);\n } \n } else {\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver notification: \" + notification);\n }\n //\n // Retract it from memory\n //\n retract($event);\n }\n //\n // Now that the manager is inserted into Drools working memory, we\'ll wait for\n // another rule to fire in order to continue processing. This way we can also\n // then screen for additional ONSET and ABATED events for this same RequestIDs \n // and for different RequestIDs but with the same closedLoopControlName and target.\n //\n }\n //\n } catch (Exception e) {\n e.printStackTrace();\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.REJECTED;\n notification.message = \"Exception occurred \" + e.getMessage();\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n //\n //\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e1) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e1.printStackTrace();\n }\n //\n // Retract the event\n //\n retract($event);\n }\nend\n\n/*\n*\n* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager\n* is created. We can start the operations for this closed loop.\n*\n*/\nrule \"BRMSParamvFWDemoPolicy.EVENT.MANAGER\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName, controlLoopResult == null)\n then\n System.out.println(\"rule EVENT.MANAGER is triggered.\");\n //\n // Check which event this is.\n //\n EventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);\n //\n // We only want the initial ONSET event in memory,\n // all the other events need to be retracted to support\n // cleanup and avoid the other rules being fired for this event.\n //\n if (eventStatus != EventManager.NEW_EVENT_STATUS.FIRST_ONSET) {\n System.out.println(\"Retracting \"+eventStatus+\" Event.\");\n retract($event);\n return;\n }\n //\n // Now the event in memory is first onset event\n //\n try {\n //\n // Pull the known AAI field from the Event\n //\n // generic-vnf is needed for vFirewall case\n // vserver-name is needed for vLoadBalancer case\n //\n String genericVNF = $event.AAI.get(\"generic-vnf.vnf-id\");\n String vserver = $event.AAI.get(\"vserver.vserver-name\");\n //\n // Check if we are implementing a simple pattern match.\n //\n if ($params.getAaiPatternMatch() == 1) {\n //\n // Yes\n //\n //Basic naming characteristics:\n //VF Name (9 char)+VM name (13 char total)+VFC (19 char total)\n //Example: \n //VF Name (9 characters): cscf0001v\n //VM Name(13 characters): cscf0001vm001\n //VFC name(19 characters): cscf0001vm001cfg001\n //\n // zdfw1fwl01fwl02 or zdfw1fwl01fwl01 \n // replaced with\n // zdfw1fwl01pgn02 or zdfw1fwl01pgn01\n //\n int index = genericVNF.lastIndexOf(\"fwl\");\n if (index == -1) {\n System.err.println(\"The generic-vnf.vnf-id from DCAE Event is not valid.\");\n } else {\n genericVNF = genericVNF.substring(0, index) + \"pgn\" + genericVNF.substring(index+\"fwl\".length());\n }\n //\n // Construct an APPC request\n //\n ControlLoopOperation operation = new ControlLoopOperation();\n operation.actor = $params.getActor();\n operation.operation = \"ModifyConfig\";\n operation.target = $event.target;\n //\n // Create operationWrapper\n //\n ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\n //\n // insert operationWrapper into memory\n //\n insert(operationWrapper);\n //\n Request request = new Request();\n request.CommonHeader = new CommonHeader();\n request.CommonHeader.RequestID = $event.requestID;\n request.Action = operation.operation;\n request.Payload = new HashMap<String, Object>();\n //\n // Fill in the payload\n //\n request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\n //\n PGRequest pgRequest = new PGRequest();\n pgRequest.pgStreams = new PGStreams();\n \n PGStream pgStream;\n for(int i = 0; i < 5; i++){\n pgStream = new PGStream();\n pgStream.streamId = \"fw_udp\"+(i+1);\n pgStream.isEnabled = \"true\";\n pgRequest.pgStreams.pgStream.add(pgStream);\n }\n request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\n \n if (request != null) {\n //\n // Insert request into memory\n //\n insert(request);\n //\n // Tell interested parties we are performing this Operation\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.OPERATION;\n // message and history ??\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Now send the operation request\n //\n if (request instanceof Request) {\n try {\n System.out.println(\"APPC request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(request));\n PolicyEngine.manager.deliver($params.getAppcTopic(), request);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver request: \" + request);\n }\n }\n } else {\n //\n // what happens if it is null\n //\n }\n //\n } else {\n //\n // create AAI named-query request with UUID started with \"F199\"\n //\n AAINQF199Request aainqf199request = new AAINQF199Request();\n AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();\n AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();\n AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();\n //\n // queryParameters\n //\n aainqf199namedquery.namedQueryUUID = UUID.fromString($params.getAaiNamedQueryUUID()); \n aainqf199queryparam.namedQuery = aainqf199namedquery;\n aainqf199request.queryParameters = aainqf199queryparam;\n //\n // instanceFilters\n //\n Map aainqf199instancefiltermap = new HashMap();\n Map aainqf199instancefiltermapitem = new HashMap();\n aainqf199instancefiltermapitem.put(\"vserver-name\", vserver); \n aainqf199instancefiltermap.put(\"vserver\", aainqf199instancefiltermapitem);\n aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);\n aainqf199request.instanceFilters = aainqf199instancefilter;\n //\n // print aainqf199request for debug\n //\n System.out.println(\"AAI Request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(aainqf199request));\n //\n // Create AAINQF199RequestWrapper\n //\n AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper($event.requestID, aainqf199request);\n //\n // insert aainqf199request into memory\n //\n insert(aainqf199RequestWrapper);\n }\n //\n } catch (Exception e) {\n e.printStackTrace();\n }\nend\n\n/*\n*\n* This rule happens when we got a valid ONSET, closed loop is enabled, an Event Manager\n* is created, AAI Manager and AAI Request are ready in memory. We can start sending query to AAI and then wait for response.\n*\n*/\nrule \"BRMSParamvFWDemoPolicy.EVENT.MANAGER.AAINQF199REQUEST\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\n then\n System.out.println(\"rule EVENT.MANAGER.AAINQF199REQUEST is triggered.\");\n //\n // send the request\n //\n AAINQF199Response aainqf199response = AAINQF199Manager.postQuery($params.getAaiURL(), $params.getAaiUsername(), $params.getAaiPassword(),\n $aainqf199RequestWrapper.aainqf199request, $event.requestID);\n //\n // Check AAI response\n //\n if (aainqf199response == null) {\n System.err.println(\"Failed to get AAI response\");\n //\n // Fail and retract everything\n //\n retract($event);\n retract($manager);\n retract($aainqf199RequestWrapper);\n } else {\n //\n // Create AAINQF199ResponseWrapper\n //\n AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper($event.requestID, aainqf199response);\n //\n // insert aainqf199ResponseWrapper to memeory\n //\n insert(aainqf199ResponseWrapper);\n }\nend\n\n/*\n*\n* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.\n*\n*/\nrule \"BRMSParamvFWDemoPolicy.EVENT.MANAGER.AAINQF199RESPONSE\"\n when \n $params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\n $aainqf199ResponseWrapper : AAINQF199ResponseWrapper(requestID == $event.requestID)\n then\n System.out.println(\"rule EVENT.MANAGER.AAINQF199RESPONSE is triggered.\");\n //\n // Extract related fields out of AAINQF199RESPONSE\n //\n String vnfItemVnfId, vnfItemVnfType, vnfItemPersonaModelId, vnfItemPersonaModelVersion, vnfItemModelName, \n vnfItemModelVersion, vnfItemModelNameVersionId, serviceItemServiceInstanceId, serviceItemPersonaModelId,\n serviceItemModelName, serviceItemModelType, serviceItemModelVersion, serviceItemModelNameVersionId,\n vfModuleItemVfModuleName, vfModuleItemPersonaModelId, vfModuleItemPersonaModelVersion, vfModuleItemModelName, \n vfModuleItemModelNameVersionId, tenantItemTenantId, cloudRegionItemCloudRegionId;\n try {\n //\n // vnfItem\n //\n vnfItemVnfId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID;\n vnfItemVnfType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType;\n vnfItemVnfType = vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf(\"/\")+1);\n vnfItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId;\n vnfItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion;\n vnfItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\n vnfItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue;\n vnfItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\n //\n // serviceItem\n //\n serviceItemServiceInstanceId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID;\n serviceItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId;\n serviceItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\n serviceItemModelType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue;\n serviceItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion;\n serviceItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\n //\n // Find the index for base vf module and non-base vf module\n //\n int baseIndex = -1;\n int nonBaseIndex = -1;\n List<AAINQF199InventoryResponseItem> inventoryItems = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems;\n for (AAINQF199InventoryResponseItem m : inventoryItems) {\n if (m.vfModule != null && m.vfModule.isBaseVfModule == true) {\n baseIndex = inventoryItems.indexOf(m);\n } else if (m.vfModule != null && m.vfModule.isBaseVfModule == false && m.vfModule.orchestrationStatus == null) {\n nonBaseIndex = inventoryItems.indexOf(m);\n }\n //\n if (baseIndex != -1 && nonBaseIndex != -1) {\n break;\n }\n }\n //\n // Report the error if either base vf module or non-base vf module is not found\n //\n if (baseIndex == -1 || nonBaseIndex == -1) {\n System.err.println(\"Either base or non-base vf module is not found from AAI response.\");\n retract($aainqf199RequestWrapper);\n retract($aainqf199ResponseWrapper);\n retract($manager);\n retract($event);\n return;\n }\n //\n // This comes from the base module\n //\n vfModuleItemVfModuleName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.vfModuleName;\n vfModuleItemVfModuleName = vfModuleItemVfModuleName.replace(\"Vfmodule\", \"vDNS\");\n //\n // vfModuleItem - NOT the base module\n //\n vfModuleItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelId;\n vfModuleItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelVersion;\n vfModuleItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(0).propertyValue;\n vfModuleItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue;\n //\n // tenantItem\n //\n tenantItemTenantId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId;\n //\n // cloudRegionItem\n //\n cloudRegionItemCloudRegionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;\n //\n } catch (Exception e) {\n e.printStackTrace();\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.REJECTED;\n notification.message = \"Exception occurred \" + e.getMessage();\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e1) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e1.printStackTrace();\n }\n //\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n notification.message = \"Invalid named-query response from AAI\";\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e1) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e1.printStackTrace();\n }\n //\n // Retract everything\n //\n retract($aainqf199RequestWrapper);\n retract($aainqf199ResponseWrapper);\n retract($manager);\n retract($event);\n return;\n } \n //\n // Extracted fields should not be null\n //\n if ((vnfItemVnfId == null) || (vnfItemVnfType == null) ||\n (vnfItemPersonaModelId == null) || (vnfItemModelName == null) ||\n (vnfItemModelVersion == null) || (vnfItemModelNameVersionId == null) ||\n (serviceItemServiceInstanceId == null) || (serviceItemModelName == null) ||\n (serviceItemModelType == null) || (serviceItemModelVersion == null) ||\n (serviceItemModelNameVersionId == null) || (vfModuleItemVfModuleName == null) ||\n (vfModuleItemPersonaModelId == null) || (vfModuleItemPersonaModelVersion == null) ||\n (vfModuleItemModelName == null) || (vfModuleItemModelNameVersionId == null) ||\n (tenantItemTenantId == null) || (cloudRegionItemCloudRegionId == null)) {\n //\n System.err.println(\"some fields are missing from AAI response.\");\n //\n // Fail and retract everything\n //\n retract($aainqf199RequestWrapper);\n retract($aainqf199ResponseWrapper);\n retract($manager);\n retract($event);\n return;\n }\n //\n // We don\'t need them any more\n //\n retract($aainqf199ResponseWrapper);\n retract($aainqf199RequestWrapper); \n //\n // check the actor of this closed loop\n //\n switch ($params.getActor()) {\n case \"APPC\":\n {\n //\n // Construct an APPC request\n //\n ControlLoopOperation operation = new ControlLoopOperation();\n operation.actor = $params.getActor();\n operation.operation = \"ModifyConfig\";\n operation.target = $event.target;\n //\n // Create operationWrapper\n //\n ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\n //\n // insert operationWrapper into memory\n //\n insert(operationWrapper);\n //\n Request request = new Request();\n request.CommonHeader = new CommonHeader();\n request.CommonHeader.RequestID = $event.requestID;\n request.Action = operation.operation;\n request.Payload = new HashMap<String, Object>();\n //\n // Fill in the payload\n // Hardcode genericVNF for now since AAI has not been ready for vFirewall demo case\n //\n String genericVNF = \"zdfw1fwl01pgn02\";\n request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\n //\n PGRequest pgRequest = new PGRequest();\n pgRequest.pgStreams = new PGStreams();\n \n PGStream pgStream;\n for(int i = 0; i < 5; i++){\n pgStream = new PGStream();\n pgStream.streamId = \"fw_udp\"+(i+1);\n pgStream.isEnabled = \"true\";\n pgRequest.pgStreams.pgStream.add(pgStream);\n }\n request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\n \n if (request != null) {\n //\n // Insert request into memory\n //\n insert(request);\n //\n // Tell interested parties we are performing this Operation\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.OPERATION;\n // message and history ??\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Now send the operation request\n //\n if (request instanceof Request) {\n try {\n System.out.println(\"APPC request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(request));\n PolicyEngine.manager.deliver($params.getAppcTopic(), request);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver request: \" + request);\n }\n }\n } else {\n //\n // what happens if it is null\n //\n }\n }\n break;\n case \"MSO\":\n {\n //\n // Construct an operation\n //\n ControlLoopOperation operation = new ControlLoopOperation();\n operation.actor = $params.getActor();\n operation.operation = \"createModuleInstance\";\n operation.target = $event.target;\n //\n // Create operationWrapper\n //\n ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\n //\n // Construct an MSO request\n //\n MSORequest request = new MSORequest();\n request.requestDetails = new MSORequestDetails();\n request.requestDetails.modelInfo = new MSOModelInfo();\n request.requestDetails.cloudConfiguration = new MSOCloudConfiguration();\n request.requestDetails.requestInfo = new MSORequestInfo();\n request.requestDetails.requestParameters = new MSORequestParameters();\n request.requestDetails.requestParameters.userParams = null;\n //\n // cloudConfiguration\n //\n request.requestDetails.cloudConfiguration.lcpCloudRegionId = cloudRegionItemCloudRegionId;\n request.requestDetails.cloudConfiguration.tenantId = tenantItemTenantId;\n //\n // modelInfo\n //\n request.requestDetails.modelInfo.modelType = \"vfModule\";\n request.requestDetails.modelInfo.modelInvariantId = vfModuleItemPersonaModelId;\n request.requestDetails.modelInfo.modelNameVersionId = vfModuleItemModelNameVersionId;\n request.requestDetails.modelInfo.modelName = vfModuleItemModelName;\n request.requestDetails.modelInfo.modelVersion = vfModuleItemPersonaModelVersion;\n //\n // requestInfo\n //\n request.requestDetails.requestInfo.instanceName = vfModuleItemVfModuleName;\n request.requestDetails.requestInfo.source = \"POLICY\";\n request.requestDetails.requestInfo.suppressRollback = false;\n //\n // relatedInstanceList\n //\n MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();\n MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();\n relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();\n relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();\n //\n relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;\n relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();\n relatedInstanceListElement1.relatedInstance.modelInfo.modelType = \"service\";\n relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;\n relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;\n relatedInstanceListElement1.relatedInstance.modelInfo.modelName = serviceItemModelName;\n relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;\n //\n relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;\n relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();\n relatedInstanceListElement2.relatedInstance.modelInfo.modelType = \"vnf\";\n relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelName = vnfItemModelName;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = vnfItemModelVersion;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = vnfItemVnfType;\n // \n request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);\n request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);\n //\n // print MSO request for debug\n //\n System.out.println(\"MSO request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(request));\n //\n //\n //\n if (request != null) {\n //\n // Tell interested parties we are performing this Operation\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.OPERATION;\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL\n //\n String MSOUrl = $params.getMsoURL() + \"/serviceInstances/v2/\" + serviceItemServiceInstanceId + \"/vnfs/\" + vnfItemVnfId + \"/vfModules\";\n //\n // Call MSO\n //\n MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);\n //\n if (response != null) {\n //\n // Assign requestId\n //\n request.requestId = $event.requestID.toString(); \n response.request.requestId = $event.requestID.toString();\n //\n // Insert facts\n //\n insert(operationWrapper);\n insert(request);\n insert(response);\n } else {\n //\n // MSO request not even accepted\n //\n notification.message = operationWrapper.operation.toMessage();\n operationWrapper.operation.message = operationWrapper.operation.toMessage();\n operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n notification.history.add(operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Retract everything\n //\n retract($event);\n retract($manager);\n }\n } else {\n System.err.println(\"constructed MSO request is invalid.\");\n }\n }\n break; \n } \nend\n \n/*\n*\n* This rule responds to APPC Response Events\n*\n*/\nrule \"BRMSParamvFWDemoPolicy.APPC.RESPONSE\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\n $request : Request( getCommonHeader().RequestID == $event.requestID )\n $response : Response( getCommonHeader().RequestID == $event.requestID ) \n then\n System.out.println(\"rule APPC.RESPONSE is triggered.\");\n if ($response.Status == null) {\n $operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n } \n //\n // Get the Response Code\n //\n ResponseCode code = ResponseCode.toResponseCode($response.Status.Code);\n if (code == null) {\n $operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n }\n //\n // Construct notification\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n notification.message = $operationWrapper.operation.toMessage();\n $operationWrapper.operation.message = $operationWrapper.operation.toMessage();\n //\n // Ok, let\'s figure out what APP-C\'s response is\n //\n switch (code) {\n case ACCEPT:\n $operationWrapper.operation.outcome = \"PROCESSING\";\n break;\n case ERROR:\n case REJECT:\n $operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n break;\n case SUCCESS:\n $operationWrapper.operation.outcome = \"SUCCESS\";\n $manager.setControlLoopResult(\"SUCCESS\");\n break;\n case FAILURE:\n $operationWrapper.operation.outcome = \"FAILURE\";\n $manager.setControlLoopResult(\"FAILURE\");\n break;\n }\n if ($operationWrapper.operation.outcome.equals(\"SUCCESS\")) {\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n } else if ($operationWrapper.operation.outcome.equals(\"PROCESSING\")) {\n retract($response);\n } else {\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n }\n \nend \n\n/*\n*\n* This rule is used to clean up APPC response\n*\n*/ \nrule \"BRMSParamvFWDemoPolicy.APPC.RESPONSE.CLEANUP\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $response : Response($id : getCommonHeader().RequestID )\n not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) ) \n then\n System.out.println(\"rule APPC.RESPONSE.CLEANUP is triggered.\");\n retract($response);\nend\n\n/*\n*\n* This rule responds to MSO Response Events\n*\n*/\nrule \"BRMSParamvFWDemoPolicy.MSO.RESPONSE\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\n $request : MSORequest( requestId == $event.requestID.toString() )\n $response : MSOResponse( request.requestId == $event.requestID.toString() ) \n then\n System.out.println(\"rule MSO.RESPONSE is triggered.\");\n //\n // Construct notification\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n notification.message = $operationWrapper.operation.toMessage();\n $operationWrapper.operation.message = $operationWrapper.operation.toMessage();\n //\n // The operation can either be succeeded or failed\n // \n if($response.request.requestStatus.requestState.equals(\"COMPLETE\")) {\n $operationWrapper.operation.outcome = \"SUCCESS\";\n $manager.setControlLoopResult(\"SUCCESS\");\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n } else {\n $operationWrapper.operation.outcome = \"FAILURE\";\n $manager.setControlLoopResult(\"FAILURE\");\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n }\n \nend \nrule \"com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.Params\" \n salience 1000 \n when\n then\n Params params = new Params();\n params.setAaiPatternMatch(1);\n params.setAppcTopic(\"APPC-CL\");\n params.setAaiURL(\"null\");\n params.setMsoPassword(\"null\");\n params.setClosedLoopControlName(\"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\");\n params.setMsoURL(\"null\");\n params.setAaiUsername(\"null\");\n params.setActor(\"APPC\");\n params.setMsoUsername(\"null\");\n params.setAaiNamedQueryUUID(\"null\");\n params.setAaiPassword(\"null\");\n params.setNotificationTopic(\"POLICY-CL-MGT\");\n insert(params);\nend\r\n','OTHER','com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt','doACPolicyPut','2017-03-14 19:58:19',0,'','doACPolicyPut','2017-03-14 19:58:19',1),(3203,'/* Autogenerated Code Please Don\'t change/remove this comment section. This is for the UI purpose. \n <$%BRMSParamTemplate=ControlLoopDemo__closedLoopControlName%$> \n */ \n\r\n\r\n/*-\n * ============LICENSE_START=======================================================\n * archetype-closed-loop-demo-rules\n * ================================================================================\n * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ============LICENSE_END=========================================================\n */\n\npackage org.onap.policy.controlloop;\n\nimport java.util.List;\nimport java.util.LinkedList;\nimport java.util.Map;\nimport java.util.HashMap;\nimport java.util.UUID;\n\nimport org.onap.policy.controlloop.VirtualControlLoopEvent;\nimport org.onap.policy.controlloop.ControlLoopEventStatus;\nimport org.onap.policy.controlloop.VirtualControlLoopNotification;\nimport org.onap.policy.controlloop.ControlLoopNotificationType;\nimport org.onap.policy.controlloop.ControlLoopOperation;\nimport org.onap.policy.controlloop.ControlLoopOperationWrapper;\nimport org.onap.policy.template.demo.ControlLoopException;\n\nimport org.onap.policy.aai.AAINQF199.AAINQF199CloudRegion;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperties;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperty;\nimport org.onap.policy.aai.AAINQF199.AAINQF199GenericVNF;\nimport org.onap.policy.aai.AAINQF199.AAINQF199InstanceFilters;\nimport org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;\nimport org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItems;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Manager;\nimport org.onap.policy.aai.AAINQF199.AAINQF199NamedQuery;\nimport org.onap.policy.aai.AAINQF199.AAINQF199QueryParameters;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Request;\nimport org.onap.policy.aai.AAINQF199.AAINQF199RequestWrapper;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Response;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ResponseWrapper;\nimport org.onap.policy.aai.AAINQF199.AAINQF199ServiceInstance;\nimport org.onap.policy.aai.AAINQF199.AAINQF199Tenant;\nimport org.onap.policy.aai.AAINQF199.AAINQF199VfModule;\nimport org.onap.policy.aai.AAINQF199.AAINQF199VServer;\nimport org.onap.policy.aai.util.Serialization;\n\nimport org.onap.policy.appc.CommonHeader;\nimport org.onap.policy.appc.Request;\nimport org.onap.policy.appc.Response;\nimport org.onap.policy.appc.ResponseCode;\nimport org.onap.policy.appc.ResponseStatus;\nimport org.onap.policy.appc.ResponseValue;\n\nimport org.onap.policy.template.demo.EventManager;\nimport org.onap.policy.vnf.trafficgenerator.PGRequest;\nimport org.onap.policy.vnf.trafficgenerator.PGStream;\nimport org.onap.policy.vnf.trafficgenerator.PGStreams;\n\nimport org.onap.policy.mso.MSOManager;\nimport org.onap.policy.mso.MSORequest;\nimport org.onap.policy.mso.MSORequestStatus;\nimport org.onap.policy.mso.MSORequestDetails;\nimport org.onap.policy.mso.MSOModelInfo;\nimport org.onap.policy.mso.MSOCloudConfiguration;\nimport org.onap.policy.mso.MSORequestInfo;\nimport org.onap.policy.mso.MSORequestParameters;\nimport org.onap.policy.mso.MSORelatedInstanceListElement;\nimport org.onap.policy.mso.MSORelatedInstance;\nimport org.onap.policy.mso.MSOResponse;\n\nimport org.onap.policy.drools.system.PolicyEngine;\n\n//\n// These parameters are required to build the runtime policy\n//\ndeclare Params\n closedLoopControlName : String\n actor : String\n aaiURL : String\n aaiUsername : String\n aaiPassword : String\n msoURL : String\n msoUsername : String\n msoPassword : String\n aaiNamedQueryUUID : String\n aaiPatternMatch : int \n notificationTopic : String\n appcTopic : String\nend\n\n/*\n*\n* Called once and only once to insert the parameters into working memory for this Closed Loop policy.\n* (Comment SETUP rule out for the first ONAP opensource release since policy BRMS_GW already puts a Params fact in there)\n*\n*\n*rule \"BRMSParamvLBDemoPolicy.SETUP\"\n* when\n* then\n* System.out.println(\"rule SETUP is triggered.\");\n* Params params = new Params();\n* params.setClosedLoopControlName(\"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\");\n* params.setActor(\"MSO\");\n* params.setAaiURL(\"https://aai.api.simpledemo.openecomp.org:8443\");\n* params.setAaiUsername(\"POLICY\");\n* params.setAaiPassword(\"POLICY\");\n* params.setMsoURL(\"http://vm1.mso.simpledemo.openecomp.org:8080/onap/mso/infra\");\n* params.setMsoUsername(\"InfraPortalClient\");\n* params.setMsoPassword(\"password1$\");\n* params.setAaiNamedQueryUUID(\"f199cb88-5e69-4b1f-93e0-6f257877d066\");\n* params.setAaiPatternMatch(0);\n* params.setNotificationTopic(\"POLICY-CL-MGT\");\n* params.setAppcTopic(\"APPC-CL\");\n* //\n* // This stays in memory as long as the rule is alive and running\n* //\n* insert(params);\n*end\n*/\n/*\n*\n* This rule responds to DCAE Events\n*\n*/\nrule \"BRMSParamvLBDemoPolicy.EVENT\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n not ( EventManager( closedLoopControlName == $event.closedLoopControlName ))\n then\n System.out.println(\"rule EVENT is triggered.\");\n try {\n // \n // Check the requestID in the event to make sure it is not null before we create the EventManager. \n // The EventManager will do extra syntax checking as well check if the closed loop is disabled/\n //\n if ($event.requestID == null) {\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.REJECTED;\n notification.from = \"policy\";\n notification.message = \"Missing requestID from DCAE event\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver notification: \" + notification);\n }\n //\n // Retract it from memory\n //\n retract($event);\n System.out.println(\"Event with requestID=null has been retracted.\");\n } else {\n //\n // Create an EventManager\n //\n EventManager manager = new EventManager($params.getClosedLoopControlName(), $event.requestID, $event.target);\n //\n // Determine if EventManager can actively process the event (i.e. syntax)\n //\n VirtualControlLoopNotification notification = manager.activate($event);\n notification.from = \"policy\"; \n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n //\n // Are we actively pursuing this event?\n //\n if (notification.notification == ControlLoopNotificationType.ACTIVE) {\n //\n // Insert Event Manager into memory, this will now kick off processing.\n //\n insert(manager);\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver notification: \" + notification);\n } \n } else {\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver notification: \" + notification);\n }\n //\n // Retract it from memory\n //\n retract($event);\n }\n //\n // Now that the manager is inserted into Drools working memory, we\'ll wait for\n // another rule to fire in order to continue processing. This way we can also\n // then screen for additional ONSET and ABATED events for this same RequestIDs \n // and for different RequestIDs but with the same closedLoopControlName and target.\n //\n }\n //\n } catch (Exception e) {\n e.printStackTrace();\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.REJECTED;\n notification.message = \"Exception occurred \" + e.getMessage();\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n //\n //\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e1) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e1.printStackTrace();\n }\n //\n // Retract the event\n //\n retract($event);\n }\nend\n\n/*\n*\n* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager\n* is created. We can start the operations for this closed loop.\n*\n*/\nrule \"BRMSParamvLBDemoPolicy.EVENT.MANAGER\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName, controlLoopResult == null)\n then\n System.out.println(\"rule EVENT.MANAGER is triggered.\");\n //\n // Check which event this is.\n //\n EventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);\n //\n // We only want the initial ONSET event in memory,\n // all the other events need to be retracted to support\n // cleanup and avoid the other rules being fired for this event.\n //\n if (eventStatus != EventManager.NEW_EVENT_STATUS.FIRST_ONSET) {\n System.out.println(\"Retracting \"+eventStatus+\" Event.\");\n retract($event);\n return;\n }\n //\n // Now the event in memory is first onset event\n //\n try {\n //\n // Pull the known AAI field from the Event\n //\n // generic-vnf is needed for vFirewall case\n // vserver-name is needed for vLoadBalancer case\n //\n String genericVNF = $event.AAI.get(\"generic-vnf.vnf-id\");\n String vserver = $event.AAI.get(\"vserver.vserver-name\");\n //\n // Check if we are implementing a simple pattern match.\n //\n if ($params.getAaiPatternMatch() == 1) {\n //\n // Yes\n //\n //Basic naming characteristics:\n //VF Name (9 char)+VM name (13 char total)+VFC (19 char total)\n //Example: \n //VF Name (9 characters): cscf0001v\n //VM Name(13 characters): cscf0001vm001\n //VFC name(19 characters): cscf0001vm001cfg001\n //\n // zdfw1fwl01fwl02 or zdfw1fwl01fwl01 \n // replaced with\n // zdfw1fwl01pgn02 or zdfw1fwl01pgn01\n //\n int index = genericVNF.lastIndexOf(\"fwl\");\n if (index == -1) {\n System.err.println(\"The generic-vnf.vnf-id from DCAE Event is not valid.\");\n } else {\n genericVNF = genericVNF.substring(0, index) + \"pgn\" + genericVNF.substring(index+\"fwl\".length());\n }\n //\n // Construct an APPC request\n //\n ControlLoopOperation operation = new ControlLoopOperation();\n operation.actor = $params.getActor();\n operation.operation = \"ModifyConfig\";\n operation.target = $event.target;\n //\n // Create operationWrapper\n //\n ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\n //\n // insert operationWrapper into memory\n //\n insert(operationWrapper);\n //\n Request request = new Request();\n request.CommonHeader = new CommonHeader();\n request.CommonHeader.RequestID = $event.requestID;\n request.Action = operation.operation;\n request.Payload = new HashMap<String, Object>();\n //\n // Fill in the payload\n //\n request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\n //\n PGRequest pgRequest = new PGRequest();\n pgRequest.pgStreams = new PGStreams();\n \n PGStream pgStream;\n for(int i = 0; i < 5; i++){\n pgStream = new PGStream();\n pgStream.streamId = \"fw_udp\"+(i+1);\n pgStream.isEnabled = \"true\";\n pgRequest.pgStreams.pgStream.add(pgStream);\n }\n request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\n \n if (request != null) {\n //\n // Insert request into memory\n //\n insert(request);\n //\n // Tell interested parties we are performing this Operation\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.OPERATION;\n // message and history ??\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Now send the operation request\n //\n if (request instanceof Request) {\n try {\n System.out.println(\"APPC request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(request));\n PolicyEngine.manager.deliver($params.getAppcTopic(), request);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver request: \" + request);\n }\n }\n } else {\n //\n // what happens if it is null\n //\n }\n //\n } else {\n //\n // create AAI named-query request with UUID started with \"F199\"\n //\n AAINQF199Request aainqf199request = new AAINQF199Request();\n AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();\n AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();\n AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();\n //\n // queryParameters\n //\n aainqf199namedquery.namedQueryUUID = UUID.fromString($params.getAaiNamedQueryUUID()); \n aainqf199queryparam.namedQuery = aainqf199namedquery;\n aainqf199request.queryParameters = aainqf199queryparam;\n //\n // instanceFilters\n //\n Map aainqf199instancefiltermap = new HashMap();\n Map aainqf199instancefiltermapitem = new HashMap();\n aainqf199instancefiltermapitem.put(\"vserver-name\", vserver); \n aainqf199instancefiltermap.put(\"vserver\", aainqf199instancefiltermapitem);\n aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);\n aainqf199request.instanceFilters = aainqf199instancefilter;\n //\n // print aainqf199request for debug\n //\n System.out.println(\"AAI Request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(aainqf199request));\n //\n // Create AAINQF199RequestWrapper\n //\n AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper($event.requestID, aainqf199request);\n //\n // insert aainqf199request into memory\n //\n insert(aainqf199RequestWrapper);\n }\n //\n } catch (Exception e) {\n e.printStackTrace();\n }\nend\n\n/*\n*\n* This rule happens when we got a valid ONSET, closed loop is enabled, an Event Manager\n* is created, AAI Manager and AAI Request are ready in memory. We can start sending query to AAI and then wait for response.\n*\n*/\nrule \"BRMSParamvLBDemoPolicy.EVENT.MANAGER.AAINQF199REQUEST\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\n then\n System.out.println(\"rule EVENT.MANAGER.AAINQF199REQUEST is triggered.\");\n //\n // send the request\n //\n AAINQF199Response aainqf199response = AAINQF199Manager.postQuery($params.getAaiURL(), $params.getAaiUsername(), $params.getAaiPassword(),\n $aainqf199RequestWrapper.aainqf199request, $event.requestID);\n //\n // Check AAI response\n //\n if (aainqf199response == null) {\n System.err.println(\"Failed to get AAI response\");\n //\n // Fail and retract everything\n //\n retract($event);\n retract($manager);\n retract($aainqf199RequestWrapper);\n } else {\n //\n // Create AAINQF199ResponseWrapper\n //\n AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper($event.requestID, aainqf199response);\n //\n // insert aainqf199ResponseWrapper to memeory\n //\n insert(aainqf199ResponseWrapper);\n }\nend\n\n/*\n*\n* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.\n*\n*/\nrule \"BRMSParamvLBDemoPolicy.EVENT.MANAGER.AAINQF199RESPONSE\"\n when \n $params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)\n $aainqf199ResponseWrapper : AAINQF199ResponseWrapper(requestID == $event.requestID)\n then\n System.out.println(\"rule EVENT.MANAGER.AAINQF199RESPONSE is triggered.\");\n //\n // Extract related fields out of AAINQF199RESPONSE\n //\n String vnfItemVnfId, vnfItemVnfType, vnfItemPersonaModelId, vnfItemPersonaModelVersion, vnfItemModelName, \n vnfItemModelVersion, vnfItemModelNameVersionId, serviceItemServiceInstanceId, serviceItemPersonaModelId,\n serviceItemModelName, serviceItemModelType, serviceItemModelVersion, serviceItemModelNameVersionId,\n vfModuleItemVfModuleName, vfModuleItemPersonaModelId, vfModuleItemPersonaModelVersion, vfModuleItemModelName, \n vfModuleItemModelNameVersionId, tenantItemTenantId, cloudRegionItemCloudRegionId;\n try {\n //\n // vnfItem\n //\n vnfItemVnfId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID;\n vnfItemVnfType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType;\n vnfItemVnfType = vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf(\"/\")+1);\n vnfItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId;\n vnfItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion;\n vnfItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\n vnfItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue;\n vnfItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\n //\n // serviceItem\n //\n serviceItemServiceInstanceId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID;\n serviceItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId;\n serviceItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;\n serviceItemModelType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue;\n serviceItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion;\n serviceItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;\n //\n // Find the index for base vf module and non-base vf module\n //\n int baseIndex = -1;\n int nonBaseIndex = -1;\n List<AAINQF199InventoryResponseItem> inventoryItems = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems;\n for (AAINQF199InventoryResponseItem m : inventoryItems) {\n if (m.vfModule != null && m.vfModule.isBaseVfModule == true) {\n baseIndex = inventoryItems.indexOf(m);\n } else if (m.vfModule != null && m.vfModule.isBaseVfModule == false && m.vfModule.orchestrationStatus == null) {\n nonBaseIndex = inventoryItems.indexOf(m);\n }\n //\n if (baseIndex != -1 && nonBaseIndex != -1) {\n break;\n }\n }\n //\n // Report the error if either base vf module or non-base vf module is not found\n //\n if (baseIndex == -1 || nonBaseIndex == -1) {\n System.err.println(\"Either base or non-base vf module is not found from AAI response.\");\n retract($aainqf199RequestWrapper);\n retract($aainqf199ResponseWrapper);\n retract($manager);\n retract($event);\n return;\n }\n //\n // This comes from the base module\n //\n vfModuleItemVfModuleName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.vfModuleName;\n vfModuleItemVfModuleName = vfModuleItemVfModuleName.replace(\"Vfmodule\", \"vDNS\");\n //\n // vfModuleItem - NOT the base module\n //\n vfModuleItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelId;\n vfModuleItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelVersion;\n vfModuleItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(0).propertyValue;\n vfModuleItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue;\n //\n // tenantItem\n //\n tenantItemTenantId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId;\n //\n // cloudRegionItem\n //\n cloudRegionItemCloudRegionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;\n //\n } catch (Exception e) {\n e.printStackTrace();\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.REJECTED;\n notification.message = \"Exception occurred \" + e.getMessage();\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e1) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e1.printStackTrace();\n }\n //\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n notification.message = \"Invalid named-query response from AAI\";\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e1) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e1.printStackTrace();\n }\n //\n // Retract everything\n //\n retract($aainqf199RequestWrapper);\n retract($aainqf199ResponseWrapper);\n retract($manager);\n retract($event);\n return;\n } \n //\n // Extracted fields should not be null\n //\n if ((vnfItemVnfId == null) || (vnfItemVnfType == null) ||\n (vnfItemPersonaModelId == null) || (vnfItemModelName == null) ||\n (vnfItemModelVersion == null) || (vnfItemModelNameVersionId == null) ||\n (serviceItemServiceInstanceId == null) || (serviceItemModelName == null) ||\n (serviceItemModelType == null) || (serviceItemModelVersion == null) ||\n (serviceItemModelNameVersionId == null) || (vfModuleItemVfModuleName == null) ||\n (vfModuleItemPersonaModelId == null) || (vfModuleItemPersonaModelVersion == null) ||\n (vfModuleItemModelName == null) || (vfModuleItemModelNameVersionId == null) ||\n (tenantItemTenantId == null) || (cloudRegionItemCloudRegionId == null)) {\n //\n System.err.println(\"some fields are missing from AAI response.\");\n //\n // Fail and retract everything\n //\n retract($aainqf199RequestWrapper);\n retract($aainqf199ResponseWrapper);\n retract($manager);\n retract($event);\n return;\n }\n //\n // We don\'t need them any more\n //\n retract($aainqf199ResponseWrapper);\n retract($aainqf199RequestWrapper); \n //\n // check the actor of this closed loop\n //\n switch ($params.getActor()) {\n case \"APPC\":\n {\n //\n // Construct an APPC request\n //\n ControlLoopOperation operation = new ControlLoopOperation();\n operation.actor = $params.getActor();\n operation.operation = \"ModifyConfig\";\n operation.target = $event.target;\n //\n // Create operationWrapper\n //\n ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\n //\n // insert operationWrapper into memory\n //\n insert(operationWrapper);\n //\n Request request = new Request();\n request.CommonHeader = new CommonHeader();\n request.CommonHeader.RequestID = $event.requestID;\n request.Action = operation.operation;\n request.Payload = new HashMap<String, Object>();\n //\n // Fill in the payload\n // Hardcode genericVNF for now since AAI has not been ready for vFirewall demo case\n //\n String genericVNF = \"zdfw1fwl01pgn02\";\n request.Payload.put(\"generic-vnf.vnf-id\", genericVNF);\n //\n PGRequest pgRequest = new PGRequest();\n pgRequest.pgStreams = new PGStreams();\n \n PGStream pgStream;\n for(int i = 0; i < 5; i++){\n pgStream = new PGStream();\n pgStream.streamId = \"fw_udp\"+(i+1);\n pgStream.isEnabled = \"true\";\n pgRequest.pgStreams.pgStream.add(pgStream);\n }\n request.Payload.put(\"pg-streams\", pgRequest.pgStreams);\n \n if (request != null) {\n //\n // Insert request into memory\n //\n insert(request);\n //\n // Tell interested parties we are performing this Operation\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.OPERATION;\n // message and history ??\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Now send the operation request\n //\n if (request instanceof Request) {\n try {\n System.out.println(\"APPC request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(request));\n PolicyEngine.manager.deliver($params.getAppcTopic(), request);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"Can\'t deliver request: \" + request);\n }\n }\n } else {\n //\n // what happens if it is null\n //\n }\n }\n break;\n case \"MSO\":\n {\n //\n // Construct an operation\n //\n ControlLoopOperation operation = new ControlLoopOperation();\n operation.actor = $params.getActor();\n operation.operation = \"createModuleInstance\";\n operation.target = $event.target;\n //\n // Create operationWrapper\n //\n ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);\n //\n // Construct an MSO request\n //\n MSORequest request = new MSORequest();\n request.requestDetails = new MSORequestDetails();\n request.requestDetails.modelInfo = new MSOModelInfo();\n request.requestDetails.cloudConfiguration = new MSOCloudConfiguration();\n request.requestDetails.requestInfo = new MSORequestInfo();\n request.requestDetails.requestParameters = new MSORequestParameters();\n request.requestDetails.requestParameters.userParams = null;\n //\n // cloudConfiguration\n //\n request.requestDetails.cloudConfiguration.lcpCloudRegionId = cloudRegionItemCloudRegionId;\n request.requestDetails.cloudConfiguration.tenantId = tenantItemTenantId;\n //\n // modelInfo\n //\n request.requestDetails.modelInfo.modelType = \"vfModule\";\n request.requestDetails.modelInfo.modelInvariantId = vfModuleItemPersonaModelId;\n request.requestDetails.modelInfo.modelNameVersionId = vfModuleItemModelNameVersionId;\n request.requestDetails.modelInfo.modelName = vfModuleItemModelName;\n request.requestDetails.modelInfo.modelVersion = vfModuleItemPersonaModelVersion;\n //\n // requestInfo\n //\n request.requestDetails.requestInfo.instanceName = vfModuleItemVfModuleName;\n request.requestDetails.requestInfo.source = \"POLICY\";\n request.requestDetails.requestInfo.suppressRollback = false;\n //\n // relatedInstanceList\n //\n MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();\n MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();\n relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();\n relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();\n //\n relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;\n relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();\n relatedInstanceListElement1.relatedInstance.modelInfo.modelType = \"service\";\n relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;\n relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;\n relatedInstanceListElement1.relatedInstance.modelInfo.modelName = serviceItemModelName;\n relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;\n //\n relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;\n relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();\n relatedInstanceListElement2.relatedInstance.modelInfo.modelType = \"vnf\";\n relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelName = vnfItemModelName;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = vnfItemModelVersion;\n relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = vnfItemVnfType;\n // \n request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);\n request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);\n //\n // print MSO request for debug\n //\n System.out.println(\"MSO request sent:\");\n System.out.println(Serialization.gsonPretty.toJson(request));\n //\n //\n //\n if (request != null) {\n //\n // Tell interested parties we are performing this Operation\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.notification = ControlLoopNotificationType.OPERATION;\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL\n //\n String MSOUrl = $params.getMsoURL() + \"/serviceInstances/v2/\" + serviceItemServiceInstanceId + \"/vnfs/\" + vnfItemVnfId + \"/vfModules\";\n //\n // Call MSO\n //\n MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);\n //\n if (response != null) {\n //\n // Assign requestId\n //\n request.requestId = $event.requestID.toString(); \n response.request.requestId = $event.requestID.toString();\n //\n // Insert facts\n //\n insert(operationWrapper);\n insert(request);\n insert(response);\n } else {\n //\n // MSO request not even accepted\n //\n notification.message = operationWrapper.operation.toMessage();\n operationWrapper.operation.message = operationWrapper.operation.toMessage();\n operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n notification.history.add(operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // Retract everything\n //\n retract($event);\n retract($manager);\n }\n } else {\n System.err.println(\"constructed MSO request is invalid.\");\n }\n }\n break; \n } \nend\n \n/*\n*\n* This rule responds to APPC Response Events\n*\n*/\nrule \"BRMSParamvLBDemoPolicy.APPC.RESPONSE\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\n $request : Request( getCommonHeader().RequestID == $event.requestID )\n $response : Response( getCommonHeader().RequestID == $event.requestID ) \n then\n System.out.println(\"rule APPC.RESPONSE is triggered.\");\n if ($response.Status == null) {\n $operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n } \n //\n // Get the Response Code\n //\n ResponseCode code = ResponseCode.toResponseCode($response.Status.Code);\n if (code == null) {\n $operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n }\n //\n // Construct notification\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n notification.message = $operationWrapper.operation.toMessage();\n $operationWrapper.operation.message = $operationWrapper.operation.toMessage();\n //\n // Ok, let\'s figure out what APP-C\'s response is\n //\n switch (code) {\n case ACCEPT:\n $operationWrapper.operation.outcome = \"PROCESSING\";\n break;\n case ERROR:\n case REJECT:\n $operationWrapper.operation.outcome = \"FAILURE_EXCEPTION\";\n $manager.setControlLoopResult(\"FAILURE_EXCEPTION\");\n break;\n case SUCCESS:\n $operationWrapper.operation.outcome = \"SUCCESS\";\n $manager.setControlLoopResult(\"SUCCESS\");\n break;\n case FAILURE:\n $operationWrapper.operation.outcome = \"FAILURE\";\n $manager.setControlLoopResult(\"FAILURE\");\n break;\n }\n if ($operationWrapper.operation.outcome.equals(\"SUCCESS\")) {\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n } else if ($operationWrapper.operation.outcome.equals(\"PROCESSING\")) {\n retract($response);\n } else {\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n }\n \nend \n\n/*\n*\n* This rule is used to clean up APPC response\n*\n*/ \nrule \"BRMSParamvLBDemoPolicy.APPC.RESPONSE.CLEANUP\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $response : Response($id : getCommonHeader().RequestID )\n not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) ) \n then\n System.out.println(\"rule APPC.RESPONSE.CLEANUP is triggered.\");\n retract($response);\nend\n\n/*\n*\n* This rule responds to MSO Response Events\n*\n*/\nrule \"BRMSParamvLBDemoPolicy.MSO.RESPONSE\"\n when\n $params : Params( getClosedLoopControlName() == \"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\" )\n $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )\n $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )\n $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )\n $request : MSORequest( requestId == $event.requestID.toString() )\n $response : MSOResponse( request.requestId == $event.requestID.toString() ) \n then\n System.out.println(\"rule MSO.RESPONSE is triggered.\");\n //\n // Construct notification\n //\n VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);\n notification.from = \"policy\";\n notification.policyName = drools.getRule().getName();\n notification.policyScope = \"com\";\n notification.policyVersion = \"1\";\n notification.message = $operationWrapper.operation.toMessage();\n $operationWrapper.operation.message = $operationWrapper.operation.toMessage();\n //\n // The operation can either be succeeded or failed\n // \n if($response.request.requestStatus.requestState.equals(\"COMPLETE\")) {\n $operationWrapper.operation.outcome = \"SUCCESS\";\n $manager.setControlLoopResult(\"SUCCESS\");\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n } else {\n $operationWrapper.operation.outcome = \"FAILURE\";\n $manager.setControlLoopResult(\"FAILURE\");\n notification.history.add($operationWrapper.operation);\n notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n notification.notification = ControlLoopNotificationType.FINAL_FAILURE;\n //\n // Let interested parties know\n //\n try {\n System.out.println(Serialization.gsonPretty.toJson(notification));\n PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);\n } catch (Exception e) {\n System.out.println(\"Can\'t deliver notification: \" + notification);\n e.printStackTrace();\n }\n //\n // We are going to retract these objects from memory\n //\n System.out.println(\"Retracting everything\");\n retract($operationWrapper);\n retract($request);\n retract($response);\n retract($event);\n retract($manager);\n }\n \nend \nrule \"com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.Params\" \n salience 1000 \n when\n then\n Params params = new Params();\n params.setAaiPatternMatch(0);\n params.setAppcTopic(\"APPC-CL\");\n params.setAaiURL(\"https://aai.api.simpledemo.openecomp.org:8443\");\n params.setMsoPassword(\"password1$\");\n params.setClosedLoopControlName(\"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8\");\n params.setAaiUsername(\"POLICY\");\n params.setMsoURL(\"http://vm1.mso.simpledemo.openecomp.org:8080/onap/mso/infra\");\n params.setActor(\"MSO\");\n params.setMsoUsername(\"InfraPortalClient\");\n params.setAaiNamedQueryUUID(\"f199cb88-5e69-4b1f-93e0-6f257877d066\");\n params.setAaiPassword(\"POLICY\");\n params.setNotificationTopic(\"POLICY-CL-MGT\");\n insert(params);\nend\r\n','OTHER','com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt','doACPolicyPut','2017-03-14 20:00:56',0,'','doACPolicyPut','2017-03-14 20:00:56',1);
-
-INSERT INTO `policyentity` VALUES (3202,'doACPolicyPut','2017-03-14 19:58:19',0,'BRMSParam vFW Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:','doACPolicyPut','2017-03-14 19:58:19','<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:256f4712-a965-4817-a851-a71bdeb9fb49\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n <Description>BRMSParam vFW Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>\n <Target>\n <AnyOf>\n <AllOf>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"PolicyName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n <AllOf>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DROOLS</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ONAPName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">BRMS_PARAM_RULE</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ConfigName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskType\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskLevel\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"guard\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"TTLDate\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n </AnyOf>\n </Target>\n <Rule RuleId=\"urn:com:xacml:rule:id:8cdb88aa-448b-4ed1-bce5-6a037651e73c\" Effect=\"Permit\">\n <Target>\n <AnyOf>\n <AllOf>\n <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">ACCESS</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Config</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n </AnyOf>\n </Target>\n <AdviceExpressions>\n <AdviceExpression AdviceId=\"BRMSPARAMID\" AppliesTo=\"Permit\">\n <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Configuration</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"URLID\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URL/Config/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"PolicyName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"VersionNumber\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:ONAPName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DROOLS</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:ConfigName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">BRMS_PARAM_RULE</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"key:controller\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">vFW</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"RiskType\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"RiskLevel\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"guard\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"TTLDate\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n </AttributeAssignmentExpression>\n </AdviceExpression>\n </AdviceExpressions>\n </Rule>\n</Policy>\n','Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml',0,'com',1,NULL,3201),(3204,'doACPolicyPut','2017-03-14 20:00:56',0,'BRMSParam vLB Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:','doACPolicyPut','2017-03-14 20:00:56','<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Policy xmlns=\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" PolicyId=\"urn:com:xacml:policy:id:ace93d23-7a21-450a-87b4-5ff11e01d4b1\" Version=\"1\" RuleCombiningAlgId=\"urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides\">\n <Description>BRMSParam vLB Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>\n <Target>\n <AnyOf>\n <AllOf>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"PolicyName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n <AllOf>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DROOLS</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ONAPName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">BRMS_PARAM_RULE</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\" AttributeId=\"ConfigName\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskType\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"RiskLevel\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"guard\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"org.onap.function.regex-match\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"TTLDate\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n </AnyOf>\n </Target>\n <Rule RuleId=\"urn:com:xacml:rule:id:9d472f3a-bab1-4bee-8bfc-0ee1b4e11ad6\" Effect=\"Permit\">\n <Target>\n <AnyOf>\n <AllOf>\n <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">ACCESS</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:action:action-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n <Match MatchId=\"urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Config</AttributeValue>\n <AttributeDesignator Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" AttributeId=\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\" DataType=\"http://www.w3.org/2001/XMLSchema#string\" MustBePresent=\"false\"/>\n </Match>\n </AllOf>\n </AnyOf>\n </Target>\n <AdviceExpressions>\n <AdviceExpression AdviceId=\"BRMSPARAMID\" AppliesTo=\"Permit\">\n <AttributeAssignmentExpression AttributeId=\"type\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">Configuration</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"URLID\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#anyURI\">$URL/Config/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"PolicyName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"VersionNumber\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:ONAPName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">DROOLS</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"matching:ConfigName\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">BRMS_PARAM_RULE</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"key:controller\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">vDNS</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"RiskType\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">SampleRiskType</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"RiskLevel\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">1</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"guard\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">False</AttributeValue>\n </AttributeAssignmentExpression>\n <AttributeAssignmentExpression AttributeId=\"TTLDate\" Category=\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\" Issuer=\"\">\n <AttributeValue DataType=\"http://www.w3.org/2001/XMLSchema#string\">NA</AttributeValue>\n </AttributeAssignmentExpression>\n </AdviceExpression>\n </AdviceExpressions>\n </Rule>\n</Policy>\n','Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml',0,'com',1,NULL,3203);
-
-INSERT INTO `policyversion` VALUES (1,'com/Config_BRMS_Param_BRMSParamvFWDemoPolicy',1,1,'2017-03-03 17:16:37','demo','2017-03-03 17:16:37','demo'),(2,'com/Config_BRMS_Param_BRMSParamvLBDemoPolicy',1,1,'2017-03-03 17:20:03','demo','2017-03-03 17:20:03','demo');
-
-INSERT INTO `policyversion` VALUES (3,'com/Config_MS_vFirewall',1,1,'2017-03-03 17:26:26','demo','2017-03-03 17:26:26','demo'),(4,'com/Config_MS_vLoadBalancer',1,1,'2017-03-03 17:28:13','demo','2017-03-03 17:28:13','demo');
-
insert into sequence (seq_name, seq_count) values ('SEQ_GEN', 3050);
set foreign_key_checks=1;
diff --git a/packages/base/src/files/install/mysql/data/171001_upgrade_script.sql b/packages/base/src/files/install/mysql/data/171001_upgrade_script.sql
index c6f6303bd..8c61c91a8 100644
--- a/packages/base/src/files/install/mysql/data/171001_upgrade_script.sql
+++ b/packages/base/src/files/install/mysql/data/171001_upgrade_script.sql
@@ -26,4 +26,6 @@ CREATE TABLE `onap_sdk`.`rainydaytreatments` (
`workstep` varchar(250) DEFAULT NULL,
`treatments` varchar(1024) DEFAULT NULL,
PRIMARY KEY (`id`)
-); \ No newline at end of file
+);
+
+INSERT INTO `onap_sdk`.`microservicemodels` (`id`, `modelName`, `DESCRIPTION`, `Dependency`, `imported_by`, `attributes`, `ref_attributes`, `sub_attributes`, `version`, `enumValues`, `annotation`) VALUES ('1', 'tca_policy', 'MicroService TOSCA model', '[]', 'demo', '', 'tca_policy=tca_policy:MANY-false,', '{\"thresholds\":{\"severity\":\"string:defaultValue-null:required-null:MANY-false\",\"fieldPath\":\"string:defaultValue-null:required-null:MANY-false\",\"thresholdValue\":\"integer:defaultValue-null:required-null:MANY-false\",\"closedLoopEventStatus\":\"string:defaultValue-null:required-null:MANY-false\",\"closedLoopControlName\":\"string:defaultValue-null:required-null:MANY-false\",\"version\":\"string:defaultValue-null:required-null:MANY-false\",\"direction\":\"string:defaultValue-null:required-null:MANY-false\"},\"tca_policy\":{\"domain\":\"string:defaultValue-null:required-null:MANY-false\",\"metricsPerEventName\":\"metricsPerEventName:MANY-true\"},\"metricsPerEventName\":{\"policyVersion\":\"string:defaultValue-null:required-null:MANY-false\",\"thresholds\":\"thresholds:MANY-true\",\"policyName\":\"string:defaultValue-null:required-null:MANY-false\",\"controlLoopSchemaType\":\"string:defaultValue-null:required-null:MANY-false\",\"policyScope\":\"string:defaultValue-null:required-null:MANY-false\",\"eventName\":\"string:defaultValue-null:required-null:MANY-false\"}}', '1.1.0', '', '');
diff --git a/packages/base/src/files/install/servers/brmsgw/config.properties b/packages/base/src/files/install/servers/brmsgw/config.properties
index 9e95ed719..f56e87cf3 100644
--- a/packages/base/src/files/install/servers/brmsgw/config.properties
+++ b/packages/base/src/files/install/servers/brmsgw/config.properties
@@ -54,14 +54,12 @@ repositoryPassword = ${{repositoryPassword}}
policyKeyID = controller
## GroupNames can be comma separated values.
-groupNames = default, vFW , vDNS
+groupNames = default, amsterdam
default.groupID = ${{groupID}}
default.artifactID = ${{artifactID}}
-vFW.groupID= ${{VFW_GROUP_ID}}
-vFW.artifactID= ${{VFW_ARTIFACT_ID}}
-vDNS.groupID= ${{VDNS_GROUP_ID}}
-vDNS.artifactID= ${{VDNS_ARTIFACT_ID}}
+amsterdam.groupID= ${{AMSTERDAM_GROUP_ID}}
+amsterdam.artifactID= ${{AMSTERDAM_ARTIFACT_ID}}
#Integrity Monitor values
#database driver for Integrity Monitor
diff --git a/packages/base/src/files/install/servers/brmsgw/dependency.json b/packages/base/src/files/install/servers/brmsgw/dependency.json
index 9c25c743b..ffd368ecb 100644
--- a/packages/base/src/files/install/servers/brmsgw/dependency.json
+++ b/packages/base/src/files/install/servers/brmsgw/dependency.json
@@ -28,6 +28,75 @@
"groupId": "org.onap.policy.drools-applications",
"artifactId": "trafficgenerator",
"version": "${{BRMS_DEPENDENCY_VERSION}}"
- }]
- }
+ }],
+ "amsterdam": [{
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "events",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "appc",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "appclcm",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "vfc",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "so",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "aai",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "sdc",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "trafficgenerator",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "eventmanager",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "guard",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actorServiceProvider",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actor.appc",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actor.appclcm",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actor.so",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "actor.vfc",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "org.onap.policy.drools-applications",
+ "artifactId": "policy-yaml",
+ "version": "${{BRMS_DEPENDENCY_VERSION}}"
+ }, {
+ "groupId": "com.att.research.xacml",
+ "artifactId": "xacml-pdp",
+ "version": "1.0.0"
+ }]
+ }
} \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml b/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml
deleted file mode 100755
index e57f8fa4c..000000000
--- a/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:256f4712-a965-4817-a851-a71bdeb9fb49" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
- <Description>BRMSParam vFW Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DROOLS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">BRMS_PARAM_RULE</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <Rule RuleId="urn:com:xacml:rule:id:8cdb88aa-448b-4ed1-bce5-6a037651e73c" Effect="Permit">
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <AdviceExpressions>
- <AdviceExpression AdviceId="BRMSPARAMID" AppliesTo="Permit">
- <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DROOLS</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">BRMS_PARAM_RULE</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="key:controller" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">vFW</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- </AttributeAssignmentExpression>
- </AdviceExpression>
- </AdviceExpressions>
- </Rule>
-</Policy> \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml b/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml
deleted file mode 100755
index 7b60d8e86..000000000
--- a/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:ace93d23-7a21-450a-87b4-5ff11e01d4b1" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
- <Description>BRMSParam vLB Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DROOLS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">BRMS_PARAM_RULE</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <Rule RuleId="urn:com:xacml:rule:id:9d472f3a-bab1-4bee-8bfc-0ee1b4e11ad6" Effect="Permit">
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <AdviceExpressions>
- <AdviceExpression AdviceId="BRMSPARAMID" AppliesTo="Permit">
- <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DROOLS</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">BRMS_PARAM_RULE</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="key:controller" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">vDNS</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- </AttributeAssignmentExpression>
- </AdviceExpression>
- </AdviceExpressions>
- </Rule>
-</Policy> \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_MS_vFirewall.1.xml b/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_MS_vFirewall.1.xml
deleted file mode 100644
index 3b81613bc..000000000
--- a/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_MS_vFirewall.1.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:34928b05-b0f6-4974-8458-f4d34a2a1764" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
- <Description>Micro Service vFirewall Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:</Description>
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_MS_vFirewall.1.xml</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DCAE</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleConfigName</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">TcaMetrics-v1.0.0.5</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="service" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="uuid" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleServiceLocation</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="location" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <Rule RuleId="urn:com:xacml:rule:id:063161de-0534-4989-bd01-42f784daf21e" Effect="Permit">
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <AdviceExpressions>
- <AdviceExpression AdviceId="MSID" AppliesTo="Permit">
- <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_MS_vFirewall.1.json</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_MS_vFirewall.1.xml</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DCAE</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleConfigName</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:service" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">TcaMetrics-v1.0.0.5</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:uuid" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:Location" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleServiceLocation</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="Priority" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- </AttributeAssignmentExpression>
- </AdviceExpression>
- </AdviceExpressions>
- </Rule>
-</Policy> \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_MS_vLoadBalancer.1.xml b/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_MS_vLoadBalancer.1.xml
deleted file mode 100644
index d48bf9e22..000000000
--- a/packages/base/src/files/install/servers/console/bin/workspace/admin/repository/com/Config_MS_vLoadBalancer.1.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:c220802a-70ee-4ca8-9f1e-f8a515650381" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
- <Description>Micro Service vLoadBalancer Demo Policy@CreatedBy:demo@CreatedBy:@ModifiedBy:demo@ModifiedBy:</Description>
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_MS_vLoadBalancer.1.xml</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DCAE</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleConfigName</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">TcaMetrics-v1.0.0.5</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="service" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="uuid" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleServiceLocation</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="location" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <Rule RuleId="urn:com:xacml:rule:id:fca27dab-6c09-4541-8136-328abaec2656" Effect="Permit">
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <AdviceExpressions>
- <AdviceExpression AdviceId="MSID" AppliesTo="Permit">
- <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_MS_vLoadBalancer.1.json</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_MS_vLoadBalancer.1.xml</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DCAE</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleConfigName</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:service" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">TcaMetrics-v1.0.0.5</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:uuid" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:Location" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleServiceLocation</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="Priority" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- </AttributeAssignmentExpression>
- </AdviceExpression>
- </AdviceExpressions>
- </Rule>
-</Policy> \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/onap/WEB-INF/classes/portal.properties b/packages/base/src/files/install/servers/onap/WEB-INF/classes/portal.properties
index 6b5ba6186..4c95afbcc 100644
--- a/packages/base/src/files/install/servers/onap/WEB-INF/classes/portal.properties
+++ b/packages/base/src/files/install/servers/onap/WEB-INF/classes/portal.properties
@@ -28,11 +28,6 @@ portal.api.prefix = /api
max.idle.time = 5
user.attribute.name = user_attribute
-# CSP settings
-csp_cookie_name = attESSec
-csp_gate_keeper_prod_key = PROD
-testing=testing
-
#Use REST API instead of UEB to fetch the functional menu data
use_rest_for_functional_menu=true
@@ -44,11 +39,11 @@ use_rest_for_functional_menu=true
portal.api.impl.class = org.openecomp.portalapp.service.OnBoardingApiServiceImpl
# CSP Global Log On for single sign on
-onap_redirect_url = ${{ONAP_REDIRECT_URL}}
+ecomp_redirect_url = ${{ONAP_REDIRECT_URL}}
# URL of the ONAP Portal REST API
# onap.homer.com is a development machine
-onap_rest_url = ${{ONAP_REST_URL}}
+ecomp_rest_url = ${{ONAP_REST_URL}}
# Applications do not need to run a UEB listener in 1610.
ueb_listeners_enable = false
@@ -60,7 +55,7 @@ ueb_listeners_enable = false
# UEB servers
ueb_url_list = ${{ONAP_UEB_URL_LIST}}
# ONAP Portal listens on this UEB topic
-onap_portal_inbox_name = ${{ONAP_PORTAL_INBOX_NAME}}
+ecomp_portal_inbox_name = ${{ONAP_PORTAL_INBOX_NAME}}
# Replace these 3 default values with the ones for your specific App,
# as shown on the on-boarding page on the ONAP Portal web application.
ueb_app_key = ${{ONAP_UEB_APP_KEY}}
diff --git a/packages/base/src/files/install/servers/onap/WEB-INF/conf/system.properties b/packages/base/src/files/install/servers/onap/WEB-INF/conf/system.properties
index 387a4e29b..bb33c3f7a 100644
--- a/packages/base/src/files/install/servers/onap/WEB-INF/conf/system.properties
+++ b/packages/base/src/files/install/servers/onap/WEB-INF/conf/system.properties
@@ -65,7 +65,7 @@ mylogins_feed_cron = 0 0/60 * * * ?;
my_login_feed_output_dir = /tmp/MyLogins
# ONAP Portal Shared Context REST API URL
-onap_shared_context_rest_url= ${{ONAP_SHARED_CONTEXT_REST_URL}}
+ecomp_shared_context_rest_url= ${{ONAP_SHARED_CONTEXT_REST_URL}}
# Link shown in Help menu
contact_us_link =
diff --git a/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml b/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml
deleted file mode 100644
index e27f163b6..000000000
--- a/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:0f246245-4e4e-4fb4-87f2-c95ebc0b6c30" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
- <Description>vFW Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DROOLS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">BRMS_PARAM_RULE</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <Rule RuleId="urn:com:xacml:rule:id:d4281b8e-698f-4860-b96f-aa85f70710a6" Effect="Permit">
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <AdviceExpressions>
- <AdviceExpression AdviceId="BRMSPARAMID" AppliesTo="Permit">
- <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DROOLS</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">BRMS_PARAM_RULE</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="key:controller" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">vFW</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- </AttributeAssignmentExpression>
- </AdviceExpression>
- </AdviceExpressions>
- </Rule>
-</Policy> \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml b/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml
deleted file mode 100644
index 54bcbaaf0..000000000
--- a/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:a5230f4f-23c0-47ed-a039-61c47f87d4ed" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
- <Description>vLB Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DROOLS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">BRMS_PARAM_RULE</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <Rule RuleId="urn:com:xacml:rule:id:7df3cfcd-0e50-4569-b9b8-abf5022e8e1c" Effect="Permit">
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <AdviceExpressions>
- <AdviceExpression AdviceId="BRMSPARAMID" AppliesTo="Permit">
- <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DROOLS</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">BRMS_PARAM_RULE</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="key:controller" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">vDNS</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- </AttributeAssignmentExpression>
- </AdviceExpression>
- </AdviceExpressions>
- </Rule>
-</Policy> \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_MS_vFirewall.1.xml b/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_MS_vFirewall.1.xml
deleted file mode 100644
index ca01be5a7..000000000
--- a/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_MS_vFirewall.1.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:74c4f8d3-293e-475e-bdda-ad0812873733" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
- <Description>Micro Service vFirewall Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_MS_vFirewall.1.xml</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DCAE</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleConfigName</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">TcaMetrics-v1.0.0.5</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="service" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="uuid" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleServiceLocation</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="location" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <Rule RuleId="urn:com:xacml:rule:id:2f26c8c8-ee97-4e68-a5b0-2af7d72015e1" Effect="Permit">
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <AdviceExpressions>
- <AdviceExpression AdviceId="MSID" AppliesTo="Permit">
- <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_MS_vFirewall.1.json</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_MS_vFirewall.1.xml</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DCAE</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleConfigName</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:service" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">TcaMetrics-v1.0.0.5</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:uuid" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:Location" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleServiceLocation</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="Priority" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- </AttributeAssignmentExpression>
- </AdviceExpression>
- </AdviceExpressions>
- </Rule>
-</Policy> \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_MS_vLoadBalancer.1.xml b/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_MS_vLoadBalancer.1.xml
deleted file mode 100644
index 663f4f3c5..000000000
--- a/packages/base/src/files/install/servers/pap/bin/pdps/default/com.Config_MS_vLoadBalancer.1.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:36f42684-7ba5-40dc-9824-1a3c16b4eb50" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
- <Description>Micro Service vLoadBalancer Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_MS_vLoadBalancer.1.xml</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- <AllOf>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DCAE</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ONAPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleConfigName</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ConfigName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">TcaMetrics-v1.0.0.5</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="service" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="uuid" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleServiceLocation</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="location" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskType" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="RiskLevel" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">False</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="guard" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="org.onap.function.regex-match">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="TTLDate" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <Rule RuleId="urn:com:xacml:rule:id:848c1e8b-facd-407b-bda8-dd1863c403a5" Effect="Permit">
- <Target>
- <AnyOf>
- <AllOf>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ACCESS</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Config</AttributeValue>
- <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
- </Match>
- </AllOf>
- </AnyOf>
- </Target>
- <AdviceExpressions>
- <AdviceExpression AdviceId="MSID" AppliesTo="Permit">
- <AttributeAssignmentExpression AttributeId="type" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Configuration</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="URLID" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">$URL/Config/com.Config_MS_vLoadBalancer.1.json</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="PolicyName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">com.Config_MS_vLoadBalancer.1.xml</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="VersionNumber" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ONAPName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DCAE</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:ConfigName" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleConfigName</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:service" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">TcaMetrics-v1.0.0.5</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:uuid" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="matching:Location" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleServiceLocation</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="Priority" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskType" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">SampleRiskType</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="RiskLevel" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="guard" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">1</AttributeValue>
- </AttributeAssignmentExpression>
- <AttributeAssignmentExpression AttributeId="TTLDate" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Issuer="">
- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">NA</AttributeValue>
- </AttributeAssignmentExpression>
- </AdviceExpression>
- </AdviceExpressions>
- </Rule>
-</Policy> \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/pap/bin/pdps/default/xacml.pip.properties b/packages/base/src/files/install/servers/pap/bin/pdps/default/xacml.pip.properties
deleted file mode 100644
index 846848f28..000000000
--- a/packages/base/src/files/install/servers/pap/bin/pdps/default/xacml.pip.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-#Tue Feb 07 10:35:08 EST 2017
-AAF.description=AAFEngine to communicate with AAF to take decisions
-AAF.classname=org.onap.policy.xacml.std.pip.engines.aaf.AAFEngine
-AAF.name=AAFEngine
-xacml.pip.engines=AAF \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/pap/bin/pdps/default/xacml.policy.properties b/packages/base/src/files/install/servers/pap/bin/pdps/default/xacml.policy.properties
deleted file mode 100644
index bddd54f5d..000000000
--- a/packages/base/src/files/install/servers/pap/bin/pdps/default/xacml.policy.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-#Tue Feb 07 10:35:08 EST 2017
-com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml.name=Config_BRMS_Param_BRMSParamvFWDemoPolicy
-com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml.name=Config_BRMS_Param_BRMSParamvLBDemoPolicy
-com.Config_MS_vFirewall.1.xml.name=Config_MS_vFirewall
-com.Config_MS_vLoadBalancer.1.xml.name=Config_MS_vLoadBalancer
-xacml.referencedPolicies=
-xacml.rootPolicies=com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml,com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.xml,com.Config_MS_vLoadBalancer.1.xml,com.Config_MS_vFirewall.1.xml \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt b/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt
deleted file mode 100755
index 6ff244ea4..000000000
--- a/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt
+++ /dev/null
@@ -1,1145 +0,0 @@
-/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI purpose.
- <$%BRMSParamTemplate=ControlLoopDemo__closedLoopControlName%$>
- */
-
-
-/*-
- * ============LICENSE_START=======================================================
- * archetype-closed-loop-demo-rules
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop;
-
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.UUID;
-
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.ControlLoopEventStatus;
-import org.onap.policy.controlloop.VirtualControlLoopNotification;
-import org.onap.policy.controlloop.ControlLoopNotificationType;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopOperationWrapper;
-import org.onap.policy.template.demo.ControlLoopException;
-
-import org.onap.policy.aai.AAINQF199.AAINQF199CloudRegion;
-import org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperties;
-import org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperty;
-import org.onap.policy.aai.AAINQF199.AAINQF199GenericVNF;
-import org.onap.policy.aai.AAINQF199.AAINQF199InstanceFilters;
-import org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;
-import org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItems;
-import org.onap.policy.aai.AAINQF199.AAINQF199Manager;
-import org.onap.policy.aai.AAINQF199.AAINQF199NamedQuery;
-import org.onap.policy.aai.AAINQF199.AAINQF199QueryParameters;
-import org.onap.policy.aai.AAINQF199.AAINQF199Request;
-import org.onap.policy.aai.AAINQF199.AAINQF199RequestWrapper;
-import org.onap.policy.aai.AAINQF199.AAINQF199Response;
-import org.onap.policy.aai.AAINQF199.AAINQF199ResponseWrapper;
-import org.onap.policy.aai.AAINQF199.AAINQF199ServiceInstance;
-import org.onap.policy.aai.AAINQF199.AAINQF199Tenant;
-import org.onap.policy.aai.AAINQF199.AAINQF199VfModule;
-import org.onap.policy.aai.AAINQF199.AAINQF199VServer;
-import org.onap.policy.aai.util.Serialization;
-
-import org.onap.policy.appc.CommonHeader;
-import org.onap.policy.appc.Request;
-import org.onap.policy.appc.Response;
-import org.onap.policy.appc.ResponseCode;
-import org.onap.policy.appc.ResponseStatus;
-import org.onap.policy.appc.ResponseValue;
-
-import org.onap.policy.template.demo.EventManager;
-import org.onap.policy.vnf.trafficgenerator.PGRequest;
-import org.onap.policy.vnf.trafficgenerator.PGStream;
-import org.onap.policy.vnf.trafficgenerator.PGStreams;
-
-import org.onap.policy.mso.MSOManager;
-import org.onap.policy.mso.MSORequest;
-import org.onap.policy.mso.MSORequestStatus;
-import org.onap.policy.mso.MSORequestDetails;
-import org.onap.policy.mso.MSOModelInfo;
-import org.onap.policy.mso.MSOCloudConfiguration;
-import org.onap.policy.mso.MSORequestInfo;
-import org.onap.policy.mso.MSORequestParameters;
-import org.onap.policy.mso.MSORelatedInstanceListElement;
-import org.onap.policy.mso.MSORelatedInstance;
-import org.onap.policy.mso.MSOResponse;
-
-import org.onap.policy.drools.system.PolicyEngine;
-
-//
-// These parameters are required to build the runtime policy
-//
-declare Params
- closedLoopControlName : String
- actor : String
- aaiURL : String
- aaiUsername : String
- aaiPassword : String
- msoURL : String
- msoUsername : String
- msoPassword : String
- aaiNamedQueryUUID : String
- aaiPatternMatch : int
- notificationTopic : String
- appcTopic : String
-end
-
-/*
-*
-* Called once and only once to insert the parameters into working memory for this Closed Loop policy.
-* (Comment SETUP rule out for the first ONAP opensource release since policy BRMS_GW already puts a Params fact in there)
-*
-*
-*rule "BRMSParamvFWDemoPolicy.SETUP"
-* when
-* then
-* System.out.println("rule SETUP is triggered.");
-* Params params = new Params();
-* params.setClosedLoopControlName("CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8");
-* params.setActor("APPC");
-* params.setAaiURL("null");
-* params.setAaiUsername("null");
-* params.setAaiPassword("null");
-* params.setMsoURL("null");
-* params.setMsoUsername("null");
-* params.setMsoPassword("null");
-* params.setAaiNamedQueryUUID("null");
-* params.setAaiPatternMatch(1);
-* params.setNotificationTopic("POLICY-CL-MGT");
-* params.setAppcTopic("APPC-CL");
-* //
-* // This stays in memory as long as the rule is alive and running
-* //
-* insert(params);
-*end
-*/
-/*
-*
-* This rule responds to DCAE Events
-*
-*/
-rule "BRMSParamvFWDemoPolicy.EVENT"
- when
- $params : Params( getClosedLoopControlName() == "CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- not ( EventManager( closedLoopControlName == $event.closedLoopControlName ))
- then
- System.out.println("rule EVENT is triggered.");
- try {
- //
- // Check the requestID in the event to make sure it is not null before we create the EventManager.
- // The EventManager will do extra syntax checking as well check if the closed loop is disabled/
- //
- if ($event.requestID == null) {
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.REJECTED;
- notification.from = "policy";
- notification.message = "Missing requestID from DCAE event";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver notification: " + notification);
- }
- //
- // Retract it from memory
- //
- retract($event);
- System.out.println("Event with requestID=null has been retracted.");
- } else {
- //
- // Create an EventManager
- //
- EventManager manager = new EventManager($params.getClosedLoopControlName(), $event.requestID, $event.target);
- //
- // Determine if EventManager can actively process the event (i.e. syntax)
- //
- VirtualControlLoopNotification notification = manager.activate($event);
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- //
- // Are we actively pursuing this event?
- //
- if (notification.notification == ControlLoopNotificationType.ACTIVE) {
- //
- // Insert Event Manager into memory, this will now kick off processing.
- //
- insert(manager);
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver notification: " + notification);
- }
- } else {
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver notification: " + notification);
- }
- //
- // Retract it from memory
- //
- retract($event);
- }
- //
- // Now that the manager is inserted into Drools working memory, we'll wait for
- // another rule to fire in order to continue processing. This way we can also
- // then screen for additional ONSET and ABATED events for this same RequestIDs
- // and for different RequestIDs but with the same closedLoopControlName and target.
- //
- }
- //
- } catch (Exception e) {
- e.printStackTrace();
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.REJECTED;
- notification.message = "Exception occurred " + e.getMessage();
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- //
- //
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e1) {
- System.out.println("Can't deliver notification: " + notification);
- e1.printStackTrace();
- }
- //
- // Retract the event
- //
- retract($event);
- }
-end
-
-/*
-*
-* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager
-* is created. We can start the operations for this closed loop.
-*
-*/
-rule "BRMSParamvFWDemoPolicy.EVENT.MANAGER"
- when
- $params : Params( getClosedLoopControlName() == "CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName, controlLoopResult == null)
- then
- System.out.println("rule EVENT.MANAGER is triggered.");
- //
- // Check which event this is.
- //
- EventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);
- //
- // We only want the initial ONSET event in memory,
- // all the other events need to be retracted to support
- // cleanup and avoid the other rules being fired for this event.
- //
- if (eventStatus != EventManager.NEW_EVENT_STATUS.FIRST_ONSET) {
- System.out.println("Retracting "+eventStatus+" Event.");
- retract($event);
- return;
- }
- //
- // Now the event in memory is first onset event
- //
- try {
- //
- // Pull the known AAI field from the Event
- //
- // generic-vnf is needed for vFirewall case
- // vserver-name is needed for vLoadBalancer case
- //
- String genericVNF = $event.AAI.get("generic-vnf.vnf-id");
- String vserver = $event.AAI.get("vserver.vserver-name");
- //
- // Check if we are implementing a simple pattern match.
- //
- if ($params.getAaiPatternMatch() == 1) {
- //
- // Yes
- //
- //Basic naming characteristics:
- //VF Name (9 char)+VM name (13 char total)+VFC (19 char total)
- //Example:
- //VF Name (9 characters): cscf0001v
- //VM Name(13 characters): cscf0001vm001
- //VFC name(19 characters): cscf0001vm001cfg001
- //
- // zdfw1fwl01fwl02 or zdfw1fwl01fwl01
- // replaced with
- // zdfw1fwl01pgn02 or zdfw1fwl01pgn01
- //
- int index = genericVNF.lastIndexOf("fwl");
- if (index == -1) {
- System.err.println("The generic-vnf.vnf-id from DCAE Event is not valid.");
- } else {
- genericVNF = genericVNF.substring(0, index) + "pgn" + genericVNF.substring(index+"fwl".length());
- }
- //
- // Construct an APPC request
- //
- ControlLoopOperation operation = new ControlLoopOperation();
- operation.actor = $params.getActor();
- operation.operation = "ModifyConfig";
- operation.target = $event.target;
- //
- // Create operationWrapper
- //
- ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
- //
- // insert operationWrapper into memory
- //
- insert(operationWrapper);
- //
- Request request = new Request();
- request.CommonHeader = new CommonHeader();
- request.CommonHeader.RequestID = $event.requestID;
- request.Action = operation.operation;
- request.Payload = new HashMap<String, Object>();
- //
- // Fill in the payload
- //
- request.Payload.put("generic-vnf.vnf-id", genericVNF);
- //
- PGRequest pgRequest = new PGRequest();
- pgRequest.pgStreams = new PGStreams();
-
- PGStream pgStream;
- for(int i = 0; i < 5; i++){
- pgStream = new PGStream();
- pgStream.streamId = "fw_udp"+(i+1);
- pgStream.isEnabled = "true";
- pgRequest.pgStreams.pgStream.add(pgStream);
- }
- request.Payload.put("pg-streams", pgRequest.pgStreams);
-
- if (request != null) {
- //
- // Insert request into memory
- //
- insert(request);
- //
- // Tell interested parties we are performing this Operation
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.OPERATION;
- // message and history ??
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // Now send the operation request
- //
- if (request instanceof Request) {
- try {
- System.out.println("APPC request sent:");
- System.out.println(Serialization.gsonPretty.toJson(request));
- PolicyEngine.manager.deliver($params.getAppcTopic(), request);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver request: " + request);
- }
- }
- } else {
- //
- // what happens if it is null
- //
- }
- //
- } else {
- //
- // create AAI named-query request with UUID started with "F199"
- //
- AAINQF199Request aainqf199request = new AAINQF199Request();
- AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();
- AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();
- AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();
- //
- // queryParameters
- //
- aainqf199namedquery.namedQueryUUID = UUID.fromString($params.getAaiNamedQueryUUID());
- aainqf199queryparam.namedQuery = aainqf199namedquery;
- aainqf199request.queryParameters = aainqf199queryparam;
- //
- // instanceFilters
- //
- Map aainqf199instancefiltermap = new HashMap();
- Map aainqf199instancefiltermapitem = new HashMap();
- aainqf199instancefiltermapitem.put("vserver-name", vserver);
- aainqf199instancefiltermap.put("vserver", aainqf199instancefiltermapitem);
- aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);
- aainqf199request.instanceFilters = aainqf199instancefilter;
- //
- // print aainqf199request for debug
- //
- System.out.println("AAI Request sent:");
- System.out.println(Serialization.gsonPretty.toJson(aainqf199request));
- //
- // Create AAINQF199RequestWrapper
- //
- AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper($event.requestID, aainqf199request);
- //
- // insert aainqf199request into memory
- //
- insert(aainqf199RequestWrapper);
- }
- //
- } catch (Exception e) {
- e.printStackTrace();
- }
-end
-
-/*
-*
-* This rule happens when we got a valid ONSET, closed loop is enabled, an Event Manager
-* is created, AAI Manager and AAI Request are ready in memory. We can start sending query to AAI and then wait for response.
-*
-*/
-rule "BRMSParamvFWDemoPolicy.EVENT.MANAGER.AAINQF199REQUEST"
- when
- $params : Params( getClosedLoopControlName() == "CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
- $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)
- then
- System.out.println("rule EVENT.MANAGER.AAINQF199REQUEST is triggered.");
- //
- // send the request
- //
- AAINQF199Response aainqf199response = AAINQF199Manager.postQuery($params.getAaiURL(), $params.getAaiUsername(), $params.getAaiPassword(),
- $aainqf199RequestWrapper.aainqf199request, $event.requestID);
- //
- // Check AAI response
- //
- if (aainqf199response == null) {
- System.err.println("Failed to get AAI response");
- //
- // Fail and retract everything
- //
- retract($event);
- retract($manager);
- retract($aainqf199RequestWrapper);
- } else {
- //
- // Create AAINQF199ResponseWrapper
- //
- AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper($event.requestID, aainqf199response);
- //
- // insert aainqf199ResponseWrapper to memeory
- //
- insert(aainqf199ResponseWrapper);
- }
-end
-
-/*
-*
-* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.
-*
-*/
-rule "BRMSParamvFWDemoPolicy.EVENT.MANAGER.AAINQF199RESPONSE"
- when
- $params : Params( getClosedLoopControlName() == "CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
- $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)
- $aainqf199ResponseWrapper : AAINQF199ResponseWrapper(requestID == $event.requestID)
- then
- System.out.println("rule EVENT.MANAGER.AAINQF199RESPONSE is triggered.");
- //
- // Extract related fields out of AAINQF199RESPONSE
- //
- String vnfItemVnfId, vnfItemVnfType, vnfItemPersonaModelId, vnfItemPersonaModelVersion, vnfItemModelName,
- vnfItemModelVersion, vnfItemModelNameVersionId, serviceItemServiceInstanceId, serviceItemPersonaModelId,
- serviceItemModelName, serviceItemModelType, serviceItemModelVersion, serviceItemModelNameVersionId,
- vfModuleItemVfModuleName, vfModuleItemPersonaModelId, vfModuleItemPersonaModelVersion, vfModuleItemModelName,
- vfModuleItemModelNameVersionId, tenantItemTenantId, cloudRegionItemCloudRegionId;
- try {
- //
- // vnfItem
- //
- vnfItemVnfId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID;
- vnfItemVnfType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType;
- vnfItemVnfType = vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf("/")+1);
- vnfItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId;
- vnfItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion;
- vnfItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;
- vnfItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue;
- vnfItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;
- //
- // serviceItem
- //
- serviceItemServiceInstanceId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID;
- serviceItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId;
- serviceItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;
- serviceItemModelType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue;
- serviceItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion;
- serviceItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;
- //
- // Find the index for base vf module and non-base vf module
- //
- int baseIndex = -1;
- int nonBaseIndex = -1;
- List<AAINQF199InventoryResponseItem> inventoryItems = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems;
- for (AAINQF199InventoryResponseItem m : inventoryItems) {
- if (m.vfModule != null && m.vfModule.isBaseVfModule == true) {
- baseIndex = inventoryItems.indexOf(m);
- } else if (m.vfModule != null && m.vfModule.isBaseVfModule == false && m.vfModule.orchestrationStatus == null) {
- nonBaseIndex = inventoryItems.indexOf(m);
- }
- //
- if (baseIndex != -1 && nonBaseIndex != -1) {
- break;
- }
- }
- //
- // Report the error if either base vf module or non-base vf module is not found
- //
- if (baseIndex == -1 || nonBaseIndex == -1) {
- System.err.println("Either base or non-base vf module is not found from AAI response.");
- retract($aainqf199RequestWrapper);
- retract($aainqf199ResponseWrapper);
- retract($manager);
- retract($event);
- return;
- }
- //
- // This comes from the base module
- //
- vfModuleItemVfModuleName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.vfModuleName;
- vfModuleItemVfModuleName = vfModuleItemVfModuleName.replace("Vfmodule", "vDNS");
- //
- // vfModuleItem - NOT the base module
- //
- vfModuleItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelId;
- vfModuleItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelVersion;
- vfModuleItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(0).propertyValue;
- vfModuleItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue;
- //
- // tenantItem
- //
- tenantItemTenantId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId;
- //
- // cloudRegionItem
- //
- cloudRegionItemCloudRegionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;
- //
- } catch (Exception e) {
- e.printStackTrace();
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.REJECTED;
- notification.message = "Exception occurred " + e.getMessage();
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e1) {
- System.out.println("Can't deliver notification: " + notification);
- e1.printStackTrace();
- }
- //
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- notification.message = "Invalid named-query response from AAI";
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e1) {
- System.out.println("Can't deliver notification: " + notification);
- e1.printStackTrace();
- }
- //
- // Retract everything
- //
- retract($aainqf199RequestWrapper);
- retract($aainqf199ResponseWrapper);
- retract($manager);
- retract($event);
- return;
- }
- //
- // Extracted fields should not be null
- //
- if ((vnfItemVnfId == null) || (vnfItemVnfType == null) ||
- (vnfItemPersonaModelId == null) || (vnfItemModelName == null) ||
- (vnfItemModelVersion == null) || (vnfItemModelNameVersionId == null) ||
- (serviceItemServiceInstanceId == null) || (serviceItemModelName == null) ||
- (serviceItemModelType == null) || (serviceItemModelVersion == null) ||
- (serviceItemModelNameVersionId == null) || (vfModuleItemVfModuleName == null) ||
- (vfModuleItemPersonaModelId == null) || (vfModuleItemPersonaModelVersion == null) ||
- (vfModuleItemModelName == null) || (vfModuleItemModelNameVersionId == null) ||
- (tenantItemTenantId == null) || (cloudRegionItemCloudRegionId == null)) {
- //
- System.err.println("some fields are missing from AAI response.");
- //
- // Fail and retract everything
- //
- retract($aainqf199RequestWrapper);
- retract($aainqf199ResponseWrapper);
- retract($manager);
- retract($event);
- return;
- }
- //
- // We don't need them any more
- //
- retract($aainqf199ResponseWrapper);
- retract($aainqf199RequestWrapper);
- //
- // check the actor of this closed loop
- //
- switch ($params.getActor()) {
- case "APPC":
- {
- //
- // Construct an APPC request
- //
- ControlLoopOperation operation = new ControlLoopOperation();
- operation.actor = $params.getActor();
- operation.operation = "ModifyConfig";
- operation.target = $event.target;
- //
- // Create operationWrapper
- //
- ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
- //
- // insert operationWrapper into memory
- //
- insert(operationWrapper);
- //
- Request request = new Request();
- request.CommonHeader = new CommonHeader();
- request.CommonHeader.RequestID = $event.requestID;
- request.Action = operation.operation;
- request.Payload = new HashMap<String, Object>();
- //
- // Fill in the payload
- // Hardcode genericVNF for now since AAI has not been ready for vFirewall demo case
- //
- String genericVNF = "zdfw1fwl01pgn02";
- request.Payload.put("generic-vnf.vnf-id", genericVNF);
- //
- PGRequest pgRequest = new PGRequest();
- pgRequest.pgStreams = new PGStreams();
-
- PGStream pgStream;
- for(int i = 0; i < 5; i++){
- pgStream = new PGStream();
- pgStream.streamId = "fw_udp"+(i+1);
- pgStream.isEnabled = "true";
- pgRequest.pgStreams.pgStream.add(pgStream);
- }
- request.Payload.put("pg-streams", pgRequest.pgStreams);
-
- if (request != null) {
- //
- // Insert request into memory
- //
- insert(request);
- //
- // Tell interested parties we are performing this Operation
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.OPERATION;
- // message and history ??
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // Now send the operation request
- //
- if (request instanceof Request) {
- try {
- System.out.println("APPC request sent:");
- System.out.println(Serialization.gsonPretty.toJson(request));
- PolicyEngine.manager.deliver($params.getAppcTopic(), request);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver request: " + request);
- }
- }
- } else {
- //
- // what happens if it is null
- //
- }
- }
- break;
- case "MSO":
- {
- //
- // Construct an operation
- //
- ControlLoopOperation operation = new ControlLoopOperation();
- operation.actor = $params.getActor();
- operation.operation = "createModuleInstance";
- operation.target = $event.target;
- //
- // Create operationWrapper
- //
- ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
- //
- // Construct an MSO request
- //
- MSORequest request = new MSORequest();
- request.requestDetails = new MSORequestDetails();
- request.requestDetails.modelInfo = new MSOModelInfo();
- request.requestDetails.cloudConfiguration = new MSOCloudConfiguration();
- request.requestDetails.requestInfo = new MSORequestInfo();
- request.requestDetails.requestParameters = new MSORequestParameters();
- request.requestDetails.requestParameters.userParams = null;
- //
- // cloudConfiguration
- //
- request.requestDetails.cloudConfiguration.lcpCloudRegionId = cloudRegionItemCloudRegionId;
- request.requestDetails.cloudConfiguration.tenantId = tenantItemTenantId;
- //
- // modelInfo
- //
- request.requestDetails.modelInfo.modelType = "vfModule";
- request.requestDetails.modelInfo.modelInvariantId = vfModuleItemPersonaModelId;
- request.requestDetails.modelInfo.modelNameVersionId = vfModuleItemModelNameVersionId;
- request.requestDetails.modelInfo.modelName = vfModuleItemModelName;
- request.requestDetails.modelInfo.modelVersion = vfModuleItemPersonaModelVersion;
- //
- // requestInfo
- //
- request.requestDetails.requestInfo.instanceName = vfModuleItemVfModuleName;
- request.requestDetails.requestInfo.source = "POLICY";
- request.requestDetails.requestInfo.suppressRollback = false;
- //
- // relatedInstanceList
- //
- MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();
- MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();
- relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();
- relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();
- //
- relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;
- relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();
- relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service";
- relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;
- relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;
- relatedInstanceListElement1.relatedInstance.modelInfo.modelName = serviceItemModelName;
- relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;
- //
- relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;
- relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();
- relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf";
- relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;
- relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;
- relatedInstanceListElement2.relatedInstance.modelInfo.modelName = vnfItemModelName;
- relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = vnfItemModelVersion;
- relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = vnfItemVnfType;
- //
- request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);
- request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
- //
- // print MSO request for debug
- //
- System.out.println("MSO request sent:");
- System.out.println(Serialization.gsonPretty.toJson(request));
- //
- //
- //
- if (request != null) {
- //
- // Tell interested parties we are performing this Operation
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.OPERATION;
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL
- //
- String MSOUrl = $params.getMsoURL() + "/serviceInstances/v2/" + serviceItemServiceInstanceId + "/vnfs/" + vnfItemVnfId + "/vfModules";
- //
- // Call MSO
- //
- MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);
- //
- if (response != null) {
- //
- // Assign requestId
- //
- request.requestId = $event.requestID.toString();
- response.request.requestId = $event.requestID.toString();
- //
- // Insert facts
- //
- insert(operationWrapper);
- insert(request);
- insert(response);
- } else {
- //
- // MSO request not even accepted
- //
- notification.message = operationWrapper.operation.toMessage();
- operationWrapper.operation.message = operationWrapper.operation.toMessage();
- operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
- $manager.setControlLoopResult("FAILURE_EXCEPTION");
- notification.history.add(operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // Retract everything
- //
- retract($event);
- retract($manager);
- }
- } else {
- System.err.println("constructed MSO request is invalid.");
- }
- }
- break;
- }
-end
-
-/*
-*
-* This rule responds to APPC Response Events
-*
-*/
-rule "BRMSParamvFWDemoPolicy.APPC.RESPONSE"
- when
- $params : Params( getClosedLoopControlName() == "CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
- $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )
- $request : Request( getCommonHeader().RequestID == $event.requestID )
- $response : Response( getCommonHeader().RequestID == $event.requestID )
- then
- System.out.println("rule APPC.RESPONSE is triggered.");
- if ($response.Status == null) {
- $operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
- $manager.setControlLoopResult("FAILURE_EXCEPTION");
- }
- //
- // Get the Response Code
- //
- ResponseCode code = ResponseCode.toResponseCode($response.Status.Code);
- if (code == null) {
- $operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
- $manager.setControlLoopResult("FAILURE_EXCEPTION");
- }
- //
- // Construct notification
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- notification.message = $operationWrapper.operation.toMessage();
- $operationWrapper.operation.message = $operationWrapper.operation.toMessage();
- //
- // Ok, let's figure out what APP-C's response is
- //
- switch (code) {
- case ACCEPT:
- $operationWrapper.operation.outcome = "PROCESSING";
- break;
- case ERROR:
- case REJECT:
- $operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
- $manager.setControlLoopResult("FAILURE_EXCEPTION");
- break;
- case SUCCESS:
- $operationWrapper.operation.outcome = "SUCCESS";
- $manager.setControlLoopResult("SUCCESS");
- break;
- case FAILURE:
- $operationWrapper.operation.outcome = "FAILURE";
- $manager.setControlLoopResult("FAILURE");
- break;
- }
- if ($operationWrapper.operation.outcome.equals("SUCCESS")) {
- notification.history.add($operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
-
- //
- // We are going to retract these objects from memory
- //
- System.out.println("Retracting everything");
- retract($operationWrapper);
- retract($request);
- retract($response);
- retract($event);
- retract($manager);
- } else if ($operationWrapper.operation.outcome.equals("PROCESSING")) {
- retract($response);
- } else {
- notification.history.add($operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // We are going to retract these objects from memory
- //
- System.out.println("Retracting everything");
- retract($operationWrapper);
- retract($request);
- retract($response);
- retract($event);
- retract($manager);
- }
-
-end
-
-/*
-*
-* This rule is used to clean up APPC response
-*
-*/
-rule "BRMSParamvFWDemoPolicy.APPC.RESPONSE.CLEANUP"
- when
- $params : Params( getClosedLoopControlName() == "CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $response : Response($id : getCommonHeader().RequestID )
- not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
- then
- System.out.println("rule APPC.RESPONSE.CLEANUP is triggered.");
- retract($response);
-end
-
-/*
-*
-* This rule responds to MSO Response Events
-*
-*/
-rule "BRMSParamvFWDemoPolicy.MSO.RESPONSE"
- when
- $params : Params( getClosedLoopControlName() == "CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
- $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )
- $request : MSORequest( requestId == $event.requestID.toString() )
- $response : MSOResponse( request.requestId == $event.requestID.toString() )
- then
- System.out.println("rule MSO.RESPONSE is triggered.");
- //
- // Construct notification
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- notification.message = $operationWrapper.operation.toMessage();
- $operationWrapper.operation.message = $operationWrapper.operation.toMessage();
- //
- // The operation can either be succeeded or failed
- //
- if($response.request.requestStatus.requestState.equals("COMPLETE")) {
- $operationWrapper.operation.outcome = "SUCCESS";
- $manager.setControlLoopResult("SUCCESS");
- notification.history.add($operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // We are going to retract these objects from memory
- //
- System.out.println("Retracting everything");
- retract($operationWrapper);
- retract($request);
- retract($response);
- retract($event);
- retract($manager);
- } else {
- $operationWrapper.operation.outcome = "FAILURE";
- $manager.setControlLoopResult("FAILURE");
- notification.history.add($operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // We are going to retract these objects from memory
- //
- System.out.println("Retracting everything");
- retract($operationWrapper);
- retract($request);
- retract($response);
- retract($event);
- retract($manager);
- }
-
-end
-rule "com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.Params"
- salience 1000
- when
- then
- Params params = new Params();
- params.setAaiPatternMatch(1);
- params.setAppcTopic("APPC-CL");
- params.setAaiURL("null");
- params.setMsoPassword("null");
- params.setClosedLoopControlName("CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8");
- params.setMsoURL("null");
- params.setAaiUsername("null");
- params.setActor("APPC");
- params.setMsoUsername("null");
- params.setAaiNamedQueryUUID("null");
- params.setAaiPassword("null");
- params.setNotificationTopic("POLICY-CL-MGT");
- insert(params);
-end
diff --git a/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt b/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt
deleted file mode 100755
index f9accdd96..000000000
--- a/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.1.txt
+++ /dev/null
@@ -1,1145 +0,0 @@
-/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI purpose.
- <$%BRMSParamTemplate=ControlLoopDemo__closedLoopControlName%$>
- */
-
-
-/*-
- * ============LICENSE_START=======================================================
- * archetype-closed-loop-demo-rules
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.controlloop;
-
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.UUID;
-
-import org.onap.policy.controlloop.VirtualControlLoopEvent;
-import org.onap.policy.controlloop.ControlLoopEventStatus;
-import org.onap.policy.controlloop.VirtualControlLoopNotification;
-import org.onap.policy.controlloop.ControlLoopNotificationType;
-import org.onap.policy.controlloop.ControlLoopOperation;
-import org.onap.policy.controlloop.ControlLoopOperationWrapper;
-import org.onap.policy.template.demo.ControlLoopException;
-
-import org.onap.policy.aai.AAINQF199.AAINQF199CloudRegion;
-import org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperties;
-import org.onap.policy.aai.AAINQF199.AAINQF199ExtraProperty;
-import org.onap.policy.aai.AAINQF199.AAINQF199GenericVNF;
-import org.onap.policy.aai.AAINQF199.AAINQF199InstanceFilters;
-import org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;
-import org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItems;
-import org.onap.policy.aai.AAINQF199.AAINQF199Manager;
-import org.onap.policy.aai.AAINQF199.AAINQF199NamedQuery;
-import org.onap.policy.aai.AAINQF199.AAINQF199QueryParameters;
-import org.onap.policy.aai.AAINQF199.AAINQF199Request;
-import org.onap.policy.aai.AAINQF199.AAINQF199RequestWrapper;
-import org.onap.policy.aai.AAINQF199.AAINQF199Response;
-import org.onap.policy.aai.AAINQF199.AAINQF199ResponseWrapper;
-import org.onap.policy.aai.AAINQF199.AAINQF199ServiceInstance;
-import org.onap.policy.aai.AAINQF199.AAINQF199Tenant;
-import org.onap.policy.aai.AAINQF199.AAINQF199VfModule;
-import org.onap.policy.aai.AAINQF199.AAINQF199VServer;
-import org.onap.policy.aai.util.Serialization;
-
-import org.onap.policy.appc.CommonHeader;
-import org.onap.policy.appc.Request;
-import org.onap.policy.appc.Response;
-import org.onap.policy.appc.ResponseCode;
-import org.onap.policy.appc.ResponseStatus;
-import org.onap.policy.appc.ResponseValue;
-
-import org.onap.policy.template.demo.EventManager;
-import org.onap.policy.vnf.trafficgenerator.PGRequest;
-import org.onap.policy.vnf.trafficgenerator.PGStream;
-import org.onap.policy.vnf.trafficgenerator.PGStreams;
-
-import org.onap.policy.mso.MSOManager;
-import org.onap.policy.mso.MSORequest;
-import org.onap.policy.mso.MSORequestStatus;
-import org.onap.policy.mso.MSORequestDetails;
-import org.onap.policy.mso.MSOModelInfo;
-import org.onap.policy.mso.MSOCloudConfiguration;
-import org.onap.policy.mso.MSORequestInfo;
-import org.onap.policy.mso.MSORequestParameters;
-import org.onap.policy.mso.MSORelatedInstanceListElement;
-import org.onap.policy.mso.MSORelatedInstance;
-import org.onap.policy.mso.MSOResponse;
-
-import org.onap.policy.drools.system.PolicyEngine;
-
-//
-// These parameters are required to build the runtime policy
-//
-declare Params
- closedLoopControlName : String
- actor : String
- aaiURL : String
- aaiUsername : String
- aaiPassword : String
- msoURL : String
- msoUsername : String
- msoPassword : String
- aaiNamedQueryUUID : String
- aaiPatternMatch : int
- notificationTopic : String
- appcTopic : String
-end
-
-/*
-*
-* Called once and only once to insert the parameters into working memory for this Closed Loop policy.
-* (Comment SETUP rule out for the first ONAP opensource release since policy BRMS_GW already puts a Params fact in there)
-*
-*
-*rule "BRMSParamvLBDemoPolicy.SETUP"
-* when
-* then
-* System.out.println("rule SETUP is triggered.");
-* Params params = new Params();
-* params.setClosedLoopControlName("CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8");
-* params.setActor("MSO");
-* params.setAaiURL("https://aai.api.simpledemo.openecomp.org:8443");
-* params.setAaiUsername("POLICY");
-* params.setAaiPassword("POLICY");
-* params.setMsoURL("http://vm1.mso.simpledemo.openecomp.org:8080/onap/mso/infra");
-* params.setMsoUsername("InfraPortalClient");
-* params.setMsoPassword("password1$");
-* params.setAaiNamedQueryUUID("f199cb88-5e69-4b1f-93e0-6f257877d066");
-* params.setAaiPatternMatch(0);
-* params.setNotificationTopic("POLICY-CL-MGT");
-* params.setAppcTopic("APPC-CL");
-* //
-* // This stays in memory as long as the rule is alive and running
-* //
-* insert(params);
-*end
-*/
-/*
-*
-* This rule responds to DCAE Events
-*
-*/
-rule "BRMSParamvLBDemoPolicy.EVENT"
- when
- $params : Params( getClosedLoopControlName() == "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- not ( EventManager( closedLoopControlName == $event.closedLoopControlName ))
- then
- System.out.println("rule EVENT is triggered.");
- try {
- //
- // Check the requestID in the event to make sure it is not null before we create the EventManager.
- // The EventManager will do extra syntax checking as well check if the closed loop is disabled/
- //
- if ($event.requestID == null) {
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.REJECTED;
- notification.from = "policy";
- notification.message = "Missing requestID from DCAE event";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver notification: " + notification);
- }
- //
- // Retract it from memory
- //
- retract($event);
- System.out.println("Event with requestID=null has been retracted.");
- } else {
- //
- // Create an EventManager
- //
- EventManager manager = new EventManager($params.getClosedLoopControlName(), $event.requestID, $event.target);
- //
- // Determine if EventManager can actively process the event (i.e. syntax)
- //
- VirtualControlLoopNotification notification = manager.activate($event);
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- //
- // Are we actively pursuing this event?
- //
- if (notification.notification == ControlLoopNotificationType.ACTIVE) {
- //
- // Insert Event Manager into memory, this will now kick off processing.
- //
- insert(manager);
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver notification: " + notification);
- }
- } else {
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver notification: " + notification);
- }
- //
- // Retract it from memory
- //
- retract($event);
- }
- //
- // Now that the manager is inserted into Drools working memory, we'll wait for
- // another rule to fire in order to continue processing. This way we can also
- // then screen for additional ONSET and ABATED events for this same RequestIDs
- // and for different RequestIDs but with the same closedLoopControlName and target.
- //
- }
- //
- } catch (Exception e) {
- e.printStackTrace();
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.REJECTED;
- notification.message = "Exception occurred " + e.getMessage();
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- //
- //
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e1) {
- System.out.println("Can't deliver notification: " + notification);
- e1.printStackTrace();
- }
- //
- // Retract the event
- //
- retract($event);
- }
-end
-
-/*
-*
-* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager
-* is created. We can start the operations for this closed loop.
-*
-*/
-rule "BRMSParamvLBDemoPolicy.EVENT.MANAGER"
- when
- $params : Params( getClosedLoopControlName() == "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName, controlLoopResult == null)
- then
- System.out.println("rule EVENT.MANAGER is triggered.");
- //
- // Check which event this is.
- //
- EventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);
- //
- // We only want the initial ONSET event in memory,
- // all the other events need to be retracted to support
- // cleanup and avoid the other rules being fired for this event.
- //
- if (eventStatus != EventManager.NEW_EVENT_STATUS.FIRST_ONSET) {
- System.out.println("Retracting "+eventStatus+" Event.");
- retract($event);
- return;
- }
- //
- // Now the event in memory is first onset event
- //
- try {
- //
- // Pull the known AAI field from the Event
- //
- // generic-vnf is needed for vFirewall case
- // vserver-name is needed for vLoadBalancer case
- //
- String genericVNF = $event.AAI.get("generic-vnf.vnf-id");
- String vserver = $event.AAI.get("vserver.vserver-name");
- //
- // Check if we are implementing a simple pattern match.
- //
- if ($params.getAaiPatternMatch() == 1) {
- //
- // Yes
- //
- //Basic naming characteristics:
- //VF Name (9 char)+VM name (13 char total)+VFC (19 char total)
- //Example:
- //VF Name (9 characters): cscf0001v
- //VM Name(13 characters): cscf0001vm001
- //VFC name(19 characters): cscf0001vm001cfg001
- //
- // zdfw1fwl01fwl02 or zdfw1fwl01fwl01
- // replaced with
- // zdfw1fwl01pgn02 or zdfw1fwl01pgn01
- //
- int index = genericVNF.lastIndexOf("fwl");
- if (index == -1) {
- System.err.println("The generic-vnf.vnf-id from DCAE Event is not valid.");
- } else {
- genericVNF = genericVNF.substring(0, index) + "pgn" + genericVNF.substring(index+"fwl".length());
- }
- //
- // Construct an APPC request
- //
- ControlLoopOperation operation = new ControlLoopOperation();
- operation.actor = $params.getActor();
- operation.operation = "ModifyConfig";
- operation.target = $event.target;
- //
- // Create operationWrapper
- //
- ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
- //
- // insert operationWrapper into memory
- //
- insert(operationWrapper);
- //
- Request request = new Request();
- request.CommonHeader = new CommonHeader();
- request.CommonHeader.RequestID = $event.requestID;
- request.Action = operation.operation;
- request.Payload = new HashMap<String, Object>();
- //
- // Fill in the payload
- //
- request.Payload.put("generic-vnf.vnf-id", genericVNF);
- //
- PGRequest pgRequest = new PGRequest();
- pgRequest.pgStreams = new PGStreams();
-
- PGStream pgStream;
- for(int i = 0; i < 5; i++){
- pgStream = new PGStream();
- pgStream.streamId = "fw_udp"+(i+1);
- pgStream.isEnabled = "true";
- pgRequest.pgStreams.pgStream.add(pgStream);
- }
- request.Payload.put("pg-streams", pgRequest.pgStreams);
-
- if (request != null) {
- //
- // Insert request into memory
- //
- insert(request);
- //
- // Tell interested parties we are performing this Operation
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.OPERATION;
- // message and history ??
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // Now send the operation request
- //
- if (request instanceof Request) {
- try {
- System.out.println("APPC request sent:");
- System.out.println(Serialization.gsonPretty.toJson(request));
- PolicyEngine.manager.deliver($params.getAppcTopic(), request);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver request: " + request);
- }
- }
- } else {
- //
- // what happens if it is null
- //
- }
- //
- } else {
- //
- // create AAI named-query request with UUID started with "F199"
- //
- AAINQF199Request aainqf199request = new AAINQF199Request();
- AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();
- AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();
- AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();
- //
- // queryParameters
- //
- aainqf199namedquery.namedQueryUUID = UUID.fromString($params.getAaiNamedQueryUUID());
- aainqf199queryparam.namedQuery = aainqf199namedquery;
- aainqf199request.queryParameters = aainqf199queryparam;
- //
- // instanceFilters
- //
- Map aainqf199instancefiltermap = new HashMap();
- Map aainqf199instancefiltermapitem = new HashMap();
- aainqf199instancefiltermapitem.put("vserver-name", vserver);
- aainqf199instancefiltermap.put("vserver", aainqf199instancefiltermapitem);
- aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);
- aainqf199request.instanceFilters = aainqf199instancefilter;
- //
- // print aainqf199request for debug
- //
- System.out.println("AAI Request sent:");
- System.out.println(Serialization.gsonPretty.toJson(aainqf199request));
- //
- // Create AAINQF199RequestWrapper
- //
- AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper($event.requestID, aainqf199request);
- //
- // insert aainqf199request into memory
- //
- insert(aainqf199RequestWrapper);
- }
- //
- } catch (Exception e) {
- e.printStackTrace();
- }
-end
-
-/*
-*
-* This rule happens when we got a valid ONSET, closed loop is enabled, an Event Manager
-* is created, AAI Manager and AAI Request are ready in memory. We can start sending query to AAI and then wait for response.
-*
-*/
-rule "BRMSParamvLBDemoPolicy.EVENT.MANAGER.AAINQF199REQUEST"
- when
- $params : Params( getClosedLoopControlName() == "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
- $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)
- then
- System.out.println("rule EVENT.MANAGER.AAINQF199REQUEST is triggered.");
- //
- // send the request
- //
- AAINQF199Response aainqf199response = AAINQF199Manager.postQuery($params.getAaiURL(), $params.getAaiUsername(), $params.getAaiPassword(),
- $aainqf199RequestWrapper.aainqf199request, $event.requestID);
- //
- // Check AAI response
- //
- if (aainqf199response == null) {
- System.err.println("Failed to get AAI response");
- //
- // Fail and retract everything
- //
- retract($event);
- retract($manager);
- retract($aainqf199RequestWrapper);
- } else {
- //
- // Create AAINQF199ResponseWrapper
- //
- AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper($event.requestID, aainqf199response);
- //
- // insert aainqf199ResponseWrapper to memeory
- //
- insert(aainqf199ResponseWrapper);
- }
-end
-
-/*
-*
-* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.
-*
-*/
-rule "BRMSParamvLBDemoPolicy.EVENT.MANAGER.AAINQF199RESPONSE"
- when
- $params : Params( getClosedLoopControlName() == "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
- $aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)
- $aainqf199ResponseWrapper : AAINQF199ResponseWrapper(requestID == $event.requestID)
- then
- System.out.println("rule EVENT.MANAGER.AAINQF199RESPONSE is triggered.");
- //
- // Extract related fields out of AAINQF199RESPONSE
- //
- String vnfItemVnfId, vnfItemVnfType, vnfItemPersonaModelId, vnfItemPersonaModelVersion, vnfItemModelName,
- vnfItemModelVersion, vnfItemModelNameVersionId, serviceItemServiceInstanceId, serviceItemPersonaModelId,
- serviceItemModelName, serviceItemModelType, serviceItemModelVersion, serviceItemModelNameVersionId,
- vfModuleItemVfModuleName, vfModuleItemPersonaModelId, vfModuleItemPersonaModelVersion, vfModuleItemModelName,
- vfModuleItemModelNameVersionId, tenantItemTenantId, cloudRegionItemCloudRegionId;
- try {
- //
- // vnfItem
- //
- vnfItemVnfId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID;
- vnfItemVnfType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType;
- vnfItemVnfType = vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf("/")+1);
- vnfItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId;
- vnfItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion;
- vnfItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;
- vnfItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue;
- vnfItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;
- //
- // serviceItem
- //
- serviceItemServiceInstanceId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID;
- serviceItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId;
- serviceItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;
- serviceItemModelType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue;
- serviceItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion;
- serviceItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;
- //
- // Find the index for base vf module and non-base vf module
- //
- int baseIndex = -1;
- int nonBaseIndex = -1;
- List<AAINQF199InventoryResponseItem> inventoryItems = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems;
- for (AAINQF199InventoryResponseItem m : inventoryItems) {
- if (m.vfModule != null && m.vfModule.isBaseVfModule == true) {
- baseIndex = inventoryItems.indexOf(m);
- } else if (m.vfModule != null && m.vfModule.isBaseVfModule == false && m.vfModule.orchestrationStatus == null) {
- nonBaseIndex = inventoryItems.indexOf(m);
- }
- //
- if (baseIndex != -1 && nonBaseIndex != -1) {
- break;
- }
- }
- //
- // Report the error if either base vf module or non-base vf module is not found
- //
- if (baseIndex == -1 || nonBaseIndex == -1) {
- System.err.println("Either base or non-base vf module is not found from AAI response.");
- retract($aainqf199RequestWrapper);
- retract($aainqf199ResponseWrapper);
- retract($manager);
- retract($event);
- return;
- }
- //
- // This comes from the base module
- //
- vfModuleItemVfModuleName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.vfModuleName;
- vfModuleItemVfModuleName = vfModuleItemVfModuleName.replace("Vfmodule", "vDNS");
- //
- // vfModuleItem - NOT the base module
- //
- vfModuleItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelId;
- vfModuleItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelVersion;
- vfModuleItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(0).propertyValue;
- vfModuleItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue;
- //
- // tenantItem
- //
- tenantItemTenantId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId;
- //
- // cloudRegionItem
- //
- cloudRegionItemCloudRegionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;
- //
- } catch (Exception e) {
- e.printStackTrace();
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.REJECTED;
- notification.message = "Exception occurred " + e.getMessage();
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e1) {
- System.out.println("Can't deliver notification: " + notification);
- e1.printStackTrace();
- }
- //
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- notification.message = "Invalid named-query response from AAI";
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e1) {
- System.out.println("Can't deliver notification: " + notification);
- e1.printStackTrace();
- }
- //
- // Retract everything
- //
- retract($aainqf199RequestWrapper);
- retract($aainqf199ResponseWrapper);
- retract($manager);
- retract($event);
- return;
- }
- //
- // Extracted fields should not be null
- //
- if ((vnfItemVnfId == null) || (vnfItemVnfType == null) ||
- (vnfItemPersonaModelId == null) || (vnfItemModelName == null) ||
- (vnfItemModelVersion == null) || (vnfItemModelNameVersionId == null) ||
- (serviceItemServiceInstanceId == null) || (serviceItemModelName == null) ||
- (serviceItemModelType == null) || (serviceItemModelVersion == null) ||
- (serviceItemModelNameVersionId == null) || (vfModuleItemVfModuleName == null) ||
- (vfModuleItemPersonaModelId == null) || (vfModuleItemPersonaModelVersion == null) ||
- (vfModuleItemModelName == null) || (vfModuleItemModelNameVersionId == null) ||
- (tenantItemTenantId == null) || (cloudRegionItemCloudRegionId == null)) {
- //
- System.err.println("some fields are missing from AAI response.");
- //
- // Fail and retract everything
- //
- retract($aainqf199RequestWrapper);
- retract($aainqf199ResponseWrapper);
- retract($manager);
- retract($event);
- return;
- }
- //
- // We don't need them any more
- //
- retract($aainqf199ResponseWrapper);
- retract($aainqf199RequestWrapper);
- //
- // check the actor of this closed loop
- //
- switch ($params.getActor()) {
- case "APPC":
- {
- //
- // Construct an APPC request
- //
- ControlLoopOperation operation = new ControlLoopOperation();
- operation.actor = $params.getActor();
- operation.operation = "ModifyConfig";
- operation.target = $event.target;
- //
- // Create operationWrapper
- //
- ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
- //
- // insert operationWrapper into memory
- //
- insert(operationWrapper);
- //
- Request request = new Request();
- request.CommonHeader = new CommonHeader();
- request.CommonHeader.RequestID = $event.requestID;
- request.Action = operation.operation;
- request.Payload = new HashMap<String, Object>();
- //
- // Fill in the payload
- // Hardcode genericVNF for now since AAI has not been ready for vFirewall demo case
- //
- String genericVNF = "zdfw1fwl01pgn02";
- request.Payload.put("generic-vnf.vnf-id", genericVNF);
- //
- PGRequest pgRequest = new PGRequest();
- pgRequest.pgStreams = new PGStreams();
-
- PGStream pgStream;
- for(int i = 0; i < 5; i++){
- pgStream = new PGStream();
- pgStream.streamId = "fw_udp"+(i+1);
- pgStream.isEnabled = "true";
- pgRequest.pgStreams.pgStream.add(pgStream);
- }
- request.Payload.put("pg-streams", pgRequest.pgStreams);
-
- if (request != null) {
- //
- // Insert request into memory
- //
- insert(request);
- //
- // Tell interested parties we are performing this Operation
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.OPERATION;
- // message and history ??
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // Now send the operation request
- //
- if (request instanceof Request) {
- try {
- System.out.println("APPC request sent:");
- System.out.println(Serialization.gsonPretty.toJson(request));
- PolicyEngine.manager.deliver($params.getAppcTopic(), request);
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("Can't deliver request: " + request);
- }
- }
- } else {
- //
- // what happens if it is null
- //
- }
- }
- break;
- case "MSO":
- {
- //
- // Construct an operation
- //
- ControlLoopOperation operation = new ControlLoopOperation();
- operation.actor = $params.getActor();
- operation.operation = "createModuleInstance";
- operation.target = $event.target;
- //
- // Create operationWrapper
- //
- ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
- //
- // Construct an MSO request
- //
- MSORequest request = new MSORequest();
- request.requestDetails = new MSORequestDetails();
- request.requestDetails.modelInfo = new MSOModelInfo();
- request.requestDetails.cloudConfiguration = new MSOCloudConfiguration();
- request.requestDetails.requestInfo = new MSORequestInfo();
- request.requestDetails.requestParameters = new MSORequestParameters();
- request.requestDetails.requestParameters.userParams = null;
- //
- // cloudConfiguration
- //
- request.requestDetails.cloudConfiguration.lcpCloudRegionId = cloudRegionItemCloudRegionId;
- request.requestDetails.cloudConfiguration.tenantId = tenantItemTenantId;
- //
- // modelInfo
- //
- request.requestDetails.modelInfo.modelType = "vfModule";
- request.requestDetails.modelInfo.modelInvariantId = vfModuleItemPersonaModelId;
- request.requestDetails.modelInfo.modelNameVersionId = vfModuleItemModelNameVersionId;
- request.requestDetails.modelInfo.modelName = vfModuleItemModelName;
- request.requestDetails.modelInfo.modelVersion = vfModuleItemPersonaModelVersion;
- //
- // requestInfo
- //
- request.requestDetails.requestInfo.instanceName = vfModuleItemVfModuleName;
- request.requestDetails.requestInfo.source = "POLICY";
- request.requestDetails.requestInfo.suppressRollback = false;
- //
- // relatedInstanceList
- //
- MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();
- MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();
- relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();
- relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();
- //
- relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;
- relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();
- relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service";
- relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;
- relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;
- relatedInstanceListElement1.relatedInstance.modelInfo.modelName = serviceItemModelName;
- relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;
- //
- relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;
- relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();
- relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf";
- relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;
- relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;
- relatedInstanceListElement2.relatedInstance.modelInfo.modelName = vnfItemModelName;
- relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = vnfItemModelVersion;
- relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = vnfItemVnfType;
- //
- request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);
- request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
- //
- // print MSO request for debug
- //
- System.out.println("MSO request sent:");
- System.out.println(Serialization.gsonPretty.toJson(request));
- //
- //
- //
- if (request != null) {
- //
- // Tell interested parties we are performing this Operation
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.notification = ControlLoopNotificationType.OPERATION;
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL
- //
- String MSOUrl = $params.getMsoURL() + "/serviceInstances/v2/" + serviceItemServiceInstanceId + "/vnfs/" + vnfItemVnfId + "/vfModules";
- //
- // Call MSO
- //
- MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);
- //
- if (response != null) {
- //
- // Assign requestId
- //
- request.requestId = $event.requestID.toString();
- response.request.requestId = $event.requestID.toString();
- //
- // Insert facts
- //
- insert(operationWrapper);
- insert(request);
- insert(response);
- } else {
- //
- // MSO request not even accepted
- //
- notification.message = operationWrapper.operation.toMessage();
- operationWrapper.operation.message = operationWrapper.operation.toMessage();
- operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
- $manager.setControlLoopResult("FAILURE_EXCEPTION");
- notification.history.add(operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // Retract everything
- //
- retract($event);
- retract($manager);
- }
- } else {
- System.err.println("constructed MSO request is invalid.");
- }
- }
- break;
- }
-end
-
-/*
-*
-* This rule responds to APPC Response Events
-*
-*/
-rule "BRMSParamvLBDemoPolicy.APPC.RESPONSE"
- when
- $params : Params( getClosedLoopControlName() == "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
- $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )
- $request : Request( getCommonHeader().RequestID == $event.requestID )
- $response : Response( getCommonHeader().RequestID == $event.requestID )
- then
- System.out.println("rule APPC.RESPONSE is triggered.");
- if ($response.Status == null) {
- $operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
- $manager.setControlLoopResult("FAILURE_EXCEPTION");
- }
- //
- // Get the Response Code
- //
- ResponseCode code = ResponseCode.toResponseCode($response.Status.Code);
- if (code == null) {
- $operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
- $manager.setControlLoopResult("FAILURE_EXCEPTION");
- }
- //
- // Construct notification
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- notification.message = $operationWrapper.operation.toMessage();
- $operationWrapper.operation.message = $operationWrapper.operation.toMessage();
- //
- // Ok, let's figure out what APP-C's response is
- //
- switch (code) {
- case ACCEPT:
- $operationWrapper.operation.outcome = "PROCESSING";
- break;
- case ERROR:
- case REJECT:
- $operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
- $manager.setControlLoopResult("FAILURE_EXCEPTION");
- break;
- case SUCCESS:
- $operationWrapper.operation.outcome = "SUCCESS";
- $manager.setControlLoopResult("SUCCESS");
- break;
- case FAILURE:
- $operationWrapper.operation.outcome = "FAILURE";
- $manager.setControlLoopResult("FAILURE");
- break;
- }
- if ($operationWrapper.operation.outcome.equals("SUCCESS")) {
- notification.history.add($operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
-
- //
- // We are going to retract these objects from memory
- //
- System.out.println("Retracting everything");
- retract($operationWrapper);
- retract($request);
- retract($response);
- retract($event);
- retract($manager);
- } else if ($operationWrapper.operation.outcome.equals("PROCESSING")) {
- retract($response);
- } else {
- notification.history.add($operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // We are going to retract these objects from memory
- //
- System.out.println("Retracting everything");
- retract($operationWrapper);
- retract($request);
- retract($response);
- retract($event);
- retract($manager);
- }
-
-end
-
-/*
-*
-* This rule is used to clean up APPC response
-*
-*/
-rule "BRMSParamvLBDemoPolicy.APPC.RESPONSE.CLEANUP"
- when
- $params : Params( getClosedLoopControlName() == "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $response : Response($id : getCommonHeader().RequestID )
- not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) )
- then
- System.out.println("rule APPC.RESPONSE.CLEANUP is triggered.");
- retract($response);
-end
-
-/*
-*
-* This rule responds to MSO Response Events
-*
-*/
-rule "BRMSParamvLBDemoPolicy.MSO.RESPONSE"
- when
- $params : Params( getClosedLoopControlName() == "CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8" )
- $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
- $manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
- $operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )
- $request : MSORequest( requestId == $event.requestID.toString() )
- $response : MSOResponse( request.requestId == $event.requestID.toString() )
- then
- System.out.println("rule MSO.RESPONSE is triggered.");
- //
- // Construct notification
- //
- VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
- notification.from = "policy";
- notification.policyName = drools.getRule().getName();
- notification.policyScope = "com";
- notification.policyVersion = "1";
- notification.message = $operationWrapper.operation.toMessage();
- $operationWrapper.operation.message = $operationWrapper.operation.toMessage();
- //
- // The operation can either be succeeded or failed
- //
- if($response.request.requestStatus.requestState.equals("COMPLETE")) {
- $operationWrapper.operation.outcome = "SUCCESS";
- $manager.setControlLoopResult("SUCCESS");
- notification.history.add($operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // We are going to retract these objects from memory
- //
- System.out.println("Retracting everything");
- retract($operationWrapper);
- retract($request);
- retract($response);
- retract($event);
- retract($manager);
- } else {
- $operationWrapper.operation.outcome = "FAILURE";
- $manager.setControlLoopResult("FAILURE");
- notification.history.add($operationWrapper.operation);
- notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
- //
- // Let interested parties know
- //
- try {
- System.out.println(Serialization.gsonPretty.toJson(notification));
- PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
- } catch (Exception e) {
- System.out.println("Can't deliver notification: " + notification);
- e.printStackTrace();
- }
- //
- // We are going to retract these objects from memory
- //
- System.out.println("Retracting everything");
- retract($operationWrapper);
- retract($request);
- retract($response);
- retract($event);
- retract($manager);
- }
-
-end
-rule "com.Config_BRMS_Param_BRMSParamvLBDemoPolicy.Params"
- salience 1000
- when
- then
- Params params = new Params();
- params.setAaiPatternMatch(0);
- params.setAppcTopic("APPC-CL");
- params.setAaiURL("https://aai.api.simpledemo.openecomp.org:8443");
- params.setMsoPassword("password1$");
- params.setClosedLoopControlName("CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8");
- params.setAaiUsername("POLICY");
- params.setMsoURL("http://vm1.mso.simpledemo.openecomp.org:8080/onap/mso/infra");
- params.setActor("MSO");
- params.setMsoUsername("InfraPortalClient");
- params.setAaiNamedQueryUUID("f199cb88-5e69-4b1f-93e0-6f257877d066");
- params.setAaiPassword("POLICY");
- params.setNotificationTopic("POLICY-CL-MGT");
- insert(params);
-end
diff --git a/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_MS_vFirewall.1.json b/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_MS_vFirewall.1.json
deleted file mode 100644
index 6b128f1a1..000000000
--- a/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_MS_vFirewall.1.json
+++ /dev/null
@@ -1 +0,0 @@
-{"service":"TcaMetrics","location":"SampleServiceLocation","uuid":"/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vFirewall","policyName":"vFirewall","description":"Micro Service vFirewall Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:","configName":"SampleConfigName","templateVersion":"OpenSource.version.1","version":"1.0.0.5","priority":"1","policyScope":"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop","content":{"thresholds":[{"severity":"MAJOR","fieldPath":"$.event.measurementsForVfScalingFields.vNicUsageArray[*].packetsIn","thresholdValue":"300","closedLoopControlName":"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8","version":"1.0.2","direction":"LESS_OR_EQUAL"},{"severity":"CRITICAL","fieldPath":"$.event.measurementsForVfScalingFields.vNicUsageArray[*].packetsIn","thresholdValue":"700","closedLoopControlName":"CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8","version":"1.0.2","direction":"GREATER_OR_EQUAL"}],"functionalRole":"vFirewall","name":"0"}} \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_MS_vLoadBalancer.1.json b/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_MS_vLoadBalancer.1.json
deleted file mode 100644
index e4fe39ed2..000000000
--- a/packages/base/src/files/install/servers/pap/webapps/Config/com.Config_MS_vLoadBalancer.1.json
+++ /dev/null
@@ -1 +0,0 @@
-{"service":"TcaMetrics","location":"SampleServiceLocation","uuid":"/services/cdap-tca-hi-lo/instances/demo/configuration/metricsPerFunctionalRole/vLoadBalancer","policyName":"vLoadBalancer","description":"Micro Service vLoadBalancer Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:","configName":"SampleConfigName","templateVersion":"OpenSource.version.1","version":"1.0.0.5","priority":"1","policyScope":"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=SampleClosedLoop","content":{"thresholds":[{"severity":"MAJOR","fieldPath":"$.event.measurementsForVfScalingFields.vNicUsageArray[*].packetsIn","thresholdValue":"200","closedLoopControlName":"CL-DNS-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8","version":"1.0.2","direction":"GREATER_OR_EQUAL"}],"functionalRole":"vLoadBalancer","name":"0"}} \ No newline at end of file
diff --git a/packages/base/src/files/install/servers/pdp/bin/xacml.pdp.properties b/packages/base/src/files/install/servers/pdp/bin/xacml.pdp.properties
index c9a73f6fa..fe5277d98 100644
--- a/packages/base/src/files/install/servers/pdp/bin/xacml.pdp.properties
+++ b/packages/base/src/files/install/servers/pdp/bin/xacml.pdp.properties
@@ -107,7 +107,7 @@ xacml.rest.pap.userid=${{PDP_PAP_PDP_HTTP_USER_ID}}
# pass PAP
xacml.rest.pap.password=${{PDP_PAP_PDP_HTTP_PASSWORD}}
# Delay for Notifications Don't change this. Value in milliSec.
-xacml.rest.notification.delay=30
+xacml.rest.notification.delay=30
# Client interval to ping notification service.
CLIENT_INTERVAL=15000
# Request Buffer Size.
diff --git a/packages/base/src/files/m2/settings.xml b/packages/base/src/files/m2/settings.xml
index 50bda7555..3c51ac376 100644
--- a/packages/base/src/files/m2/settings.xml
+++ b/packages/base/src/files/m2/settings.xml
@@ -44,7 +44,41 @@
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
-
+ <repository>
+ <id>onap-releases</id>
+ <name>onap-releases</name>
+ <url>https://nexus.onap.org/content/repositories/releases/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>onap-staging</id>
+ <name>onap-staging</name>
+ <url>https://nexus.onap.org/content/repositories/staging/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>onap-snapshots</id>
+ <name>onap-snapshots</name>
+ <url>https://nexus.onap.org/content/repositories/snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ </repository>
<repository>
<id>${{releaseRepositoryID}}</id>
<url>${{releaseRepositoryURL}}</url>
diff --git a/packages/install/src/files/base.conf b/packages/install/src/files/base.conf
index 92c6d9015..cd08d4a41 100644
--- a/packages/install/src/files/base.conf
+++ b/packages/install/src/files/base.conf
@@ -2,9 +2,9 @@ JAVA_HOME=/usr/lib/jvm/java-8-oracle
POLICY_HOME=/opt/app/policy
KEYSTORE_PASSWD=PolicyR0ck$
-JDBC_DRIVER=com.mysql.jdbc.Driver
-JDBC_URL=jdbc:mysql://localhost:3306/xacml
-JDBC_LOG_URL=jdbc:mysql://localhost:3306/log
+JDBC_DRIVER=org.mariadb.jdbc.Driver
+JDBC_URL=jdbc:mariadb://localhost:3306/onap_sdk
+JDBC_LOG_URL=jdbc:mariadb://localhost:3306/log
JDBC_USER=policy_user
JDBC_PASSWORD=
diff --git a/packages/install/src/files/brmsgw.conf b/packages/install/src/files/brmsgw.conf
index 36cf41415..2c91ff435 100644
--- a/packages/install/src/files/brmsgw.conf
+++ b/packages/install/src/files/brmsgw.conf
@@ -28,10 +28,8 @@ UEB_API_SECRET=
groupID=org.onap.policy-engine
artifactID=drlPDPGroup
-VFW_GROUP_ID=org.onap.policy-engine.drools.vFW
-VFW_ARTIFACT_ID=policy-vFW-rules
-VDNS_GROUP_ID=org.onap.policy-engine.drools.vDNS
-VDNS_ARTIFACT_ID=policy-vDNS-rules
+AMSTERDAM_GROUP_ID=org.onap.policy-engine.drools.amsterdam
+AMSTERDAM_ARTIFACT_ID=policy-amsterdam-rules
# the java property is RESOURCE_NAME (uppercase), but the conf parameter is lowercase
resource_name=brmsgw_1
diff --git a/pom.xml b/pom.xml
index 96cc5015d..c615114d3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>0.1.1</version>
<relativePath/>
</parent>