ad982ad95138c65305e892a09b080522f5a88519
[integration.git] / bootstrap / vagrant-onap / lib / policy
1 #!/bin/bash
2
3 source /var/onap/functions
4
5 # _build_policy_images() - Function that build Policy docker images from source code
6 function _build_policy_images {
7     compile_src $policy_src_folder/docker
8     pushd $policy_src_folder/docker
9     install_maven
10     mvn prepare-package
11     cp -r target/policy-pe/* policy-pe/
12     cp -r target/policy-drools/* policy-drools
13     install_docker
14     bash docker_verify.sh
15     popd
16 }
17
18 # get_policy_images() - Function that retrieves Policy docker images
19 function get_policy_images {
20     if [[ "$build_image" == "True" ]]; then
21         _build_policy_images
22     else
23         pull_onap_image policy/policy-db onap/policy/policy-db:latest
24         pull_onap_image policy/policy-pe onap/policy/policy-pe:latest
25         pull_onap_image policy/policy-drools onap/policy/policy-drools:latest
26         pull_onap_image policy/policy-nexus onap/policy/policy-nexus:latest
27     fi
28 }
29
30 # install_policy() - Function that clones and installs the Policy services from source code
31 function install_policy {
32     pushd $policy_src_folder/docker
33     chmod +x config/drools/drools-tweaks.sh
34     echo $IP_ADDRESS > config/pe/ip_addr.txt
35     install_docker_compose
36     /opt/docker/docker-compose up -d
37     popd
38 }
39
40 # init_policy() - Function that initialize Policy services
41 function init_policy {
42     if [[ "$clone_repo" == "True" ]]; then
43         clone_repos "policy"
44         if [[ "$compile_repo" == "True" ]]; then
45             compile_repos "policy"
46         fi
47     fi
48
49     if [[ "$skip_get_images" == "False" ]]; then
50         get_policy_images
51         if [[ "$skip_install" == "False" ]]; then
52             install_policy
53         fi
54     fi
55 }