aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-01-20 03:04:40 +0000
committerGerrit Code Review <gerrit@onap.org>2018-01-20 03:04:40 +0000
commit8fa101a3dd2edf8e432b9447a886cfb583100fb0 (patch)
tree914ca872a6337fcbaff07ca1d2d437ffda0aa012 /bootstrap/vagrant-onap
parent16038805de5da569592d3c951b3ca64973b0108a (diff)
parentfdf88f32579d606cd82deadd3c89fac77b6aa472 (diff)
Merge "Add kolla internal vip to no_proxy"
Diffstat (limited to 'bootstrap/vagrant-onap')
-rwxr-xr-xbootstrap/vagrant-onap/lib/functions14
-rwxr-xr-xbootstrap/vagrant-onap/lib/openstack4
-rwxr-xr-xbootstrap/vagrant-onap/tests/asserts10
-rwxr-xr-xbootstrap/vagrant-onap/tests/test_functions10
4 files changed, 37 insertions, 1 deletions
diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions
index c2c6d76a5..47966f1b2 100755
--- a/bootstrap/vagrant-onap/lib/functions
+++ b/bootstrap/vagrant-onap/lib/functions
@@ -382,3 +382,17 @@ EOF
mount ${dev_name}1 $mount_dir
echo "${dev_name}1 $mount_dir ext4 errors=remount-ro,noatime,barrier=0 0 1" >> /etc/fstab
}
+
+# add no_proxy values to environment, used for internal IPs generated at deploy time
+function add_no_proxy_value {
+ if [[ `grep "no_proxy" /etc/environment` ]]; then
+ sed -i.bak "s/^no_proxy.*$/&,$1/" /etc/environment
+ else
+ echo "no_proxy=$1" >> /etc/environment
+ fi
+ if [[ `grep "NO_PROXY" /etc/environment` ]]; then
+ sed -i.bak "s/^NO_PROXY.*$/&,$1/" /etc/environment
+ else
+ echo "NO_PROXY=$1" >> /etc/environment
+ fi
+}
diff --git a/bootstrap/vagrant-onap/lib/openstack b/bootstrap/vagrant-onap/lib/openstack
index 205d7ae80..5e5189086 100755
--- a/bootstrap/vagrant-onap/lib/openstack
+++ b/bootstrap/vagrant-onap/lib/openstack
@@ -32,6 +32,10 @@ function configure_deploy {
ip_address=$(ip route get $network_id | awk '{ print $6; exit }')
internal_vip_address=$(get_next_ip $ip_address)
+ if [[ `env | grep -i "proxy"` ]]; then
+ add_no_proxy_value $internal_vip_address
+ fi
+
mkdir -p $kolla_config
cp /var/onap/files/globals.yml $kolla_globals
cp /var/onap/files/passwords.yml $kolla_passwords
diff --git a/bootstrap/vagrant-onap/tests/asserts b/bootstrap/vagrant-onap/tests/asserts
index 8eda3ce25..441b9f091 100755
--- a/bootstrap/vagrant-onap/tests/asserts
+++ b/bootstrap/vagrant-onap/tests/asserts
@@ -77,6 +77,16 @@ function asserts_file_exist {
fi
}
+# asserts_env_set() - Function that verities that an environment variable is set
+function asserts_env_set {
+ local variable=$1
+ local error_msg=${2:-"$variable wasn't set"}
+
+ if [ -z ${variable+x} ]; then
+ raise_error $error_msg
+ fi
+}
+
# raise_error() - Function that prints and exits the execution
function raise_error {
echo $@
diff --git a/bootstrap/vagrant-onap/tests/test_functions b/bootstrap/vagrant-onap/tests/test_functions
index 9411b46f4..dd482151f 100755
--- a/bootstrap/vagrant-onap/tests/test_functions
+++ b/bootstrap/vagrant-onap/tests/test_functions
@@ -8,7 +8,7 @@ covered_functions=(
"configure_bind" "install_java" "install_maven" "install_nodejs" "install_python"
"install_docker" "pull_docker_image" "install_docker_compose" "configure_service"
"start_ODL" "compile_src" "build_docker_image" "docker_openecomp_login"
-"pull_openecomp_image" "pull_onap_image" "coverity_repos"
+"pull_openecomp_image" "pull_onap_image" "coverity_repos" "add_no_proxy_value"
)
# test_create_configuration_files() - Verify the creation of a configuration files
@@ -176,6 +176,14 @@ function test_coverity_repos {
popd
}
+# test_add_no_proxy_value - Verify that the no_proxy value is correctly set
+function test_add_no_proxy_value {
+ local ip="172.16.0.3"
+ add_no_proxy_value $ip
+
+ asserts_env_set no_proxy
+}
+
if [ "$1" != '*' ]; then
unset covered_functions
covered_functions=$1