aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-14 15:19:53 -0400
committerJim Hahn <jrh3@att.com>2020-04-14 17:29:25 -0400
commit426ddc1c61efc12b95aa1013d9137411a4e46d5e (patch)
treef69bee9dd67a110848aadc8c80b546b69780bf1c
parent295b9221b5cd7f3fe160e5048d607e82675f321d (diff)
Add CSITs for vCPE, vDNS, and vFW policies
Runs xacml and drools, but does not currently run api or pap. PAP actions are simulated by injecting messages onto the dmaap topic read by xacml-pdp and drools-pdp. All other systems (e.g., dmaap, aai) are simulated using policy-models-simulators. Issue-ID: POLICY-2491 Change-Id: Ic05e3a6514e84040f5a965aa8d2cac9ed2e9abc2 Signed-off-by: Jim Hahn <jrh3@att.com>
-rwxr-xr-xplans/policy/drools-applications/setup.sh56
-rwxr-xr-xplans/policy/drools-applications/teardown.sh12
-rwxr-xr-xscripts/policy/config/drools-apps/custom/features.pre.sh9
-rw-r--r--scripts/policy/config/drools-apps/env/base.conf42
-rw-r--r--scripts/policy/config/sim-all/simParameters.json98
-rw-r--r--scripts/policy/docker-compose-drools-apps.yml41
-rw-r--r--scripts/policy/drools-apps/activate.drools.json9
-rw-r--r--scripts/policy/drools-apps/activate.xacml.json9
-rw-r--r--scripts/policy/drools-apps/custom/defaultConfig.json37
-rw-r--r--scripts/policy/drools-apps/custom/logback.xml104
-rw-r--r--scripts/policy/drools-apps/custom/ssl/policy-keystorebin0 -> 4431 bytes
-rw-r--r--scripts/policy/drools-apps/custom/ssl/policy-truststorebin0 -> 124180 bytes
-rw-r--r--scripts/policy/drools-apps/docker-compose-drools-apps.yml103
-rwxr-xr-xscripts/policy/drools-apps/make_topic.sh (renamed from scripts/policy/config/drools-apps/custom/noop.pre.sh)32
-rwxr-xr-xscripts/policy/drools-apps/manage.sh32
-rwxr-xr-xscripts/policy/drools-apps/onset.sh32
-rw-r--r--scripts/policy/drools-apps/passive.drools.json9
-rw-r--r--scripts/policy/drools-apps/policies.json135
-rw-r--r--scripts/policy/drools-apps/vcpeOnset.json16
-rw-r--r--scripts/policy/drools-apps/vdnsOnset.json16
-rw-r--r--scripts/policy/drools-apps/vfwOnset.json17
-rwxr-xr-xscripts/policy/drools-apps/wait_topic.sh61
-rwxr-xr-xscripts/policy/policy-models-simulators.sh35
-rw-r--r--tests/policy/drools-applications/drools-applications-test.robot205
24 files changed, 977 insertions, 133 deletions
diff --git a/plans/policy/drools-applications/setup.sh b/plans/policy/drools-applications/setup.sh
index c66c4929..99b0015c 100755
--- a/plans/policy/drools-applications/setup.sh
+++ b/plans/policy/drools-applications/setup.sh
@@ -1,7 +1,8 @@
#!/bin/bash
-# ============LICENSE_START=======================================================
+#
+# ===========LICENSE_START====================================================
# Copyright (C) 2019-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
@@ -13,9 +14,8 @@
# 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=====================================================
#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
# OS upgrades
@@ -24,41 +24,57 @@ export POLICY_MARIADB_VER
echo ${GERRIT_BRANCH}
echo ${POLICY_MARIADB_VER}
+SCR2=${WORKSPACE}/scripts/policy/drools-apps
+
echo "Uninstall docker-py and reinstall docker."
pip uninstall -y docker-py
pip uninstall -y docker
pip install -U docker==2.7.0
sudo apt-get -y install libxml2-utils
+${SCRIPTS}/policy/policy-models-simulators.sh
+
+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()' -)"
echo ${POLICY_DROOLS_APPS_VERSION_EXTRACT}
export POLICY_DROOLS_APPS_VERSION="${POLICY_DROOLS_APPS_VERSION_EXTRACT:0:3}-SNAPSHOT-latest"
+
+echo ${POLICY_XACML_PDP_VERSION}
echo ${POLICY_DROOLS_APPS_VERSION}
echo "user information: $(id)"
echo "docker and docker-compose versions:"
docker -v && docker-compose -v
-docker container ls -a
+# 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
+
+# now bring everything else up
+docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_all
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml up -d
-sleep 2m
+unset http_proxy https_proxy
-docker container ls -a
+DROOLS_IP=`get-instance-ip.sh drools`
+XACML_IP=`get-instance-ip.sh policy-xacml-pdp`
+SIM_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org`
+export SIM_IP
-POLICY_DROOLS_IP=`get-instance-ip.sh drools`
-MARIADB_IP=`get-instance-ip.sh mariadb`
+echo DROOLS IP IS ${DROOLS_IP}
+echo XACML IP IS ${XACML_IP}
+echo SIMULATORS IP IS ${SIM_IP}
-echo DROOLS IP IS ${POLICY_DROOLS_IP}
-echo MARIADB IP IS ${MARIADB_IP}
+# activate xacml
+${SCR2}/manage.sh ${SCR2}/activate.xacml.json
-for i in {1..10}; do
- curl -sS ${POLICY_DROOLS_IP}:6969 && break
- echo sleep $i
- sleep $i
-done
+# give enough time for the controllers to come up
+sleep 15
-# to give enough time to the usecases controller to come up
-sleep 2m
+# wait for xacml to activate
+${SCRIPTS}/policy/wait_for_port.sh ${XACML_IP} 6969
-ROBOT_VARIABLES="-v POLICY_DROOLS_IP:${POLICY_DROOLS_IP}"
+ROBOT_VARIABLES=""
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR2:${SCR2}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DROOLS_IP:${DROOLS_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v XACML_IP:${XACML_IP}"
+ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SIM_IP:${SIM_IP}"
diff --git a/plans/policy/drools-applications/teardown.sh b/plans/policy/drools-applications/teardown.sh
index 886b1ea3..8b577d8e 100755
--- a/plans/policy/drools-applications/teardown.sh
+++ b/plans/policy/drools-applications/teardown.sh
@@ -1,21 +1,23 @@
#!/bin/bash
#
-# Copyright 2020 AT&T Intellectual Property. All rights reserved.
-#
+# ===========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
+# 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=====================================================
#
mkdir -p $WORKSPACE/archives/
+docker-compose -f ${WORKSPACE}/scripts/policy/drools-apps/docker-compose-drools-apps.yml logs > $WORKSPACE/archives/docker-compose-drools-apps.log
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml logs > $WORKSPACE/archives/docker-compose-drools-apps.log
-docker-compose -f ${WORKSPACE}/scripts/policy/docker-compose-drools-apps.yml down -v
+docker-compose -f ${WORKSPACE}/scripts/policy/drools-apps/docker-compose-drools-apps.yml down -v
diff --git a/scripts/policy/config/drools-apps/custom/features.pre.sh b/scripts/policy/config/drools-apps/custom/features.pre.sh
index 93d6c6b9..e9c77a0f 100755
--- a/scripts/policy/config/drools-apps/custom/features.pre.sh
+++ b/scripts/policy/config/drools-apps/custom/features.pre.sh
@@ -1,7 +1,7 @@
#!/bin/bash -x
-# ============LICENSE_START=======================================================
+# ============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
@@ -13,7 +13,6 @@
# 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=========================================================
+# ============LICENSE_END=====================================================
-features disable distributed-locking
-features enable controlloop-utils
+bash -c "features disable distributed-locking"
diff --git a/scripts/policy/config/drools-apps/env/base.conf b/scripts/policy/config/drools-apps/env/base.conf
index b5e7cbd1..673cfaf3 100644
--- a/scripts/policy/config/drools-apps/env/base.conf
+++ b/scripts/policy/config/drools-apps/env/base.conf
@@ -1,6 +1,6 @@
-# ============LICENSE_START=======================================================
+# ============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
@@ -12,7 +12,7 @@
# 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=========================================================
+# ============LICENSE_END====================================================
# JVM options
@@ -78,55 +78,55 @@ PAP_PASSWORD=alpha123
# PDP-X
-PDP_HOST=pdp
+GUARD_DISABLED=false
+PDP_HOST=policy-xacml-pdp
PDP_PORT=6969
PDP_CONTEXT_URI=policy/pdpx/v1/
-PDP_USERNAME=testpdp
-PDP_PASSWORD=alpha123
+PDP_USERNAME=healthcheck
+PDP_PASSWORD=zb!XztG34
PDP_CLIENT_USERNAME=python
PDP_CLIENT_PASSWORD=test
PDP_ENVIRONMENT=TEST
-GUARD_DISABLED=false
# DCAE DMaaP
DCAE_TOPIC=unauthenticated.DCAE_CL_OUTPUT
-DCAE_SERVERS=mr.api.simpledemo.onap.org
+DCAE_SERVERS=policy.api.simpledemo.onap.org
DCAE_CONSUMER_GROUP=dcae.policy.shared
# Open DMaaP
-DMAAP_SERVERS=mr.api.simpledemo.onap.org
+DMAAP_SERVERS=policy.api.simpledemo.onap.org
# AAI
-AAI_HOST=aai.api.simpledemo.onap.org
-AAI_PORT=8443
+AAI_HOST=policy.api.simpledemo.onap.org
+AAI_PORT=6666
AAI_CONTEXT_URI=
AAI_USERNAME=policy@policy.onap.org
AAI_PASSWORD=demo123456!
# MSO
-SO_HOST=vm1.mso.simpledemo.onap.org
-SO_PORT=8080
-SO_CONTEXT_URI=onap/so/infra/
-SO_URL=http://vm1.mso.simpledemo.onap.org:8080/onap/so/infra
+SO_HOST=policy.api.simpledemo.onap.org
+SO_PORT=6669
+SO_CONTEXT_URI=
+SO_URL=https://policy.api.simpledemo.onap.org:6669/
SO_USERNAME=InfraPortalClient
SO_PASSWORD=password1$
# VFC
-VFC_HOST=
-VFC_PORT=
-VFC_CONTEXT_URI=api/nslcm/v1/
+VFC_HOST=policy.api.simpledemo.onap.org
+VFC_PORT=6670
+VFC_CONTEXT_URI=
VFC_USERNAME=
VFC_PASSWORD=
# SDNC
-SDNC_HOST=
-SDNC_PORT=
-SDNC_CONTEXT_URI=restconf/operations/
+SDNC_HOST=policy.api.simpledemo.onap.org
+SDNC_PORT=6668
+SDNC_CONTEXT_URI=
SDNC_USERNAME=
SDNC_PASSWORD=
diff --git a/scripts/policy/config/sim-all/simParameters.json b/scripts/policy/config/sim-all/simParameters.json
new file mode 100644
index 00000000..cd347337
--- /dev/null
+++ b/scripts/policy/config/sim-all/simParameters.json
@@ -0,0 +1,98 @@
+{
+ "dmaapProvider": {
+ "name": "DMaaP simulator",
+ "topicSweepSec": 300,
+ "restServerParameters": { }
+ },
+ "restServers": [
+ {
+ "name": "DMaaP simulator",
+ "providerClass": "org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1",
+ "host": "0.0.0.0",
+ "port": 3905,
+ "https": true
+ },
+ {
+ "name": "A&AI simulator",
+ "providerClass": "org.onap.policy.simulators.AaiSimulatorJaxRs",
+ "host": "0.0.0.0",
+ "port": 6666,
+ "https": true,
+ "userName": "policy@policy.onap.org",
+ "password": "demo123456!"
+ },
+ {
+ "name": "SDNC simulator",
+ "providerClass": "org.onap.policy.simulators.SdncSimulatorJaxRs",
+ "host": "0.0.0.0",
+ "port": 6668,
+ "https": true
+ },
+ {
+ "name": "SO simulator",
+ "providerClass": "org.onap.policy.simulators.SoSimulatorJaxRs",
+ "host": "0.0.0.0",
+ "port": 6669,
+ "https": true,
+ "userName": "InfraPortalClient",
+ "password": "password1$"
+ },
+ {
+ "name": "VFC simulator",
+ "providerClass": "org.onap.policy.simulators.VfcSimulatorJaxRs",
+ "host": "0.0.0.0",
+ "port": 6670,
+ "https": true
+ }
+ ],
+ "topicSinks": [
+ {
+ "topic": "APPC-CL",
+ "servers": ["${HOST_NAME}"],
+ "topicCommInfrastructure": "DMAAP",
+ "useHttps": true,
+ "apiKey": "some-key",
+ "apiSecret": "some-secret"
+ },
+ {
+ "topic": "APPC-LCM-WRITE",
+ "servers": ["${HOST_NAME}"],
+ "topicCommInfrastructure": "DMAAP",
+ "useHttps": true,
+ "apiKey": "some-key",
+ "apiSecret": "some-secret"
+ }
+ ],
+ "topicSources": [
+ {
+ "topic": "APPC-CL",
+ "servers": ["${HOST_NAME}"],
+ "topicCommInfrastructure": "DMAAP",
+ "useHttps": true,
+ "apiKey": "some-key",
+ "apiSecret": "some-secret"
+ },
+ {
+ "topic": "APPC-LCM-READ",
+ "servers": ["${HOST_NAME}"],
+ "topicCommInfrastructure": "DMAAP",
+ "useHttps": true,
+ "apiKey": "some-key",
+ "apiSecret": "some-secret"
+ }
+ ],
+ "topicServers": [
+ {
+ "name": "APPC Legacy simulator",
+ "providerClass": "org.onap.policy.simulators.AppcLegacyTopicServer",
+ "sink": "APPC-CL",
+ "source": "APPC-CL"
+ },
+ {
+ "name": "APPC-LCM simulator",
+ "providerClass": "org.onap.policy.simulators.AppcLcmTopicServer",
+ "sink": "APPC-LCM-WRITE",
+ "source": "APPC-LCM-READ"
+ }
+ ]
+}
diff --git a/scripts/policy/docker-compose-drools-apps.yml b/scripts/policy/docker-compose-drools-apps.yml
deleted file mode 100644
index 704de81b..00000000
--- a/scripts/policy/docker-compose-drools-apps.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 2019-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.
-version: '2'
-services:
- mariadb:
- image: mariadb:${POLICY_MARIADB_VER}
- container_name: mariadb
- hostname: mariadb
- command: ['--lower-case-table-names=1', '--wait_timeout=28800']
- env_file:
- - ${WORKSPACE}/scripts/policy/config/db/db.conf
- volumes:
- - ${WORKSPACE}/scripts/policy/config/db:/docker-entrypoint-initdb.d
- expose:
- - 3306
- drools:
- image: nexus3.onap.org:10001/onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION}
- container_name: drools
- depends_on:
- - mariadb
- hostname: drools
- expose:
- - 6969
- - 9696
- volumes:
- - ${WORKSPACE}/scripts/policy/config/drools-apps/custom:/tmp/policy-install/config
- env_file:
- - ${WORKSPACE}/scripts/policy/config/drools-apps/env/base.conf
- - ${WORKSPACE}/scripts/policy/config/drools-apps/env/feature-healthcheck.conf
- - ${WORKSPACE}/scripts/policy/config/drools-apps/env/feature-pooling-dmaap.conf
diff --git a/scripts/policy/drools-apps/activate.drools.json b/scripts/policy/drools-apps/activate.drools.json
new file mode 100644
index 00000000..681bf6ab
--- /dev/null
+++ b/scripts/policy/drools-apps/activate.drools.json
@@ -0,0 +1,9 @@
+{
+ "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
new file mode 100644
index 00000000..1ee79c26
--- /dev/null
+++ b/scripts/policy/drools-apps/activate.xacml.json
@@ -0,0 +1,9 @@
+{
+ "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/defaultConfig.json b/scripts/policy/drools-apps/custom/defaultConfig.json
new file mode 100644
index 00000000..5a6573a3
--- /dev/null
+++ b/scripts/policy/drools-apps/custom/defaultConfig.json
@@ -0,0 +1,37 @@
+{
+ "name": "XacmlPdpParameters",
+ "pdpGroup": "defaultGroup",
+ "restServerParameters": {
+ "host": "0.0.0.0",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "https": true,
+ "aaf": false
+ },
+ "policyApiParameters": {
+ "host": "policy-api",
+ "port": 6969,
+ "userName": "healthcheck",
+ "password": "zb!XztG34",
+ "https": true,
+ "aaf": false
+ },
+ "applicationPath": "/opt/app/policy/pdpx/apps",
+ "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
+ }]
+ }
+}
diff --git a/scripts/policy/drools-apps/custom/logback.xml b/scripts/policy/drools-apps/custom/logback.xml
new file mode 100644
index 00000000..7f20cfc0
--- /dev/null
+++ b/scripts/policy/drools-apps/custom/logback.xml
@@ -0,0 +1,104 @@
+<!--
+ ============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/ssl/policy-keystore b/scripts/policy/drools-apps/custom/ssl/policy-keystore
new file mode 100644
index 00000000..389df5fe
--- /dev/null
+++ b/scripts/policy/drools-apps/custom/ssl/policy-keystore
Binary files differ
diff --git a/scripts/policy/drools-apps/custom/ssl/policy-truststore b/scripts/policy/drools-apps/custom/ssl/policy-truststore
new file mode 100644
index 00000000..8834ac25
--- /dev/null
+++ b/scripts/policy/drools-apps/custom/ssl/policy-truststore
Binary files differ
diff --git a/scripts/policy/drools-apps/docker-compose-drools-apps.yml b/scripts/policy/drools-apps/docker-compose-drools-apps.yml
new file mode 100644
index 00000000..076157f4
--- /dev/null
+++ b/scripts/policy/drools-apps/docker-compose-drools-apps.yml
@@ -0,0 +1,103 @@
+#
+# ===========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=====================================================
+#
+version: '2'
+services:
+ mariadb:
+ image: mariadb:${POLICY_MARIADB_VER}
+ container_name: mariadb
+ hostname: mariadb
+ command: ['--lower-case-table-names=1', '--wait_timeout=28800']
+ env_file: ../config/db/db.conf
+ volumes:
+ - ../config/db:/docker-entrypoint-initdb.d:ro
+ expose:
+ - 3306
+ policy.api.simpledemo.onap.org:
+ image: policy/simulators
+ container_name: policy.api.simpledemo.onap.org
+ hostname: policy.api.simpledemo.onap.org
+ volumes:
+ - ../config/sim-all:/opt/app/policy/simulators/etc/parameters:ro
+ expose:
+ - 6666
+ - 6668
+ - 6669
+ - 6670
+ - 3905
+ policy-xacml-pdp:
+ image: nexus3.onap.org:10001/onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION}
+ container_name: policy-xacml-pdp
+ depends_on:
+ - mariadb
+ - policy.api.simpledemo.onap.org
+ hostname: policy-xacml-pdp
+ expose:
+ - 6969
+ volumes:
+ - ./custom:/opt/app/policy/pdpx/etc:ro
+ drools:
+ image: nexus3.onap.org:10001/onap/policy-pdpd-cl:${POLICY_DROOLS_APPS_VERSION}
+ container_name: drools
+ depends_on:
+ - mariadb
+ - policy.api.simpledemo.onap.org
+ hostname: drools
+ expose:
+ - 6969
+ - 9696
+ volumes:
+ - ../config/drools-apps/custom:/tmp/policy-install/config:ro
+ env_file:
+ - ../config/drools-apps/env/base.conf
+ - ../config/drools-apps/env/feature-healthcheck.conf
+ - ../config/drools-apps/env/feature-pooling-dmaap.conf
+ start_dependencies:
+ image: dadarek/wait-for-dependencies
+ environment:
+ TIMEOUT_LENGTH: 60
+ container_name: policy-wait
+ depends_on:
+ - mariadb
+ - policy.api.simpledemo.onap.org
+ hostname: policy-wait
+ command:
+ mariadb:3306
+ policy.api.simpledemo.onap.org:6666
+ policy.api.simpledemo.onap.org:6668
+ policy.api.simpledemo.onap.org:6669
+ policy.api.simpledemo.onap.org:6670
+ policy.api.simpledemo.onap.org:3905
+ start_all:
+ image: dadarek/wait-for-dependencies
+ environment:
+ TIMEOUT_LENGTH: 120
+ container_name: policy-wait-all
+ depends_on:
+ - mariadb
+ - policy.api.simpledemo.onap.org
+ - policy-xacml-pdp
+ - drools
+ hostname: policy-wait-all
+ command:
+ mariadb:3306
+ policy.api.simpledemo.onap.org:6666
+ policy.api.simpledemo.onap.org:6668
+ policy.api.simpledemo.onap.org:6669
+ policy.api.simpledemo.onap.org:6670
+ policy.api.simpledemo.onap.org:3905
+ drools:6969
diff --git a/scripts/policy/config/drools-apps/custom/noop.pre.sh b/scripts/policy/drools-apps/make_topic.sh
index 4b0c2199..36d43e9d 100755
--- a/scripts/policy/config/drools-apps/custom/noop.pre.sh
+++ b/scripts/policy/drools-apps/make_topic.sh
@@ -1,7 +1,8 @@
-#!/bin/bash -x
-# ============LICENSE_START=======================================================
-# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
-# ================================================================================
+#!/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
@@ -13,13 +14,20 @@
# 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=========================================================
+# ============LICENSE_END=====================================================
+#
+
+#
+# Creates a topic, which happens as a side-effect of polling it.
+#
+
+if [ $# -ne 1 ]
+then
+ echo "arg(s): topic-name" >&2
+ exit 1
+fi
-sed -i "s/^dmaap/noop/g" \
- ${POLICY_HOME}/config/engine.properties \
- ${POLICY_HOME}/config/feature-lifecycle.properties \
- ${POLICY_HOME}/config/frankfurt-controller.properties
+topic="${1}"
-chmod 644 ${POLICY_HOME}/config/engine.properties \
- ${POLICY_HOME}/config/feature-lifecycle.properties \
- ${POLICY_HOME}/config/frankfurt-controller.properties
+curl -s -k "https://${SIM_IP}:3905/events/${topic}/script/1?limit=1&timeout=0"
+echo
diff --git a/scripts/policy/drools-apps/manage.sh b/scripts/policy/drools-apps/manage.sh
new file mode 100755
index 00000000..36352385
--- /dev/null
+++ b/scripts/policy/drools-apps/manage.sh
@@ -0,0 +1,32 @@
+#!/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/onset.sh b/scripts/policy/drools-apps/onset.sh
new file mode 100755
index 00000000..f2918a68
--- /dev/null
+++ b/scripts/policy/drools-apps/onset.sh
@@ -0,0 +1,32 @@
+#!/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 an ONSET event on the DCAE_CL_OUTPUT 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/unauthenticated.DCAE_CL_OUTPUT
+echo
diff --git a/scripts/policy/drools-apps/passive.drools.json b/scripts/policy/drools-apps/passive.drools.json
new file mode 100644
index 00000000..dca16d28
--- /dev/null
+++ b/scripts/policy/drools-apps/passive.drools.json
@@ -0,0 +1,9 @@
+{
+ "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
new file mode 100644
index 00000000..b4775661
--- /dev/null
+++ b/scripts/policy/drools-apps/policies.json
@@ -0,0 +1,135 @@
+{
+ "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"
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/scripts/policy/drools-apps/vcpeOnset.json b/scripts/policy/drools-apps/vcpeOnset.json
new file mode 100644
index 00000000..7dd9d5a0
--- /dev/null
+++ b/scripts/policy/drools-apps/vcpeOnset.json
@@ -0,0 +1,16 @@
+{
+ "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e",
+ "closedLoopAlarmStart": 1463679805324,
+ "closedLoopEventClient": "DCAE_INSTANCE_ID.dcae-tca",
+ "closedLoopEventStatus": "ONSET",
+ "requestID": "664be3d2-6c12-4f4b-a3e7-c349acced200",
+ "target_type": "VNF",
+ "target": "generic-vnf.vnf-id",
+ "AAI": {
+ "vserver.is-closed-loop-disabled": "false",
+ "vserver.prov-status": "ACTIVE",
+ "generic-vnf.vnf-id": "vCPE_Infrastructure_vGMUX_demo_app"
+ },
+ "from": "DCAE",
+ "version": "1.0.2"
+}
diff --git a/scripts/policy/drools-apps/vdnsOnset.json b/scripts/policy/drools-apps/vdnsOnset.json
new file mode 100644
index 00000000..13f69095
--- /dev/null
+++ b/scripts/policy/drools-apps/vdnsOnset.json
@@ -0,0 +1,16 @@
+{
+ "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3",
+ "closedLoopAlarmStart": 1463679805324,
+ "closedLoopEventClient": "microservice.stringmatcher",
+ "closedLoopEventStatus": "ONSET",
+ "requestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
+ "target_type": "VNF",
+ "target": "vserver.vserver-name",
+ "AAI": {
+ "vserver.is-closed-loop-disabled": "false",
+ "vserver.prov-status": "ACTIVE",
+ "vserver.vserver-name": "OzVServer"
+ },
+ "from": "DCAE",
+ "version": "1.0.2"
+}
diff --git a/scripts/policy/drools-apps/vfwOnset.json b/scripts/policy/drools-apps/vfwOnset.json
new file mode 100644
index 00000000..7782867a
--- /dev/null
+++ b/scripts/policy/drools-apps/vfwOnset.json
@@ -0,0 +1,17 @@
+{
+ "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a",
+ "closedLoopAlarmStart": 1463679805324,
+ "closedLoopEventClient": "microservice.stringmatcher",
+ "closedLoopEventStatus": "ONSET",
+ "requestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
+ "target_type": "VNF",
+ "target": "generic-vnf.vnf-name",
+ "AAI": {
+ "vserver.is-closed-loop-disabled": "false",
+ "vserver.prov-status": "ACTIVE",
+ "generic-vnf.vnf-name": "fw0002vm002fw002",
+ "vserver.vserver-name": "OzVServer"
+ },
+ "from": "DCAE",
+ "version": "1.0.2"
+}
diff --git a/scripts/policy/drools-apps/wait_topic.sh b/scripts/policy/drools-apps/wait_topic.sh
new file mode 100755
index 00000000..4271abc6
--- /dev/null
+++ b/scripts/policy/drools-apps/wait_topic.sh
@@ -0,0 +1,61 @@
+#!/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=====================================================
+#
+
+#
+# Polls a topic for a message. Additional text items can be specified,
+# in which case, it discards messages that do not contain all of the
+# specified text items.
+#
+# Exits with a non-zero status if no matching message is received on the
+# topic before the timeout.
+#
+
+if [ $# -lt 1 ]
+then
+ echo "arg(s): topic-name [text-to-match1 [text-to-match2 ...]]" >&2
+ exit 1
+fi
+
+topic="${1}"
+shift
+
+matched=no
+
+while [ ${matched} = "no" ]
+do
+ msg=`curl -s -k "https://${SIM_IP}:3905/events/${topic}/script/1?limit=1"`
+ if [ $? -ne 0 -o "${msg}" = "[]" ]
+ then
+ echo not found >&2
+ exit 2
+ fi
+
+ matched=yes
+ for text in "$@"
+ do
+ echo "${msg}" | grep -q "${text}"
+ if [ $? -ne 0 ]
+ then
+ matched=no
+ break
+ fi
+ done
+done
+
+echo "${msg}"
diff --git a/scripts/policy/policy-models-simulators.sh b/scripts/policy/policy-models-simulators.sh
new file mode 100755
index 00000000..445a529b
--- /dev/null
+++ b/scripts/policy/policy-models-simulators.sh
@@ -0,0 +1,35 @@
+#!/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=====================================================
+#
+
+source ${SCRIPTS}/policy/config/policy-csit.conf
+
+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}
+
+# download simulators tarball and build docker image
+git clone --depth 1 https://gerrit.onap.org/r/policy/models -b ${GERRIT_BRANCH}
+cd models/models-sim/policy-models-simulators
+item=`curl --silent -L ${NEXUS_URL}/org/onap/policy/models/sim/policy-models-simulators/${POLICY_MODELS_VERSION} | egrep 'policy-models-simulators-.*tarball' | cut '-d"' -f2 | egrep 'gz$' | sort | tail -1`
+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}
+
diff --git a/tests/policy/drools-applications/drools-applications-test.robot b/tests/policy/drools-applications/drools-applications-test.robot
index c3586cfa..c5c8a797 100644
--- a/tests/policy/drools-applications/drools-applications-test.robot
+++ b/tests/policy/drools-applications/drools-applications-test.robot
@@ -1,40 +1,187 @@
*** Settings ***
Library Collections
+Library String
Library RequestsLibrary
Library OperatingSystem
+Library Process
Library json
*** Test Cases ***
Alive
- [Documentation] Runs Policy PDP Alive Check
- ${auth}= Create List demo@people.osaaf.org demo123456!
- Log Creating session https://${POLICY_DROOLS_IP}:9696
- ${session}= Create Session policy https://${POLICY_DROOLS_IP}:9696 auth=${auth}
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- ${resp}= Get Request policy /policy/pdp/engine headers=${headers}
- Log Received response from policy ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Be Equal As Strings ${resp.json()['alive']} True
+ [Documentation] Runs Policy PDP Alive Check
+ ${auth}= Create List demo@people.osaaf.org demo123456!
+ Log Creating session https://${DROOLS_IP}:9696
+ ${session}= Create Session policy https://${DROOLS_IP}:9696 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy /policy/pdp/engine headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As Strings ${resp.json()['alive']} True
Healthcheck
- [Documentation] Runs Policy PDP-D Health check
- ${auth}= Create List demo@people.osaaf.org demo123456!
- Log Creating session https://${POLICY_DROOLS_IP}:6969/healthcheck
- ${session}= Create Session policy https://${POLICY_DROOLS_IP}:6969 auth=${auth}
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- ${resp}= Get Request policy /healthcheck headers=${headers}
- Log Received response from policy ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Be Equal As Strings ${resp.json()['healthy']} True
-
-Frankfurt
- [Documentation] Checks frankfurt controller is up
- ${auth}= Create List demo@people.osaaf.org demo123456!
- Log Creating session https://${POLICY_DROOLS_IP}:9696
- ${session}= Create Session policy https://${POLICY_DROOLS_IP}:9696 auth=${auth}
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- ${resp}= Get Request policy /policy/pdp/engine/controllers/frankfurt/drools/facts headers=${headers}
- Log Received response from policy ${resp.text}
- Should Be Equal As Strings ${resp.status_code} 200
- Should Be Equal As Strings ${resp.json()['frankfurt']} 0
+ [Documentation] Runs Policy PDP-D Health check
+ ${auth}= Create List demo@people.osaaf.org demo123456!
+ Log Creating session https://${DROOLS_IP}:6969/healthcheck
+ ${session}= Create Session policy https://${DROOLS_IP}:6969 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy /healthcheck headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As Strings ${resp.json()['healthy']} True
+Controller
+ [Documentation] Checks controller is up
+ ${auth}= Create List demo@people.osaaf.org demo123456!
+ Log Creating session https://${DROOLS_IP}:9696
+ ${session}= Create Session policy https://${DROOLS_IP}:9696 auth=${auth}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Get Request policy /policy/pdp/engine/controllers/frankfurt/drools/facts headers=${headers}
+ Log Received response from policy ${resp.text}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As Strings ${resp.json()['frankfurt']} 0
+
+MakeTopics
+ [Documentation] Creates the Policy topics
+ ${result}= Run Process ${SCR2}/make_topic.sh POLICY-PDP-PAP
+ Should Be Equal As Integers ${result.rc} 0
+ ${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
+ Should Be Equal As Integers ${result.rc} 0
+ ${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.modifyconfig
+
+VcpeExecute
+ [Documentation] Executes VCPE Policy
+ ${result}= Run Process ${SCR2}/onset.sh ${SCR2}/vcpeOnset.json
+ Should Be Equal As Integers ${result.rc} 0
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} ACTIVE
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Sending guard query for APPC Restart
+ Should Be Equal As Integers ${result.rc} 0
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Guard result for APPC Restart is Permit
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} actor=APPC,operation=Restart
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION: SUCCESS
+ Should Contain ${result.stdout} actor=APPC,operation=Restart
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} FINAL: SUCCESS
+ Should Contain ${result.stdout} APPC
+ Should Contain ${result.stdout} Restart
+
+VdnsExecute
+ [Documentation] Executes VDNS Policy
+ ${result}= Run Process ${SCR2}/onset.sh ${SCR2}/vdnsOnset.json
+ Should Be Equal As Integers ${result.rc} 0
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} ACTIVE
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Sending guard query for SO VF Module Create
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Guard result for SO VF Module Create is Permit
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} actor=SO,operation=VF Module Create
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION: SUCCESS
+ Should Contain ${result.stdout} actor=SO,operation=VF Module Create
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} FINAL: SUCCESS
+ Should Contain ${result.stdout} SO
+ Should Contain ${result.stdout} VF Module Create
+
+VfwExecute
+ [Documentation] Executes VFW Policy
+ ${result}= Run Process ${SCR2}/onset.sh ${SCR2}/vfwOnset.json
+ Should Be Equal As Integers ${result.rc} 0
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} ACTIVE
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Sending guard query for APPC ModifyConfig
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} Guard result for APPC ModifyConfig is Permit
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION
+ Should Contain ${result.stdout} actor=APPC,operation=ModifyConfig
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} OPERATION: SUCCESS
+ Should Contain ${result.stdout} actor=APPC,operation=ModifyConfig
+ ${result}= Run Process ${SCR2}/wait_topic.sh POLICY-CL-MGT
+ ... ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a
+ Log Received notification ${result.stdout}
+ Should Be Equal As Integers ${result.rc} 0
+ Should Contain ${result.stdout} FINAL: SUCCESS
+ Should Contain ${result.stdout} APPC
+ Should Contain ${result.stdout} ModifyConfig