End-to-end policy CSIT 36/106036/3
authorJim Hahn <jrh3@att.com>
Wed, 15 Apr 2020 12:43:54 +0000 (08:43 -0400)
committerJim Hahn <jrh3@att.com>
Wed, 15 Apr 2020 21:12:53 +0000 (17:12 -0400)
Modified the CSIT for drools-apps to use more components:
- api to create policies
- pap to deploy policies

Also removed tabs.

Issue-ID: POLICY-2491
Change-Id: Iacd8d1953068bb718a63de8813dd1c307c21b1f8
Signed-off-by: Jim Hahn <jrh3@att.com>
17 files changed:
plans/policy/drools-applications/setup.sh
scripts/policy/drools-apps/activate.drools.json [deleted file]
scripts/policy/drools-apps/activate.xacml.json [deleted file]
scripts/policy/drools-apps/custom/logback.xml [deleted file]
scripts/policy/drools-apps/custom/papDefaultConfig.json [new file with mode: 0644]
scripts/policy/drools-apps/custom/ssl/policy-keystore [deleted file]
scripts/policy/drools-apps/custom/ssl/policy-truststore [deleted file]
scripts/policy/drools-apps/custom/xacmlDefaultConfig.json [moved from scripts/policy/drools-apps/custom/defaultConfig.json with 100% similarity]
scripts/policy/drools-apps/deploy.drools.policies.json [new file with mode: 0644]
scripts/policy/drools-apps/deploy.xacml.policies.json [new file with mode: 0644]
scripts/policy/drools-apps/docker-compose-drools-apps.yml
scripts/policy/drools-apps/manage.sh [deleted file]
scripts/policy/drools-apps/passive.drools.json [deleted file]
scripts/policy/drools-apps/policies.json [deleted file]
scripts/policy/policy-models-dmaap-sim.sh
scripts/policy/policy-models-simulators.sh
tests/policy/drools-applications/drools-applications-test.robot

index 99b0015..1a1dc33 100755 (executable)
@@ -34,6 +34,10 @@ pip install -U docker==2.7.0
 sudo apt-get -y install libxml2-utils
 ${SCRIPTS}/policy/policy-models-simulators.sh
 
+POLICY_API_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/api/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
+export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
+POLICY_PAP_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/pap/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
+export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
 POLICY_XACML_PDP_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/xacml-pdp/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
 export POLICY_XACML_PDP_VERSION="${POLICY_XACML_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
 POLICY_DROOLS_APPS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/drools-applications/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
@@ -50,31 +54,37 @@ docker -v && docker-compose -v
 # Adding this waiting container due to race condition between drools and mariadb
 docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_dependencies
 
+# Adding this waiting container due to race condition between pap and xacml
+docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_pap
+
 # now bring everything else up
 docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_all
 
 unset http_proxy https_proxy
 
 DROOLS_IP=`get-instance-ip.sh drools`
+API_IP=`get-instance-ip.sh policy-api`
+PAP_IP=`get-instance-ip.sh policy-pap`
 XACML_IP=`get-instance-ip.sh policy-xacml-pdp`
 SIM_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org`
 export SIM_IP
 
 echo DROOLS IP IS ${DROOLS_IP}
+echo API IP IS ${API_IP}
+echo PAP IP IS ${PAP_IP}
 echo XACML IP IS ${XACML_IP}
 echo SIMULATORS IP IS ${SIM_IP}
 
-# activate xacml
-${SCR2}/manage.sh ${SCR2}/activate.xacml.json
-
 # give enough time for the controllers to come up
 sleep 15
 
-# wait for xacml to activate
-${SCRIPTS}/policy/wait_for_port.sh ${XACML_IP} 6969
+DATA=${WORKSPACE}/simulators/models/models-examples/src/main/resources/policies
 
 ROBOT_VARIABLES=""
 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR2:${SCR2}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}"
 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DROOLS_IP:${DROOLS_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v API_IP:${API_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v PAP_IP:${PAP_IP}"
 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v XACML_IP:${XACML_IP}"
 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SIM_IP:${SIM_IP}"
diff --git a/scripts/policy/drools-apps/activate.drools.json b/scripts/policy/drools-apps/activate.drools.json
deleted file mode 100644 (file)
index 681bf6a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-       "messageName": "PDP_STATE_CHANGE",
-       "requestId": "88891208-2a73-452c-8d71-c93b422a7e03",
-       "timestampMs": 1584652299629,
-       "name": "drools",
-       "pdpGroup": "defaultGroup",
-       "pdpSubgroup": "drools",
-       "state": "ACTIVE"
-}
diff --git a/scripts/policy/drools-apps/activate.xacml.json b/scripts/policy/drools-apps/activate.xacml.json
deleted file mode 100644 (file)
index 1ee79c2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-       "messageName": "PDP_STATE_CHANGE",
-       "requestId": "88891208-2a73-452c-8d71-c93b422a7e03",
-       "timestampMs": 1584652299629,
-       "name": "policy-xacml-pdp",
-       "pdpGroup": "defaultGroup",
-       "pdpSubgroup": "xacml",
-       "state": "ACTIVE"
-}
diff --git a/scripts/policy/drools-apps/custom/logback.xml b/scripts/policy/drools-apps/custom/logback.xml
deleted file mode 100644 (file)
index 7f20cfc..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-<!--
-  ============LICENSE_START===================================================
-   Copyright (C) 2020 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=====================================================
--->
-
-<configuration scan="true" scanPeriod="30 seconds" debug="false">
-
-    <property name="logDir" value="${POLICY_LOGS}" />
-
-    <property name="errorLog" value="error" />
-    <property name="debugLog" value="debug" />
-    <property name="networkLog" value="network" />
-
-    <property name="debugPattern"
-        value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%level|%logger{0}|%thread] %msg%n" />
-    <property name="errorPattern" value="${debugPattern}" />
-    <property name="networkPattern" value="[%d{yyyy-MM-dd'T'HH:mm:ss.SSS+00:00, UTC}|%t]%m%n" />
-
-    <appender name="ErrorOut" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${logDir}/${errorLog}.log</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${logDir}/${errorLog}.%d{yyyy-MM-dd}.%i.log.zip
-            </fileNamePattern>
-            <maxFileSize>50MB</maxFileSize>
-            <maxHistory>30</maxHistory>
-            <totalSizeCap>10GB</totalSizeCap>
-        </rollingPolicy>
-        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
-            <level>WARN</level>
-        </filter>
-        <encoder>
-            <pattern>${errorPattern}</pattern>
-        </encoder>
-    </appender>
-
-    <appender name="AsyncErrorOut" class="ch.qos.logback.classic.AsyncAppender">
-        <appender-ref ref="ErrorOut" />
-    </appender>
-
-    <appender name="DebugOut" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${logDir}/${debugLog}.log</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${logDir}/${debugLog}.%d{yyyy-MM-dd}.%i.log.zip
-            </fileNamePattern>
-            <maxFileSize>50MB</maxFileSize>
-            <maxHistory>30</maxHistory>
-            <totalSizeCap>10GB</totalSizeCap>
-        </rollingPolicy>
-        <encoder>
-            <pattern>${debugPattern}</pattern>
-        </encoder>
-    </appender>
-
-    <appender name="AsyncDebugOut" class="ch.qos.logback.classic.AsyncAppender">
-        <appender-ref ref="DebugOut" />
-    </appender>
-
-    <appender name="NetworkOut" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${logDir}/${networkLog}.log</file>
-        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${logDir}/${networkLog}.%d{yyyy-MM-dd}.%i.log.zip
-            </fileNamePattern>
-            <maxFileSize>50MB</maxFileSize>
-            <maxHistory>30</maxHistory>
-            <totalSizeCap>10GB</totalSizeCap>
-        </rollingPolicy>
-        <encoder>
-            <pattern>${networkPattern}</pattern>
-        </encoder>
-    </appender>
-
-    <appender name="AsyncNetworkOut" class="ch.qos.logback.classic.AsyncAppender">
-        <appender-ref ref="NetworkOut" />
-    </appender>
-
-    <logger name="network" level="INFO" additivity="false">
-        <appender-ref ref="AsyncNetworkOut" />
-    </logger>
-
-    <logger name="org.eclipse.jetty.server.RequestLog" level="info" additivity="false">
-        <appender-ref ref="AsyncNetworkOut" />
-    </logger>
-
-    <logger name="org.eclipse.jetty" level="ERROR" />
-
-    <root level="INFO">
-        <appender-ref ref="AsyncDebugOut" />
-        <appender-ref ref="AsyncErrorOut" />
-    </root>
-
-</configuration>
diff --git a/scripts/policy/drools-apps/custom/papDefaultConfig.json b/scripts/policy/drools-apps/custom/papDefaultConfig.json
new file mode 100644 (file)
index 0000000..2575d8a
--- /dev/null
@@ -0,0 +1,64 @@
+{
+    "name": "PapGroup",
+    "restServerParameters": {
+        "host": "0.0.0.0",
+        "port": 6969,
+        "userName": "healthcheck",
+        "password": "zb!XztG34",
+        "https": true,
+        "aaf": false
+    },
+    "pdpParameters": {
+        "heartBeatMs": 120000,
+        "updateParameters": {
+            "maxRetryCount": 1,
+            "maxWaitMs": 30000
+        },
+        "stateChangeParameters": {
+            "maxRetryCount": 1,
+            "maxWaitMs": 30000
+        }
+    },
+    "databaseProviderParameters": {
+        "name": "PolicyProviderParameterGroup",
+        "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl",
+        "databaseDriver": "org.mariadb.jdbc.Driver",
+        "databaseUrl": "jdbc:mariadb://mariadb:3306/policyadmin",
+        "databaseUser": "policy_user",
+        "databasePassword": "cG9saWN5X3VzZXI=",
+        "persistenceUnit": "PolicyMariaDb"
+    },
+    "topicParameterGroup": {
+        "topicSources" : [{
+            "topic" : "POLICY-PDP-PAP",
+            "servers" : [ "policy.api.simpledemo.onap.org" ],
+            "topicCommInfrastructure" : "dmaap",
+            "useHttps": true,
+            "allowSelfSignedCerts" : true
+        }],
+        "topicSinks" : [{
+            "topic" : "POLICY-PDP-PAP",
+            "servers" : [ "policy.api.simpledemo.onap.org" ],
+            "topicCommInfrastructure" : "dmaap",
+            "useHttps": true,
+            "allowSelfSignedCerts" : true
+        },
+        {
+            "topic" : "POLICY-NOTIFICATION",
+            "servers" : [ "policy.api.simpledemo.onap.org" ],
+            "topicCommInfrastructure" : "dmaap",
+            "useHttps": true,
+            "allowSelfSignedCerts" : true
+        }]
+    },
+    "healthCheckRestClientParameters":[{
+        "clientName": "api",
+        "hostname": "policy-api",
+        "port": 6969,
+        "userName": "healthcheck",
+        "password": "zb!XztG34",
+        "useHttps": true,
+        "allowSelfSignedCerts" : true,
+        "basePath": "policy/api/v1/healthcheck"
+    }]
+}
diff --git a/scripts/policy/drools-apps/custom/ssl/policy-keystore b/scripts/policy/drools-apps/custom/ssl/policy-keystore
deleted file mode 100644 (file)
index 389df5f..0000000
Binary files a/scripts/policy/drools-apps/custom/ssl/policy-keystore and /dev/null differ
diff --git a/scripts/policy/drools-apps/custom/ssl/policy-truststore b/scripts/policy/drools-apps/custom/ssl/policy-truststore
deleted file mode 100644 (file)
index 8834ac2..0000000
Binary files a/scripts/policy/drools-apps/custom/ssl/policy-truststore and /dev/null differ
diff --git a/scripts/policy/drools-apps/deploy.drools.policies.json b/scripts/policy/drools-apps/deploy.drools.policies.json
new file mode 100644 (file)
index 0000000..24c90d0
--- /dev/null
@@ -0,0 +1,27 @@
+{
+    "groups": [
+        {
+            "name": "defaultGroup",
+            "deploymentSubgroups": [
+                {
+                    "pdpType": "drools",
+                    "action": "POST",
+                    "policies": [
+                        {
+                            "name": "operational.restart",
+                            "version": "1.0.0"
+                        },
+                        {
+                            "name": "operational.scaleout",
+                            "version": "1.0.0"
+                        },
+                        {
+                            "name": "operational.modifyconfig",
+                            "version": "1.0.0"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
diff --git a/scripts/policy/drools-apps/deploy.xacml.policies.json b/scripts/policy/drools-apps/deploy.xacml.policies.json
new file mode 100644 (file)
index 0000000..46da902
--- /dev/null
@@ -0,0 +1,27 @@
+{
+    "groups": [
+        {
+            "name": "defaultGroup",
+            "deploymentSubgroups": [
+                {
+                    "pdpType": "xacml",
+                    "action": "POST",
+                    "policies": [
+                        {
+                            "name": "onap.restart.tca",
+                            "version": "1.0.0"
+                        },
+                        {
+                            "name": "onap.scaleout.tca",
+                            "version": "1.0.0"
+                        },
+                        {
+                            "name": "onap.vfirewall.tca",
+                            "version": "1.0.0"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
index 076157f..5098a17 100644 (file)
@@ -39,6 +39,24 @@ services:
        - 6669
        - 6670
        - 3905
+   api:
+      image: nexus3.onap.org:10001/onap/policy-api:${POLICY_API_VERSION}
+      container_name: policy-api
+      depends_on:
+       - mariadb
+      hostname: policy-api
+      expose:
+       - 6969
+   pap:
+      image: nexus3.onap.org:10001/onap/policy-pap:${POLICY_PAP_VERSION}
+      container_name: policy-pap
+      depends_on:
+       - mariadb
+      hostname: policy-pap
+      expose:
+       - 6969
+      volumes:
+       - ./custom/papDefaultConfig.json:/opt/app/policy/pap/etc/defaultConfig.json:ro
    policy-xacml-pdp:
       image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION}
       container_name: policy-xacml-pdp
@@ -49,7 +67,7 @@ services:
       expose:
        - 6969
       volumes:
-       - ./custom:/opt/app/policy/pdpx/etc:ro
+       - ./custom/xacmlDefaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro
    drools:
       image: nexus3.onap.org:10001/onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION}
       container_name: drools
@@ -82,6 +100,20 @@ services:
         policy.api.simpledemo.onap.org:6669
         policy.api.simpledemo.onap.org:6670
         policy.api.simpledemo.onap.org:3905
+   start_pap:
+      image: dadarek/wait-for-dependencies
+      environment:
+        TIMEOUT_LENGTH: 120
+      container_name: policy-wait-pap
+      depends_on:
+        - mariadb
+        - policy.api.simpledemo.onap.org
+        - pap
+      hostname: policy-wait-pap
+      command:
+        mariadb:3306
+        policy.api.simpledemo.onap.org:3905
+        pap:6969
    start_all:
       image: dadarek/wait-for-dependencies
       environment:
@@ -90,6 +122,8 @@ services:
       depends_on:
         - mariadb
         - policy.api.simpledemo.onap.org
+        - api
+        - pap
         - policy-xacml-pdp
         - drools
       hostname: policy-wait-all
@@ -100,4 +134,6 @@ services:
         policy.api.simpledemo.onap.org:6669
         policy.api.simpledemo.onap.org:6670
         policy.api.simpledemo.onap.org:3905
+        api:6969
+        pap:6969
         drools:6969
diff --git a/scripts/policy/drools-apps/manage.sh b/scripts/policy/drools-apps/manage.sh
deleted file mode 100755 (executable)
index 3635238..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# ===========LICENSE_START====================================================
-#  Copyright (C) 2020 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=====================================================
-#
-
-#
-# Injects a management request on the PDP-PAP topic.
-#
-
-if [ $# -ne 1 ]
-then
-    echo "arg(s): json-message-file-name" >&2
-    exit 1
-fi
-
-curl -k -H "Content-type: application/json" --data-binary @$1 \
-    https://${SIM_IP}:3905/events/POLICY-PDP-PAP
-echo
diff --git a/scripts/policy/drools-apps/passive.drools.json b/scripts/policy/drools-apps/passive.drools.json
deleted file mode 100644 (file)
index dca16d2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-       "messageName": "PDP_STATE_CHANGE",
-       "requestId": "88891208-2a73-452c-8d71-c93b422a7e03",
-       "timestampMs": 1584652299629,
-       "name": "drools",
-       "pdpGroup": "defaultGroup",
-       "pdpSubgroup": "drools",
-       "state": "PASSIVE"
-}
diff --git a/scripts/policy/drools-apps/policies.json b/scripts/policy/drools-apps/policies.json
deleted file mode 100644 (file)
index b477566..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-{
-       "messageName": "PDP_UPDATE",
-       "requestId": "88891208-2a73-452c-8d71-c93b422a7e03",
-       "timestampMs": 1584652299629,
-       "name": "drools",
-       "pdpGroup": "defaultGroup",
-       "pdpSubgroup": "drools",
-       "policies": [
-               {
-                   "type": "onap.policies.controlloop.operational.common.Drools",
-                   "type_version": "1.0.0",
-                   "version": "1.0.0",
-                   "name": "operational.restart",
-                   "metadata": {
-                       "policy-id": "operational.restart"
-                   },
-                   "properties": {
-                       "controllerName": "frankfurt",
-                       "id": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
-                       "timeout": 3600,
-                       "abatement": false,
-                       "trigger": "unique-policy-id-1-restart",
-                       "operations": [
-                           {
-                               "id": "unique-policy-id-1-restart",
-                               "description": "Restart the VM",
-                               "operation": {
-                                   "actor": "APPC",
-                                   "operation": "Restart",
-                                   "target": {
-                                       "targetType": "VM"
-                                   }
-                               },
-                               "timeout": 1200,
-                               "retries": 3,
-                               "success": "final_success",
-                               "failure": "final_failure",
-                               "failure_timeout": "final_failure_timeout",
-                               "failure_retries": "final_failure_retries",
-                               "failure_exception": "final_failure_exception",
-                               "failure_guard": "final_failure_guard"
-                           }
-                       ]
-                   }
-               },
-        {
-            "type": "onap.policies.controlloop.operational.common.Drools",
-            "type_version": "1.0.0",
-            "version": "1.0.0",
-            "name": "operational.scale.up",
-            "metadata": {
-                "policy-id": "operational.scale.up"
-            },
-            "properties": {
-                "controllerName": "frankfurt",
-                "id": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
-                "timeout": 60,
-                "abatement": false,
-                "trigger": "unique-policy-id-1-scale-up",
-                "operations": [
-                    {
-                        "id": "unique-policy-id-1-scale-up",
-                        "description": "Scale up",
-                        "operation": {
-                            "actor": "SO",
-                            "operation": "VF Module Create",
-                            "target": {
-                                "targetType": "VFMODULE",
-                                "entityIds": {
-                                    "modelInvariantId": "e6130d03-56f1-4b0a-9a1d-e1b2ebc30e0e",
-                                    "modelVersionId": "94b18b1d-cc91-4f43-911a-e6348665f292",
-                                    "modelName": "VfwclVfwsnkBbefb8ce2bde..base_vfw..module-0",
-                                    "modelVersion": 1,
-                                    "modelCustomizationId": "47958575-138f-452a-8c8d-d89b595f8164"
-                                }
-                            },
-                            "payload": {
-                                "requestParameters": "{\"usePreload\":true,\"userParams\":[]}",
-                                "configurationParameters": "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\",\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\",\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]"
-                            }
-                        },
-                        "timeout": 30,
-                        "retries": 0,
-                        "success": "final_success",
-                        "failure": "final_failure",
-                        "failure_timeout": "final_failure_timeout",
-                        "failure_retries": "final_failure_retries",
-                        "failure_exception": "final_failure_exception",
-                        "failure_guard": "final_failure_guard"
-                    }
-                ]
-            }
-        },
-        {
-            "type": "onap.policies.controlloop.operational.common.Drools",
-            "type_version": "1.0.0",
-            "name": "operational.modifyconfig",
-            "version": "1.0.0",
-            "metadata": {
-                "policy-id": "operational.modifyconfig"
-            },
-            "properties": {
-                "controllerName": "frankfurt",
-                "id": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
-                "timeout": 60,
-                "abatement": false,
-                "trigger": "unique-policy-id-1-modifyConfig",
-                "operations": [
-                    {
-                        "id": "unique-policy-id-1-modifyConfig",
-                        "description": "Modify the packet generator",
-                        "operation": {
-                            "actor": "APPC",
-                            "operation": "ModifyConfig",
-                            "target": {
-                                "targetType": "VNF",
-                                "entityIds": {
-                                    "resourceID": "bbb3cefd-01c8-413c-9bdd-2b92f9ca3d38"
-                                }
-                            }
-                        },
-                        "timeout": 7,
-                        "retries": 0,
-                        "success": "final_success",
-                        "failure": "final_failure",
-                        "failure_timeout": "final_failure_timeout",
-                        "failure_retries": "final_failure_retries",
-                        "failure_exception": "final_failure_exception",
-                        "failure_guard": "final_failure_guard"
-                    }
-                ]
-            }
-        }
-    ]
-}
index 0abd9f9..2839e5c 100644 (file)
 
 source ${SCRIPTS}/policy/config/policy-csit.conf
 
+rm -rf ${WORKSPACE}/dmaap-sim
+mkdir ${WORKSPACE}/dmaap-sim
+cd ${WORKSPACE}/dmaap-sim
+
 POLICY_MODELS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
 export POLICY_MODELS_VERSION="${POLICY_MODELS_VERSION_EXTRACT}"
 echo ${POLICY_MODELS_VERSION}
@@ -31,5 +35,3 @@ mkdir target
 curl -L $item -o target/policy-models-sim-dmaap-${POLICY_MODELS_VERSION}-tarball.tar.gz
 bash ./src/main/package/docker/docker_build.sh
 cd ${WORKSPACE}
-rm -rf ${WORK_DIR}
-
index 445a529..9e67d48 100755 (executable)
 
 source ${SCRIPTS}/policy/config/policy-csit.conf
 
+rm -rf ${WORKSPACE}/simulators
+mkdir ${WORKSPACE}/simulators
+cd ${WORKSPACE}/simulators
+
 POLICY_MODELS_VERSION_EXTRACT="$(curl -q --silent https://git.onap.org/policy/models/plain/pom.xml?h=${GERRIT_BRANCH} | xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' -)"
 export POLICY_MODELS_VERSION="${POLICY_MODELS_VERSION_EXTRACT}"
 echo ${POLICY_MODELS_VERSION}
@@ -30,6 +34,5 @@ item=`curl --silent -L ${NEXUS_URL}/org/onap/policy/models/sim/policy-models-sim
 mkdir target
 curl -L $item -o target/policy-models-simulators-${POLICY_MODELS_VERSION}-tarball.tar.gz
 bash ./src/main/package/docker/docker_build.sh
-cd ${WORKSPACE}
-rm -rf ${WORK_DIR}
 
+cd ${WORKSPACE}
index c5c8a79..2104566 100644 (file)
@@ -47,19 +47,107 @@ MakeTopics
     ${result}=     Run Process        ${SCR2}/make_topic.sh     POLICY-CL-MGT
     Should Be Equal As Integers        ${result.rc}    0
 
-PolicyActivate
-    [Documentation]    Activates the Policies
-    ${result}=     Run Process        ${SCR2}/manage.sh     ${SCR2}/policies.json
-    Should Be Equal As Integers        ${result.rc}    0
-    ${result}=     Run Process        ${SCR2}/manage.sh     ${SCR2}/activate.drools.json
+CreateVcpeXacmlPolicy
+    [Documentation]    Create VCPE Policy for Xacml
+    ${auth}=    Create List    healthcheck    zb!XztG34
+    ${postyaml}=  Get file  ${DATA}/vCPE.policy.monitoring.input.tosca.yaml
+    Log    Creating session https://${API_IP}:6969
+    ${session}=    Create Session      policy  https://${API_IP}:6969   auth=${auth}
+    ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
+    ${resp}=   Post Request   policy  /policy/api/v1/policies  data=${postyaml}   headers=${headers}
+    Log    Received response from api ${resp.text}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+CreateVcpeDroolsPolicy
+    [Documentation]    Create VCPE Policy for Drools
+    ${auth}=    Create List    healthcheck    zb!XztG34
+    ${postyaml}=  Get file  ${DATA}/vCPE.policy.operational.input.tosca.yaml
+    Log    Creating session https://${API_IP}:6969
+    ${session}=    Create Session      policy  https://${API_IP}:6969   auth=${auth}
+    ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
+    ${resp}=   Post Request   policy  /policy/api/v1/policies  data=${postyaml}   headers=${headers}
+    Log    Received response from api ${resp.text}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+CreateVdnsXacmlPolicy
+    [Documentation]    Create VDNS Policy for Xacml
+    ${auth}=    Create List    healthcheck    zb!XztG34
+    ${postyaml}=  Get file  ${DATA}/vDNS.policy.monitoring.input.tosca.yaml
+    Log    Creating session https://${API_IP}:6969
+    ${session}=    Create Session      policy  https://${API_IP}:6969   auth=${auth}
+    ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
+    ${resp}=   Post Request   policy  /policy/api/v1/policies  data=${postyaml}   headers=${headers}
+    Log    Received response from api ${resp.text}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+CreateVdnsDroolsPolicy
+    [Documentation]    Create VDNS Policy for Drools
+    ${auth}=    Create List    healthcheck    zb!XztG34
+    ${postjson}=  Get file  ${DATA}/vDNS.policy.operational.input.tosca.json
+    Log    Creating session https://${API_IP}:6969
+    ${session}=    Create Session      policy  https://${API_IP}:6969   auth=${auth}
+    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+    ${resp}=   Post Request   policy  /policy/api/v1/policies  data=${postjson}   headers=${headers}
+    Log    Received response from api ${resp.text}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+CreateVfwXacmlPolicy
+    [Documentation]    Create VFW Policy for Xacml
+    ${auth}=    Create List    healthcheck    zb!XztG34
+    ${postyaml}=  Get file  ${DATA}/vFirewall.policy.monitoring.input.tosca.yaml
+    Log    Creating session https://${API_IP}:6969
+    ${session}=    Create Session      policy  https://${API_IP}:6969   auth=${auth}
+    ${headers}=  Create Dictionary     Accept=application/yaml    Content-Type=application/yaml
+    ${resp}=   Post Request   policy  /policy/api/v1/policies  data=${postyaml}   headers=${headers}
+    Log    Received response from api ${resp.text}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+CreateVfwDroolsPolicy
+    [Documentation]    Create VFW Policy for Drools
+    ${auth}=    Create List    healthcheck    zb!XztG34
+    ${postjson}=  Get file  ${DATA}/vFirewall.policy.operational.input.tosca.json
+    Log    Creating session https://${API_IP}:6969
+    ${session}=    Create Session      policy  https://${API_IP}:6969   auth=${auth}
+    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+    ${resp}=   Post Request   policy  /policy/api/v1/policies  data=${postjson}   headers=${headers}
+    Log    Received response from api ${resp.text}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+DeployXacmlPolicies
+    [Documentation]    Deploys the Policies to Xacml
+    ${auth}=    Create List    healthcheck    zb!XztG34
+    Log    Creating session https://${PAP_IP}:6969
+    ${postjson}=  Get file  ${SCR2}/deploy.xacml.policies.json
+    ${session}=    Create Session      policy  https://${PAP_IP}:6969   auth=${auth}
+    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+    ${resp}=   Post Request     policy  /policy/pap/v1/pdps/deployments/batch    data=${postjson}     headers=${headers}
+    Log    Received response from pap ${resp.text}
+    Should Be Equal As Strings    ${resp.status_code}     200
+    ${result}=     Run Process        ${SCR2}/wait_topic.sh     POLICY-PDP-PAP
+    ...            responseTo    xacml    ACTIVE
+    Log    Received status ${result.stdout}
     Should Be Equal As Integers        ${result.rc}    0
+    Should Contain    ${result.stdout}    onap.restart.tca
+    Should Contain    ${result.stdout}    onap.scaleout.tca
+    Should Contain    ${result.stdout}    onap.vfirewall.tca
+
+DeployDroolsPolicies
+    [Documentation]    Deploys the Policies to Drools
+    ${auth}=    Create List    healthcheck    zb!XztG34
+    Log    Creating session https://${PAP_IP}:6969
+    ${postjson}=  Get file  ${SCR2}/deploy.drools.policies.json
+    ${session}=    Create Session      policy  https://${PAP_IP}:6969   auth=${auth}
+    ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+    ${resp}=   Post Request     policy  /policy/pap/v1/pdps/deployments/batch    data=${postjson}     headers=${headers}
+    Log    Received response from pap ${resp.text}
+    Should Be Equal As Strings    ${resp.status_code}     200
     ${result}=     Run Process        ${SCR2}/wait_topic.sh     POLICY-PDP-PAP
     ...            responseTo    drools    ACTIVE
     Log    Received status ${result.stdout}
     Sleep    3s
     Should Be Equal As Integers        ${result.rc}    0
     Should Contain    ${result.stdout}    operational.restart
-    Should Contain    ${result.stdout}    operational.scale.up
+    Should Contain    ${result.stdout}    operational.scaleout
     Should Contain    ${result.stdout}    operational.modifyconfig
 
 VcpeExecute