Make stand-alone Policy environment
[integration/csit.git] / plans / policy / drools-applications / setup.sh
1 #!/bin/bash
2 #
3 # ===========LICENSE_START====================================================
4 #  Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
5 # ============================================================================
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.
17 # ============LICENSE_END=====================================================
18 #
19
20 # OS upgrades
21
22 source ${SCRIPTS}/policy/config/policy-csit.conf
23
24 SCR2=${WORKSPACE}/scripts/policy/drools-apps
25
26 echo "Uninstall docker-py and reinstall docker."
27 pip uninstall -y docker-py
28 pip uninstall -y docker
29 pip install -U docker==2.7.0
30
31 sudo apt-get -y install libxml2-utils
32 bash ${SCRIPTS}/policy/get-models-examples.sh
33
34 source ${SCRIPTS}/policy/detmVers.sh
35
36 docker-compose -f ${SCRIPTS}/policy/docker-compose-all.yml up -d drools-apps
37
38 unset http_proxy https_proxy
39
40 DROOLS_IP=`get-instance-ip.sh drools-apps`
41 API_IP=`get-instance-ip.sh policy-api`
42 PAP_IP=`get-instance-ip.sh policy-pap`
43 XACML_IP=`get-instance-ip.sh policy-xacml-pdp`
44 SIM_IP=`get-instance-ip.sh policy.api.simpledemo.onap.org`
45 export SIM_IP
46
47 echo DROOLS IP IS ${DROOLS_IP}
48 echo API IP IS ${API_IP}
49 echo PAP IP IS ${PAP_IP}
50 echo XACML IP IS ${XACML_IP}
51 echo SIMULATORS IP IS ${SIM_IP}
52
53 # wait for the app to start up
54 ${SCRIPTS}/policy/wait_for_port.sh ${DROOLS_IP} 6969
55
56 # give enough time for the controllers to come up
57 sleep 15
58
59 DATA=${WORKSPACE}/models/models-examples/src/main/resources/policies
60
61 ROBOT_VARIABLES=""
62 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SCR2:${SCR2}"
63 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DATA:${DATA}"
64 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DROOLS_IP:${DROOLS_IP}"
65 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v API_IP:${API_IP}"
66 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v PAP_IP:${PAP_IP}"
67 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v XACML_IP:${XACML_IP}"
68 ROBOT_VARIABLES="${ROBOT_VARIABLES} -v SIM_IP:${SIM_IP}"