3 # Copyright © 2017-2018 Amdocs, Bell Canada, AT&T
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
18 "${POLICY_HOME}"/bin/features enable healthcheck
19 "${POLICY_HOME}"/bin/features enable distributed-locking
21 "${POLICY_HOME}"/bin/db-migrator -s pooling -o upgrade
23 # make sure the PDPD-CONFIGURATION anonymous topic is created
24 # so not to lose any configuration updates
27 echo "testing publish to PDPD-CONFIGURATION topic"
30 curl --silent --connect-timeout 15 -X POST --header "Content-Type: application/json" -d "{}" http://message-router:3904/events/PDPD-CONFIGURATION
33 echo "testing subscribe to PDPD-CONFIGURATION topic "
36 curl --silent --connect-timeout 15 -X GET http://message-router:3904/events/PDPD-CONFIGURATION/1/1?timeout=5000
38 # for resiliency/scalability scenarios, check to see
39 # if there's an amsterdam artifact already deployed
40 # by brmsgw. If so, update the amsterdam controller
41 # coordinates. In the future, a more sophisticated
42 # solution will be put in place, that will required
43 # coordination among policy components.
46 echo "checking if there are amsterdam policies already deployed .."
49 AMSTERDAM_VERSION=$(curl --silent --connect-timeout 20 -X GET "http://nexus:8081/nexus/service/local/artifact/maven/resolve?r=releases&g=org.onap.policy-engine.drools.amsterdam&a=policy-amsterdam-rules&v=RELEASE" | grep -Po "(?<=<version>).*(?=</version>)")
51 if [[ -z ${AMSTERDAM_VERSION} ]]; then
52 echo "no amsterdam policies have been found .."
57 echo "The latest deployed amsterdam artifact in nexus has version ${AMSTERDAM_VERSION}"
60 sed -i.INSTALL -e "s/^rules.artifactId=.*/rules.artifactId=policy-amsterdam-rules/g" \
61 -e "s/^rules.groupId=.*/rules.groupId=org.onap.policy-engine.drools.amsterdam/g" \
62 -e "s/^rules.version=.*/rules.version=${AMSTERDAM_VERSION}/g" "${POLICY_HOME}"/config/amsterdam-controller.properties
65 echo "amsterdam controller will be started brained with maven coordinates:"
68 grep "^rules" "${POLICY_HOME}"/config/amsterdam-controller.properties