pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 1 | #!/bin/bash |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 2 | # |
| 3 | # ===========LICENSE_START==================================================== |
a.sreekumar | 2070574 | 2020-02-14 12:03:33 +0000 | [diff] [blame] | 4 | # Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 5 | # ============================================================================ |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 17 | # ============LICENSE_END===================================================== |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 18 | # |
a.sreekumar | 2070574 | 2020-02-14 12:03:33 +0000 | [diff] [blame] | 19 | |
| 20 | # OS upgrades |
| 21 | |
Bilal A | d46ab2e | 2019-06-07 21:25:59 +0000 | [diff] [blame] | 22 | source ${SCRIPTS}/policy/config/policy-csit.conf |
| 23 | export POLICY_MARIADB_VER |
| 24 | echo ${GERRIT_BRANCH} |
| 25 | echo ${POLICY_MARIADB_VER} |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 26 | |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 27 | SCR2=${WORKSPACE}/scripts/policy/drools-apps |
| 28 | |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 29 | echo "Uninstall docker-py and reinstall docker." |
| 30 | pip uninstall -y docker-py |
| 31 | pip uninstall -y docker |
| 32 | pip install -U docker==2.7.0 |
| 33 | |
Bilal A | d46ab2e | 2019-06-07 21:25:59 +0000 | [diff] [blame] | 34 | sudo apt-get -y install libxml2-utils |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 35 | ${SCRIPTS}/policy/policy-models-simulators.sh |
| 36 | |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame^] | 37 | 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()' -)" |
| 38 | export POLICY_API_VERSION="${POLICY_API_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" |
| 39 | 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()' -)" |
| 40 | export POLICY_PAP_VERSION="${POLICY_PAP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 41 | 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()' -)" |
| 42 | export POLICY_XACML_PDP_VERSION="${POLICY_XACML_PDP_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" |
Bilal A | 71e5737 | 2019-12-17 02:17:57 +0000 | [diff] [blame] | 43 | 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()' -)" |
| 44 | echo ${POLICY_DROOLS_APPS_VERSION_EXTRACT} |
| 45 | export POLICY_DROOLS_APPS_VERSION="${POLICY_DROOLS_APPS_VERSION_EXTRACT:0:3}-SNAPSHOT-latest" |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 46 | |
| 47 | echo ${POLICY_XACML_PDP_VERSION} |
Bilal A | 71e5737 | 2019-12-17 02:17:57 +0000 | [diff] [blame] | 48 | echo ${POLICY_DROOLS_APPS_VERSION} |
Bilal A | d46ab2e | 2019-06-07 21:25:59 +0000 | [diff] [blame] | 49 | |
a.sreekumar | 2070574 | 2020-02-14 12:03:33 +0000 | [diff] [blame] | 50 | echo "user information: $(id)" |
| 51 | echo "docker and docker-compose versions:" |
| 52 | docker -v && docker-compose -v |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 53 | |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 54 | # Adding this waiting container due to race condition between drools and mariadb |
| 55 | docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_dependencies |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 56 | |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame^] | 57 | # Adding this waiting container due to race condition between pap and xacml |
| 58 | docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_pap |
| 59 | |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 60 | # now bring everything else up |
| 61 | docker-compose -f ${SCR2}/docker-compose-drools-apps.yml run --rm start_all |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 62 | |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 63 | unset http_proxy https_proxy |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 64 | |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 65 | DROOLS_IP=`get-instance-ip.sh drools` |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame^] | 66 | API_IP=`get-instance-ip.sh policy-api` |
| 67 | PAP_IP=`get-instance-ip.sh policy-pap` |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 68 | XACML_IP=`get-instance-ip.sh policy-xacml-pdp` |
| 69 | SIM_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org` |
| 70 | export SIM_IP |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 71 | |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 72 | echo DROOLS IP IS ${DROOLS_IP} |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame^] | 73 | echo API IP IS ${API_IP} |
| 74 | echo PAP IP IS ${PAP_IP} |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 75 | echo XACML IP IS ${XACML_IP} |
| 76 | echo SIMULATORS IP IS ${SIM_IP} |
pdragosh | 3f9a096 | 2019-04-16 13:19:45 -0400 | [diff] [blame] | 77 | |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 78 | # give enough time for the controllers to come up |
| 79 | sleep 15 |
a.sreekumar | 2070574 | 2020-02-14 12:03:33 +0000 | [diff] [blame] | 80 | |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame^] | 81 | DATA=${WORKSPACE}/simulators/models/models-examples/src/main/resources/policies |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 82 | |
| 83 | ROBOT_VARIABLES="" |
| 84 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR2:${SCR2}" |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame^] | 85 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}" |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 86 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DROOLS_IP:${DROOLS_IP}" |
Jim Hahn | f340ddb | 2020-04-15 08:43:54 -0400 | [diff] [blame^] | 87 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v API_IP:${API_IP}" |
| 88 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v PAP_IP:${PAP_IP}" |
Jim Hahn | 426ddc1 | 2020-04-14 15:19:53 -0400 | [diff] [blame] | 89 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v XACML_IP:${XACML_IP}" |
| 90 | ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SIM_IP:${SIM_IP}" |