aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLusheng Ji <lji@research.att.com>2017-10-15 20:16:44 -0400
committerLusheng Ji <lji@research.att.com>2017-10-16 02:41:49 +0000
commitf79590758d6cce11b10d9257af798c8f8bc10f1e (patch)
tree708127efce9e1da738d8d3d0d867be85bedcabb9
parent2c932329f5477040bc2c37b83d4e7d9f7e080137 (diff)
Update dcae2 vm_init and intsall scripts
Issue-Id: DCAEGEN2-127 Change-Id: I4e8221972144495d9f121e4f5cfc775d141b15cb Signed-off-by: Lusheng Ji <lji@research.att.com>
-rw-r--r--boot/dcae2_install.sh61
-rw-r--r--boot/dcae2_serv.sh5
-rw-r--r--boot/dcae2_vm_init.sh3
-rw-r--r--heat/ONAP/onap_openstack.yaml18
4 files changed, 45 insertions, 42 deletions
diff --git a/boot/dcae2_install.sh b/boot/dcae2_install.sh
index f6041728..5868607b 100644
--- a/boot/dcae2_install.sh
+++ b/boot/dcae2_install.sh
@@ -92,44 +92,29 @@ service docker restart
echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head
resolvconf -u
-# Build a configuration file for the DCAE Controller.
-chmod 777 /opt/config/priv_key
-mkdir /opt/app
-
-UBUNTU_1604_IMAGE=$(cat /opt/config/ubuntu_1604_image.txt)
-CENTOS_7_IMAGE=$(cat /opt/config/centos_7_image.txt)
-FLAVOR_MEDIUM=$(cat /opt/config/flavor_medium.txt)
-SECURITY_GROUP=$(cat /opt/config/security_group.txt)
-PUBLIC_NET_ID=$(cat /opt/config/public_net_id.txt)
-OPENSTACK_PRIVATE_NETWORK=$(cat /opt/config/openstack_private_network_name.txt)
-OPENSTACK_USER=$(cat /opt/config/openstack_user.txt)
-OPENSTACK_PASSWORD=$(cat /opt/config/openstack_password.txt)
-OPENSTACK_TENANT_ID=$(cat /opt/config/tenant_id.txt)
-KEYSTONE_URL=$(cat /opt/config/keystone_url.txt)"/v2.0"
-OPENSTACK_REGION=$(cat /opt/config/openstack_region.txt)
-OPENSTACK_KEYNAME=$(cat /opt/config/key_name.txt)"_"$(cat /opt/config/rand_str.txt)
-ZONE=$(cat /opt/config/dcae_zone.txt)
-
-cat > /opt/app/inputs.yaml << EOF_CONFIG
-centos7image_id: '$CENTOS_7_IMAGE'
-ubuntu1604image_id: '$UBUNTU_1604_IMAGE'
-flavor_id: '$FLAVOR_MEDIUM'
-security_group: '$SECURITY_GROUP'
-public_net: '$PUBLIC_NET_ID'
-private_net: '$OPENSTACK_PRIVATE_NETWORK'
-openstack:
- username: '$OPENSTACK_USER'
- password: '$OPENSTACK_PASSWORD'
- tenant_name: '$OPENSTACK_TENANT_ID'
- auth_url: '$KEYSTONE_URL'
- region: '$OPENSTACK_REGION'
-keypair: '$OPENSTACK_KEYNAME'
-key_filename: '/opt/dcae/key'
-location_prefix: '$ZONE'
-location_domain: 'dcae.onapdevlab.onap.org'
-codesource_url: 'https://nexus.onap.org/service/local/repositories/raw/content'
-codesource_version: 'org.onap.dcaegen2.deployments/releases/scripts'
-EOF_CONFIG
+# prepare the configurations needed by DCAEGEN2 installer
+rm -rf /opt/app/config
+mkdir -p /opt/app/config
+
+# private key
+cp /opt/config/priv_key /opt/app/config/key
+chmod 777 /opt/app/config/key
+
+
+# download blueprint input template files
+rm -rf /opt/app/inputs-templates
+mkdir -p /opt/app/inputs-templates
+#wget --no-parent -nH -r -l2 -P /opt/app/inputs-templates https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.blueprints/releases/input-templates/
+wget -P /opt/app/inputs-templates https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.blueprints/releases/input-templates/inputs.yaml
+wget -P /opt/app/inputs-templates https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.blueprints/releases/input-templates/phinputs.yaml
+wget -P /opt/app/inputs-templates https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.blueprints/releases/input-templates/dhinputs.yaml
+wget -P /opt/app/inputs-templates https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.blueprints/releases/input-templates/invinputs.yaml
+
+
+# generate blueprint input files
+pip install jinja2
+wget https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.deployments/releases/scripts/detemplate-bpinputs.py && (python detemplate-bpinputs.py /opt/config /opt/app/inputs-templates /opt/app/config; rm detemplate-bpinputs.py)
+
# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
if [[ $CLOUD_ENV != "rackspace" ]]
diff --git a/boot/dcae2_serv.sh b/boot/dcae2_serv.sh
index bfd2ad18..b81c57a4 100644
--- a/boot/dcae2_serv.sh
+++ b/boot/dcae2_serv.sh
@@ -41,7 +41,8 @@ get_pid() {
}
is_running() {
- [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+ #[ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+ [ ! -z $(docker ps | grep 'org.onap.dcaegen2.deployments.bootstrap') ]
}
case "$1" in
@@ -67,6 +68,8 @@ case "$1" in
if is_running; then
echo -n "Stopping $name.."
kill `get_pid`
+ CID=$(docker ps | grep 'org.onap.dcaegen2.deployments.bootstrap' | awk '{ print $1 }')
+ docker exec -it $CID ./teardown.sh
for i in {1..10}
do
if ! is_running; then
diff --git a/boot/dcae2_vm_init.sh b/boot/dcae2_vm_init.sh
index b9da6844..e27ba589 100644
--- a/boot/dcae2_vm_init.sh
+++ b/boot/dcae2_vm_init.sh
@@ -8,4 +8,5 @@ ZONE=$(cat /opt/config/dcae_zone.txt)
docker login -u $NEXUS_USER -p $NEXUS_PASSWORD $NEXUS_DOCKER_REPO
docker pull $NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION
-docker run -v /opt/config/priv_key:/opt/app/installer/config/key -v /opt/app/inputs.yaml:/opt/app/installer/config/inputs.yaml -e "LOCATION=$ZONE" $NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION \ No newline at end of file
+#docker run -v /opt/config/priv_key:/opt/app/installer/config/key -v /opt/app/inputs.yaml:/opt/app/installer/config/inputs.yaml -e "LOCATION=$ZONE" $NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION
+docker run -d --name boot -v /opt/app/config:/opt/app/installer/config -e "LOCATION=$ZONE" $NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION
diff --git a/heat/ONAP/onap_openstack.yaml b/heat/ONAP/onap_openstack.yaml
index e8e44a0c..242d0dd2 100644
--- a/heat/ONAP/onap_openstack.yaml
+++ b/heat/ONAP/onap_openstack.yaml
@@ -1710,6 +1710,12 @@ resources:
__flavor_medium__: { get_param: flavor_medium }
__mac_addr__: { get_attr: [dcae_c_private_port, mac_address] }
__rand_str__: { get_resource: random-str }
+ __mr_ip_addr__: { get_param: mr_ip_addr }
+ #__mr_float_ip__: { get_attr: [mr_floating_ip, floating_ip_address] }
+ __policy_ip_addr__: { get_param: policy_ip_addr }
+ #__policy_float_ip__: { get_attr: [policy_floating_ip, floating_ip_address] }
+ __sdc_ip_addr__: { get_param: sdc_ip_addr }
+ #__sdc_float_ip__: { get_attr: [sdc_floating_ip, floating_ip_address] }
template: |
#!/bin/bash
@@ -1726,6 +1732,7 @@ resources:
echo "__gerrit_branch__" > /opt/config/gerrit_branch.txt
echo "__dcae_zone__" > /opt/config/dcae_zone.txt
echo "__tenant_id__" > /opt/config/tenant_id.txt
+ echo "__tenant_id__" > /opt/config/tenant_name.txt
echo "__openstack_private_network_name__" > /opt/config/openstack_private_network_name.txt
echo "__openstack_user__" > /opt/config/openstack_user.txt
echo "__openstack_password__" > /opt/config/openstack_password.txt
@@ -1742,13 +1749,20 @@ resources:
echo "__ubuntu_1604_image__" > /opt/config/ubuntu_1604_image.txt
echo "__centos_7_image__" > /opt/config/centos_7_image.txt
echo "__security_group__" > /opt/config/security_group.txt
- echo "__flavor_medium__" > /opt/config/flavor_medium.txt
+ echo "__flavor_medium__" > /opt/config/flavor_id.txt
echo "__dcae_repo__" > /opt/config/remote_repo.txt
echo "__mac_addr__" > /opt/config/mac_addr.txt
echo "__rand_str__" > /opt/config/rand_str.txt
+ echo "__mr_ip_addr__" > /opt/config/mr_ip_addr.txt
+ echo "__policy_ip_addr__" > /opt/config/policy_ip_addr.txt
+ echo "__sdc_ip_addr__" > /opt/config/sdc_ip_addr.txt
+ #echo "__mr_floating_ip_addr__" > /opt/config/mr_floating_ip_addr.txt
+ #echo "__policy_floating_ip_addr__" > /opt/config/policy_floating_ip_addr.txt
+ #echo "__sdc_floating_ip_addr__" > /opt/config/sdc_floating_ip_addr.txt
+
# Download and run install script
curl -k __nexus_repo__/org.onap.demo/boot/__artifacts_version__/dcae2_install.sh -o /opt/dcae2_install.sh
cd /opt
chmod +x dcae2_install.sh
- ./dcae2_install.sh \ No newline at end of file
+ ./dcae2_install.sh