diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2018-08-03 07:56:14 -0700 |
---|---|---|
committer | Gary Wu <gary.i.wu@huawei.com> | 2018-08-06 08:20:47 -0700 |
commit | b9a2a29a9e1e93cd04bfa46f9ed66a2117ef56e5 (patch) | |
tree | bcf2b80a434326360f3ce1ec0d64110d5b09e1e8 /heat | |
parent | 16509432a21feb3f90bbf954ec4815c2bf7f0033 (diff) |
Refactor ONAP HEAT template config, part 2
Change-Id: Ic4930654395ec9e9d57836733cd47e7a3b0bf972
Issue-ID: INT-605
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'heat')
41 files changed, 1545 insertions, 1101 deletions
diff --git a/heat/ONAP/cloud-config/aaf_install.sh b/heat/ONAP/cloud-config/aaf_install.sh index 171592ce..a164c042 100644 --- a/heat/ONAP/cloud-config/aaf_install.sh +++ b/heat/ONAP/cloud-config/aaf_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -17,67 +13,15 @@ then fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - # Download dependencies echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list apt-get update -apt-get install --allow-unauthenticated -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate make maven +apt-get install --allow-unauthenticated -y openjdk-8-jdk maven # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip aaf_vm_init.sh > /opt/aaf_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/aaf_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/aaf_vm_init.sh -chmod +x /opt/aaf_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./aaf_vm_init.sh\"|g" /opt/aaf_serv.sh -mv /opt/aaf_serv.sh /etc/init.d update-rc.d aaf_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/aaf_vm_init.sh b/heat/ONAP/cloud-config/aaf_vm_init.sh new file mode 100644 index 00000000..a388bf2f --- /dev/null +++ b/heat/ONAP/cloud-config/aaf_vm_init.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) +HOSTNAME=`hostname` +FQDN=aaf.api.simpledemo.onap.org +HOST_IP=$(cat /opt/config/local_ip.txt) + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +cd /opt/authz +git pull + + +cd /opt/authz/auth/auth-cass/docker +if [ "`docker container ls | grep aaf_cass`" = "" ]; then + # Cassandra Install + echo Phase 1 Cassandra Install + ./dinstall.sh +fi + +CASS_IP=`docker inspect aaf_cass | grep '"IPAddress' | head -1 | cut -d '"' -f 4` +CASS_HOST="cass.aaf.osaaf.org:"$CASS_IP + +sed -i "s/DOCKER_REPOSITORY=.*/DOCKER_REPOSITORY="$NEXUS_DOCKER_REPO"/g" /opt/authz/auth/docker/d.props +#sed -i "s/VERSION=.*/VERSION="$DOCKER_IMAGE_VERSION"/g" /opt/authz/auth/docker/d.props +sed -i "s/HOSTNAME=.*/HOSTNAME="$HOSTNAME"/g" /opt/authz/auth/docker/d.props +sed -i "s/HOST_IP=.*/HOST_IP="$HOST_IP"/g" /opt/authz/auth/docker/d.props +sed -i "s/CASS_HOST=.*/CASS_HOST="$CASS_HOST"/g" /opt/authz/auth/docker/d.props + +if [ ! -e "/opt/app/osaaf/etc" ]; then + # Nothing installed, install sample + mkdir -p /opt/app/osaaf/logs + cd /opt/app/osaaf/logs + mkdir fs cm gui hello locate oauth service + cd /opt + cp -Rf /opt/authz/auth/sample/* /opt/app/osaaf +fi +# Set Location information +# Need new Deployment system properties +CADI_LATITUDE=37.781 +CADI_LONGITUDE=-122.261 + +CADI_TRUST_MASKS="${HOST_IP%\.[0-9]*}\\/24,${CASS_IP%\.[0-9]*}\\/24" +sed -i "s/cadi_latitude=.*/cadi_latitude="$CADI_LATITUDE"/g" /opt/app/osaaf/local/org.osaaf.location.props +sed -i "s/cadi_longitude=.*/cadi_longitude="$CADI_LONGITUDE"/g" /opt/app/osaaf/local/org.osaaf.location.props +sed -i "s/cadi_registration_hostname=.*/cadi_registration_hostname="$FQDN"/g" /opt/app/osaaf/local/org.osaaf.location.props +sed -i "s/cadi_trust_masks=.*/cadi_trust_masks="$CADI_TRUST_MASKS"/g" /opt/app/osaaf/local/org.osaaf.location.props + +cd /opt/authz/auth/docker +./dbuild.sh +sleep 5 +./drun.sh diff --git a/heat/ONAP/cloud-config/aai_install.sh b/heat/ONAP/cloud-config/aai_install.sh index b238fd6e..feaf7f3c 100644 --- a/heat/ONAP/cloud-config/aai_install.sh +++ b/heat/ONAP/cloud-config/aai_install.sh @@ -1,12 +1,8 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) AAI_INSTANCE=$(cat /opt/config/aai_instance.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -17,65 +13,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip aai_vm_init.sh > /opt/aai_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/aai_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/aai_vm_init.sh -chmod +x /opt/aai_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./aai_vm_init.sh\"|g" /opt/aai_serv.sh -mv /opt/aai_serv.sh /etc/init.d update-rc.d aai_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/aai_vm_init.sh b/heat/ONAP/cloud-config/aai_vm_init.sh new file mode 100644 index 00000000..ffe0955f --- /dev/null +++ b/heat/ONAP/cloud-config/aai_vm_init.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +AAI_INSTANCE=$(cat /opt/config/aai_instance.txt) + +cd /opt/test-config +git pull + +if [[ $AAI_INSTANCE == "aai_instance_1" ]] +then + ./deploy_vm1.sh +elif [[ $AAI_INSTANCE == "aai_instance_2" ]] +then + ./deploy_vm2.sh +else + echo "Invalid instance. Exiting..." +fi diff --git a/heat/ONAP/cloud-config/appc_install.sh b/heat/ONAP/cloud-config/appc_install.sh index e871bfc1..e9731f71 100644 --- a/heat/ONAP/cloud-config/appc_install.sh +++ b/heat/ONAP/cloud-config/appc_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,65 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip appc_vm_init.sh > /opt/appc_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/appc_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/appc_vm_init.sh -chmod +x /opt/appc_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./appc_vm_init.sh\"|g" /opt/appc_serv.sh -mv /opt/appc_serv.sh /etc/init.d update-rc.d appc_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/appc_vm_init.sh b/heat/ONAP/cloud-config/appc_vm_init.sh new file mode 100644 index 00000000..647e9597 --- /dev/null +++ b/heat/ONAP/cloud-config/appc_vm_init.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +export NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DMAAP_TOPIC=$(cat /opt/config/dmaap_topic.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) +DGBUILDER_IMAGE_VERSION=$(cat /opt/config/dgbuilder_version.txt) +export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) + +cd /opt/appc +git pull +cd /opt/appc/docker-compose + +sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="$DMAAP_TOPIC"/g" docker-compose.yml + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +docker pull $NEXUS_DOCKER_REPO/onap/appc-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/appc-image:$DOCKER_IMAGE_VERSION onap/appc-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$DGBUILDER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$DGBUILDER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/appc-cdt-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/appc-cdt-image:$DOCKER_IMAGE_VERSION onap/appc-cdt-image:latest + +/opt/docker/docker-compose up -d diff --git a/heat/ONAP/cloud-config/clamp_install.sh b/heat/ONAP/cloud-config/clamp_install.sh index ffe4d14e..1a45119c 100644 --- a/heat/ONAP/cloud-config/clamp_install.sh +++ b/heat/ONAP/cloud-config/clamp_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,65 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip clamp_vm_init.sh > /opt/clamp_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/clamp_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/clamp_vm_init.sh -chmod +x /opt/clamp_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./clamp_vm_init.sh\"|g" /opt/clamp_serv.sh -mv /opt/clamp_serv.sh /etc/init.d update-rc.d clamp_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/clamp_vm_init.sh b/heat/ONAP/cloud-config/clamp_vm_init.sh new file mode 100644 index 00000000..f8b26e30 --- /dev/null +++ b/heat/ONAP/cloud-config/clamp_vm_init.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) + +# Fetch the latest code/scripts +cd /opt/clamp +git pull + +# Remove unused folders as only extra/ folder is used for docker compose +rm -rf pom.xml +rm -rf src/ + +# No configuration change here as directly done in the CLAMP repo + +# Pull the clamp docker image from nexus +# Maria db will be pulled automatically from docker.io during docker-compose +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +docker pull $NEXUS_DOCKER_REPO/onap/clamp:$DOCKER_IMAGE_VERSION + +cd extra/docker/clamp/ + +# Change the Clamp docker image name in the docker-compose.yml to match the one downloaded +sed -i "/image: onap\/clamp/c\ image: $NEXUS_DOCKER_REPO\/onap\/clamp:$DOCKER_IMAGE_VERSION" docker-compose.yml + +# Start Clamp and MariaDB containers with docker compose and clamp/extra/docker/clamp/docker-compose.yml +/opt/docker/docker-compose up -d diff --git a/heat/ONAP/cloud-config/dbcl_vm_init.sh b/heat/ONAP/cloud-config/dbcl_vm_init.sh new file mode 100644 index 00000000..08cc3f10 --- /dev/null +++ b/heat/ONAP/cloud-config/dbcl_vm_init.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +# Establish environment variables +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) + +# Refresh images +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/onap/dmaap/buscontroller:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/dmaap/buscontroller:$DOCKER_IMAGE_VERSION onap/dmaap/buscontroller:latest + +docker rm -f dmaap-buscontroller + +TMP_CFG=/tmp/docker-dmaap-buscontroller.conf +cat >> $TMP_CFG <<!EOF +DMAAPBC_INT_HTTPS_PORT=8443 +DMAAPBC_PG_ENABLED=false +DMAAPBC_INSTANCE_NAME=ONAP-CSIT +DMAAPBC_AAF_URL=https://aaf.api.simpledemo.onap.org:8095/proxy/ +DMAAPBC_MR_CNAME=mr.api.simpledemo.onap.org +DMAAPBC_DRPROV_FQDN=drprov.simpledemo.onap.org +DMAAPBC_KSTOREPASS="Perish the thought" +DMAAPBC_PVTKEYPASS="Perish the thought" +!EOF + +# Insert docker run instructions here +docker run -i -t -d --name dmaap-buscontroller -p 8080:8080 -p 8443:8443 -v $TMP_CFG:/opt/app/config/conf $NEXUS_DOCKER_REPO/onap/dmaap/buscontroller:$DOCKER_IMAGE_VERSION + +sleep 15 + +DBCL_FQDN=dbc.api.simpledemo.onap.org +DRPS_FQDN=drprov.simpledemo.onap.org +MR_FQDN=mr.api.simpledemo.onap.org +# INITIALIZE: dmaap object +JSON=/tmp/$$.dmaap +cat << EOF > $JSON +{ +"version": "1", +"topicNsRoot": "org.onap.dmaap", +"drProvUrl": "http://${DRPS_FQDN}:8080", +"dmaapName": "onapStable", +"bridgeAdminTopic": "MM_AGENT_PROV" + +} +EOF + +curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://${DBCL_FQDN}:8080/webapi/dmaap + + + +# INITIALIZE: dcaeLocation object +JSON=/tmp/$$.loc +cat << EOF > $JSON +{ +"dcaeLocationName": "csit-sanfrancisco", +"dcaeLayer": "central-cloud", +"clli": "STABLE2345", +"zone": "zoneA" + +} +EOF + +curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://${DBCL_FQDN}:8080/webapi/dcaeLocations + + +# INITIALIZE: MR object in 1 site +# Note: the values in the hosts[] are fictitious, and anticipate a +# future MR cluster deployment. +JSON=/tmp/$$.mrc +cat << EOF > $JSON +{ +"dcaeLocationName": "stable-sanfrancisco", +"fqdn": "${MR_FQDN}", +"hosts" : [ + "mrhost1.simpledemo.onap.org", + "mrhost2.simpledemo.onap.org", + "mrhost3.simpledemo.onap.org" + ], +"protocol" : "https", +"port": "3094" + +} +EOF + +curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://${DBCL_FQDN}:8080/webapi/mr_clusters diff --git a/heat/ONAP/cloud-config/dcae2_install.sh b/heat/ONAP/cloud-config/dcae2_install.sh index d0f5fd6e..a4fd556a 100755..100644 --- a/heat/ONAP/cloud-config/dcae2_install.sh +++ b/heat/ONAP/cloud-config/dcae2_install.sh @@ -19,9 +19,6 @@ set -ex # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) EXTERNAL_DNS=$(cat /opt/config/external_dns.txt) MAC_ADDR=$(cat /opt/config/mac_addr.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) @@ -33,65 +30,18 @@ then export https_proxy=$HTTPS_PROXY fi -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) - -if [[ $CLOUD_ENV != "rackspace" ]] -then - # Add host name to /etc/host to avoid warnings in openstack images - echo "127.0.0.1 $(hostname)" >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi # Download dependencies apt-get update -#apt-get install -y apt-transport-https ca-certificates wget make git ntp ntpdate python python-pip -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate python python-pip +apt-get install -y python python-pip # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip dcae2_vm_init.sh > /opt/dcae2_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/dcae2_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh +cp /opt/boot/dcae2_vm_init.sh /opt/dcae2_vm_init.sh chmod +x /opt/dcae2_vm_init.sh -chmod +x /opt/dcae2_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./dcae2_vm_init.sh\"|g" /opt/dcae2_serv.sh -mv /opt/dcae2_serv.sh /etc/init.d update-rc.d dcae2_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y "linux-image-extra-$(uname -r)" linux-image-extra-virtual jq -apt-get install -y --allow-unauthenticated docker-engine - -mkdir -p /opt/docker -curl -L "https://github.com/docker/compose/releases/download/1.9.0/docker-compose-$(uname -s)-$(uname -m)" > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may -# need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU --raw-logs -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service +echo "DOCKER_OPTS=\"\$DOCKER_OPTS --raw-logs -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock\"" >> /etc/default/docker sed -i "/ExecStart/s/$/ -H tcp:\/\/0.0.0.0:2376 --raw-logs/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi systemctl daemon-reload service docker restart @@ -99,10 +49,6 @@ service docker restart echo "$(cat /opt/config/dcae_ip_addr.txt) consul" >>/etc/hosts echo "$(cat /opt/config/dcae_ip_addr.txt) dockerhost" >>/etc/hosts -# DNS IP address configuration -echo "nameserver $DNS_IP_ADDR" >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u - # prepare the configurations needed by DCAEGEN2 installer rm -rf /opt/app/config mkdir -p /opt/app/config diff --git a/heat/ONAP/cloud-config/dns_install.sh b/heat/ONAP/cloud-config/dns_install.sh index 1f940ac3..b277e6dc 100644 --- a/heat/ONAP/cloud-config/dns_install.sh +++ b/heat/ONAP/cloud-config/dns_install.sh @@ -1,7 +1,6 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -15,33 +14,24 @@ fi if [[ $CLOUD_ENV != "rackspace" ]] then - # Add host name to /etc/host to avoid warnings in openstack images - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh - - # Set the Bind configuration file name based on the deployment environment - ZONE_FILE="bind_zones" - ZONE_ONAP="bind_zones_onap" - OPTIONS_FILE="bind_options" + # Set the Bind configuration file name based on the deployment environment + ZONE_FILE="bind_zones" + ZONE_ONAP="bind_zones_onap" + OPTIONS_FILE="bind_options" else - ZONE_FILE="db_simpledemo_openecomp_org" - ZONE_ONAP="db_simpledemo_onap_org" - OPTIONS_FILE="named.conf.options" + ZONE_FILE="db_simpledemo_openecomp_org" + ZONE_ONAP="db_simpledemo_onap_org" + OPTIONS_FILE="named.conf.options" fi -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget bind9 bind9utils bind9-doc ntp ntpdate make +apt-get install -y bind9 bind9utils bind9-doc # Download script mkdir /etc/bind/zones -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip $ZONE_FILE > /etc/bind/zones/db.simpledemo.openecomp.org -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip $ZONE_ONAP > /etc/bind/zones/db.simpledemo.onap.org -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip $OPTIONS_FILE > /etc/bind/named.conf.options -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip named.conf.local > /etc/bind/named.conf.local +cp /opt/boot/$ZONE_FILE /etc/bind/zones/db.simpledemo.openecomp.org +cp /opt/boot/$ZONE_ONAP /etc/bind/zones/db.simpledemo.onap.org +cp /opt/boot/$OPTIONS_FILE /etc/bind/named.conf.options +cp /opt/boot/named.conf.local /etc/bind/named.conf.local # Set the private IP address of each ONAP VM in the Bind configuration in OpenStack deployments if [[ $CLOUD_ENV != "rackspace" ]] diff --git a/heat/ONAP/cloud-config/mr_install.sh b/heat/ONAP/cloud-config/mr_install.sh index b7573589..f2906970 100644 --- a/heat/ONAP/cloud-config/mr_install.sh +++ b/heat/ONAP/cloud-config/mr_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,70 +12,13 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget make git ntp ntpdate # Download scripts from Nexus # a) scripts for message router (mr) -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip mr_vm_init.sh > /opt/mr_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/mr_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/mr_vm_init.sh -chmod +x /opt/mr_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./mr_vm_init.sh\"|g" /opt/mr_serv.sh -mv /opt/mr_serv.sh /etc/init.d update-rc.d mr_serv.sh defaults # b) scripts for bus controller (dbcl) -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip dbcl_vm_init.sh > /opt/dbcl_vm_init.sh -chmod +x /opt/dbcl_vm_init.sh - -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/mr_vm_init.sh b/heat/ONAP/cloud-config/mr_vm_init.sh new file mode 100644 index 00000000..78d61f8a --- /dev/null +++ b/heat/ONAP/cloud-config/mr_vm_init.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +cd /opt/startup-vm-message-router/demo +sed -i 's|wget .*|wget -q \"http://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz\" \\|g' deploy.sh +bash deploy.sh &>/dev/null &disown + +cd /opt +bash dbcl_vm_init.sh &>/dev/null &disown diff --git a/heat/ONAP/cloud-config/msb_vm_init.sh b/heat/ONAP/cloud-config/msb_vm_init.sh new file mode 100644 index 00000000..938a3d6d --- /dev/null +++ b/heat/ONAP/cloud-config/msb_vm_init.sh @@ -0,0 +1,196 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/msb_docker.txt) + +source /opt/config/onap_ips.txt + +# start up MSB +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/onap/msb/msb_discovery:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/onap/msb/msb_apigateway:$DOCKER_IMAGE_VERSION + +docker rm -f msb_consul +docker rm -f msb_discovery +docker rm -f msb_apigateway + +docker run -d -p 8500:8500 --name msb_consul consul:0.9.3 +CONSUL_IP=`sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' msb_consul` + +docker run -d -p 10081:10081 -e CONSUL_IP=$CONSUL_IP --name msb_discovery $NEXUS_DOCKER_REPO/onap/msb/msb_discovery:$DOCKER_IMAGE_VERSION +DISCOVERY_IP=`sudo docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' msb_discovery` + +docker run -d -p 80:80 -p 443:443 -e CONSUL_IP=$CONSUL_IP -e SDCLIENT_IP=$DISCOVERY_IP -e "ROUTE_LABELS=visualRange:0|1" --name msb_apigateway $NEXUS_DOCKER_REPO/onap/msb/msb_apigateway:$DOCKER_IMAGE_VERSION + +# Allow the MSB container to come up before registering services +sleep 20 + +# register ONAP services to MSB +#aai +#cloud-infrastructure +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-cloudInfrastructure", "version": "v11", "url": "/aai/v11/cloud-infrastructure","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-cloudInfrastructure", "version": "v12", "url": "/aai/v12/cloud-infrastructure","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-cloudInfrastructure", "version": "v13", "url": "/aai/v13/cloud-infrastructure","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-cloudInfrastructure", "version": "v11", "url": "/aai/v11/cloud-infrastructure","path": "/aai/v11/cloud-infrastructure","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-cloudInfrastructure", "version": "v12", "url": "/aai/v12/cloud-infrastructure","path": "/aai/v12/cloud-infrastructure","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-cloudInfrastructure", "version": "v13", "url": "/aai/v13/cloud-infrastructure","path": "/aai/v13/cloud-infrastructure","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#business +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-business", "version": "v11", "url": "/aai/v11/business","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-business", "version": "v12", "url": "/aai/v12/business","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-business", "version": "v13", "url": "/aai/v13/business","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-business", "version": "v11", "url": "/aai/v11/business","path": "/aai/v11/business","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-business", "version": "v12", "url": "/aai/v12/business","path": "/aai/v12/business","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-business", "version": "v13", "url": "/aai/v13/business","path": "/aai/v13/business","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#actions +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-actions", "version": "v11", "url": "/aai/v11/actions","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-actions", "version": "v12", "url": "/aai/v12/actions","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-actions", "version": "v13", "url": "/aai/v13/actions","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-actions", "version": "v11", "url": "/aai/v11/actions","path": "/aai/v11/actions","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-actions", "version": "v12", "url": "/aai/v12/actions","path": "/aai/v12/actions","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-actions", "version": "v13", "url": "/aai/v13/actions","path": "/aai/v13/actions","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#service-design-and-creation +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-service-design-and-creation", "version": "v11", "url": "/aai/v11/service-design-and-creation","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-service-design-and-creation", "version": "v12", "url": "/aai/v12/service-design-and-creation","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-service-design-and-creation", "version": "v13", "url": "/aai/v13/service-design-and-creation","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-service-design-and-creation", "version": "v11", "url": "/aai/v11/service-design-and-creation","path": "/aai/v11/service-design-and-creation","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-service-design-and-creation", "version": "v12", "url": "/aai/v12/service-design-and-creation","path": "/aai/v12/service-design-and-creation","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-service-design-and-creation", "version": "v13", "url": "/aai/v13/service-design-and-creation","path": "/aai/v13/service-design-and-creation","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#network +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-network", "version": "v11", "url": "/aai/v11/network","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-network", "version": "v12", "url": "/aai/v12/network","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-network", "version": "v13", "url": "/aai/v13/network","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-network", "version": "v11", "url": "/aai/v11/network","path": "/aai/v11/network","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-network", "version": "v12", "url": "/aai/v12/network","path": "/aai/v12/network","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-network", "version": "v13", "url": "/aai/v13/network","path": "/aai/v13/network","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#externalSystem +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-externalSystem", "version": "v11", "url": "/aai/v11/external-system","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-externalSystem", "version": "v12", "url": "/aai/v12/external-system","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-externalSystem", "version": "v13", "url": "/aai/v13/external-system","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-externalSystem", "version": "v11", "url": "/aai/v11/external-system","path": "/aai/v11/external-system","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-externalSystem", "version": "v12", "url": "/aai/v12/external-system","path": "/aai/v12/external-system","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-externalSystem", "version": "v13", "url": "/aai/v13/external-system","path": "/aai/v13/external-system","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8447"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#traversal +#generic-query +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-generic-query", "version": "v11", "url": "/aai/v11/generic-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-generic-query", "version": "v12", "url": "/aai/v12/generic-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-generic-query", "version": "v13", "url": "/aai/v13/generic-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-generic-query", "version": "v11", "url": "/aai/v11/generic-query","path": "/aai/v11/generic-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-generic-query", "version": "v12", "url": "/aai/v12/generic-query","path": "/aai/v12/generic-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-generic-query", "version": "v13", "url": "/aai/v13/generic-query","path": "/aai/v13/generic-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#nodes-query +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-nodes-query", "version": "v11", "url": "/aai/v11/nodes-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-nodes-query", "version": "v12", "url": "/aai/v12/nodes-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-nodes-query", "version": "v13", "url": "/aai/v13/nodes-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-nodes-query", "version": "v11", "url": "/aai/v11/nodes-query","path": "/aai/v11/nodes-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-nodes-query", "version": "v12", "url": "/aai/v12/nodes-query","path": "/aai/v12/nodes-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-nodes-query", "version": "v13", "url": "/aai/v13/nodes-query","path": "/aai/v13/nodes-query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#query +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-query", "version": "v11", "url": "/aai/v11/query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-query", "version": "v12", "url": "/aai/v12/query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-query", "version": "v13", "url": "/aai/v13/query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-query", "version": "v11", "url": "/aai/v11/query","path": "/aai/v11/query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-query", "version": "v12", "url": "/aai/v12/query","path": "/aai/v12/query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-query", "version": "v13", "url": "/aai/v13/query","path": "/aai/v13/query","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#named-query +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-named-query", "url": "/aai/search","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "_aai-named-query", "url": "/aai/search","path": "/aai/search","protocol": "REST", "enable_ssl":"true", "lb_policy":"ip_hash", "nodes": [ {"ip": "'$AAI_IP1'","port": "8446"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +#search +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-search", "version": "v11", "url": "/aai/v11/search","protocol": "REST", "enable_ssl":"True", "lb_policy":"round-robin","nodes": [ {"ip": "'$AAI_IP1'","port": "8443"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + + +# esr (not deployed together with AAI +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-esr-server", "version": "v1", "url": "/api/aai-esr-server/v1","protocol": "REST", "enable_ssl":"true", "visualRange":"1", "nodes": [ {"ip": "'$OPENO_IP'","port": "9518"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "aai-esr-gui", "version": "v1", "url": "/esr-gui","path": "/iui/aai-esr-gui","protocol": "UI", "nodes": [ {"ip": "'$OPENO_IP'","port": "9519"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +#so +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "so", "version": "v1", "url": "/ecomp/mso/infra","protocol": "REST", "nodes": [ {"ip": "'$SO_IP'","port": "8080"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "so-deprecated", "version": "v1", "url": "/ecomp/mso/infra","path": "/ecomp/mso/infra","protocol": "REST", "nodes": [ {"ip": "'$SO_IP'","port": "8080"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +#Dmaap message router +#curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "message-router", "version": "v1", "url": "/","protocol": "REST", "nodes": [ {"ip": "'$DMAAP_IP'","port": "3904"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +#policy +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "policy-pdp", "version": "v1", "url": "/pdp","protocol": "REST", "nodes": [ {"ip": "'$POLICY_IP'","port": "8081"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "policy-pdp-deprecated", "version": "v1", "url": "/pdp","path": "/pdp","protocol": "REST", "nodes": [ {"ip": "'$POLICY_IP'","port": "8081"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +#portal +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "portal", "version": "v2", "url": "/","protocol": "REST", "nodes": [ {"ip": "'$PORTAL_IP'","port": "8989"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +#sdc +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "sdc", "version": "v1", "url": "/sdc/v1","protocol": "REST", "nodes": [ {"ip": "'$SDC_IP'","port": "8080"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "sdc-deprecated", "version": "v1", "url": "/sdc/v1","path": "/sdc/v1","protocol": "REST", "nodes": [ {"ip": "'$SDC_IP'","port": "8080"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +#sdnc +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "sdnc", "version": "v1", "url": "/","protocol": "REST", "nodes": [ {"ip": "'$SDNC_IP'","port": "8282"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "sdnc-compatible", "version": "v1", "url": "/restconf","path": "/restconf","protocol": "REST", "nodes": [ {"ip": "'$SDNC_IP'","port": "8282"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +#multi-vim +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "multicloud", "version": "v0", "url": "/api/multicloud/v0","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "9001"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "multicloud-vio", "version": "v0", "url": "/api/multicloud-vio/v0","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "9004"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "multicloud-ocata", "version": "v0", "url": "/api/multicloud-ocata/v0","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "9006"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "multicloud-titanium_cloud", "version": "v0", "url": "/api/multicloud-titanium_cloud/v0","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "9005"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +#VF-C +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "nslcm", "version": "v1", "url": "/api/nslcm/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8403"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "ztevnfmdriver", "version": "v1", "url": "/api/ztevnfmdriver/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8410"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "ztesdncdriver", "version": "v1", "url": "/api/ztesdncdriver/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8411"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "resmgr", "version": "v1", "url": "/api/resmgr/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8480"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "gvnfmdriver", "version": "v1", "url": "/api/gvnfmdriver/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8484"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "huaweivnfmdriver", "version": "v1", "url": "/api/huaweivnfmdriver/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8482"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "nokiavnfmdriver", "version": "v1", "url": "/api/nokiavnfmdriver/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8485"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "jujuvnfmdriver", "version": "v1", "url": "/api/jujuvnfmdriver/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8483"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "multivimproxy", "version": "v1", "url": "/api/multivimproxy/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8481"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "vnflcm", "version": "v1", "url": "/api/vnflcm/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8801"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "vnfres", "version": "v1", "url": "/api/vnfres/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8802"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "vnfmgr", "version": "v1", "url": "/api/vnfmgr/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8803"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "activiti", "version": "v1", "url": "/activiti-rest", "path": "/activiti-rest" "protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8804"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "workflow", "version": "v1", "url": "/api/workflow/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8805"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "workflow-modeler", "version": "v1", "url": "/api/workflow-modeler/v1","protocol": "REST", "nodes": [ {"ip": "'$SDC_IP'","port": "9527"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "workflow-modeler-ui", "version": "v1", "url": "/workflow-modeler","path": "/workflow-modeler","protocol": "UI", "nodes": [ {"ip": "'$SDC_IP'","port": "9527"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "catalog", "version": "v1", "url": "/api/catalog/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8806"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "NokiaSVNFM", "version": "v1", "url": "/api/NokiaSVNFM/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8089"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "emsdriver", "version": "v1", "url": "/api/emsdriver/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8206"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +#UUI +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "usecaseui-server", "version": "v1", "url": "/api/usecaseui/server/v1","protocol": "REST", "nodes": [ {"ip": "'$OPENO_IP'","port": "8082"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "usecaseui-ui", "version": "v1", "url": "/usecase-ui","path": "/iui/usecaseui","protocol": "UI", "nodes": [ {"ip": "'$OPENO_IP'","port": "8080"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" + +# CLAMP +curl -X POST -H "Content-Type: application/json" -d '{"serviceName": "clamp", "version": "v1", "url": "/restservices/clds/v1","protocol": "REST", "visualRange":"1", "nodes": [ {"ip": "'$CLAMP_IP'","port": "8080"}]}' "http://$OPENO_IP:10081/api/microservices/v1/services" diff --git a/heat/ONAP/cloud-config/music_install.sh b/heat/ONAP/cloud-config/music_install.sh index 84ba5629..38aaa71c 100644 --- a/heat/ONAP/cloud-config/music_install.sh +++ b/heat/ONAP/cloud-config/music_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,65 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip music_vm_init.sh > /opt/music_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/music_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/music_vm_init.sh -chmod +x /opt/music_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./music_vm_init.sh\"|g" /opt/music_serv.sh -mv /opt/music_serv.sh /etc/init.d update-rc.d music_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/music_vm_init.sh b/heat/ONAP/cloud-config/music_vm_init.sh new file mode 100644 index 00000000..2241ed13 --- /dev/null +++ b/heat/ONAP/cloud-config/music_vm_init.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) + +docker pull library/zookeeper:3.4 +docker pull library/tomcat:8.5 + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/onap/music/cassandra_music:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/onap/music/music:$DOCKER_IMAGE_VERSION + +cd /opt/music/distribution/dockermusic +git pull + +#Stop existing docker containers (if any) +if [ $(docker ps | wc -l) > 1 ]; then + ./music.sh stop + sleep 2 +fi + +./music.sh start
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/nbi_install.sh b/heat/ONAP/cloud-config/nbi_install.sh index 7705a25a..4e40f782 100644 --- a/heat/ONAP/cloud-config/nbi_install.sh +++ b/heat/ONAP/cloud-config/nbi_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,67 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -apt-get update -apt-get install -y apt-transport-https ca-certificates curl git ntp ntpdate make software-properties-common # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip nbi_vm_init.sh > /opt/nbi_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/nbi_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/nbi_vm_init.sh -chmod +x /opt/nbi_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./nbi_vm_init.sh\"|g" /opt/nbi_serv.sh -mv /opt/nbi_serv.sh /etc/init.d update-rc.d nbi_serv.sh defaults -# Download and install docker-engine and docker-compose -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - -add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" -apt-get update -apt-get install -y docker-ce - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/nbi_vm_init.sh b/heat/ONAP/cloud-config/nbi_vm_init.sh new file mode 100644 index 00000000..c626938e --- /dev/null +++ b/heat/ONAP/cloud-config/nbi_vm_init.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Set environment variables +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +export NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +export SDC_IP=$(cat /opt/config/sdc_ip_addr.txt) +export AAI_IP=$(cat /opt/config/aai_ip_addr.txt) +export SO_IP=$(cat /opt/config/so_ip_addr.txt) + +# Create nbi directory +mkdir -p /opt/nbi +cd /opt/nbi + +# Create .env file to access env variables for docker-compose +echo "SDC_IP=${SDC_IP}" > .env +echo "SO_IP=${SO_IP}" >> .env +echo "AAI_IP=${AAI_IP}" >> .env +echo "NEXUS_DOCKER_REPO=${NEXUS_DOCKER_REPO}" >> .env + +# Fetch the latest docker-compose.yml +curl -o docker-compose.yml https://git.onap.org/externalapi/nbi/plain/docker-compose.yml?h=master + +# Pull the nbi docker image from nexus +# MariaDB and mongoDB will be pulled automatically from docker.io during docker-compose +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +docker pull $NEXUS_DOCKER_REPO/onap/externalapi/nbi:$DOCKER_IMAGE_VERSION + +# Start nbi, MariaDB and MongoDB containers with docker compose and nbi/docker-compose.yml +/opt/docker/docker-compose up -d diff --git a/heat/ONAP/cloud-config/oof_install.sh b/heat/ONAP/cloud-config/oof_install.sh index d8eda1de..15987442 100644 --- a/heat/ONAP/cloud-config/oof_install.sh +++ b/heat/ONAP/cloud-config/oof_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,65 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip oof_vm_init.sh > /opt/oof_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/oof_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/oof_vm_init.sh -chmod +x /opt/oof_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./oof_vm_init.sh\"|g" /opt/oof_serv.sh -mv /opt/oof_serv.sh /etc/init.d update-rc.d oof_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/oof_vm_init.sh b/heat/ONAP/cloud-config/oof_vm_init.sh new file mode 100644 index 00000000..4654ffbb --- /dev/null +++ b/heat/ONAP/cloud-config/oof_vm_init.sh @@ -0,0 +1,233 @@ +#!/bin/bash + + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +CASS_MUSIC_IMAGE_VERSION=$(cat /opt/config/cass_version.txt) +MUSIC_IMAGE_VERSION=$(cat /opt/config/music_version.txt) +HAS_IMAGE_VERSION=$(cat /opt/config/has_docker_version.txt) +OSDF_IMAGE_VERSION=$(cat /opt/config/osdf_docker_version.txt) + +cd /opt/optf-has +git pull + +COND_CONF=/opt/optf-has/conductor.conf +LOG_CONF=/opt/optf-has/log.conf + +# Certification file for OOF-HAS +AAI_cert=/usr/local/bin/AAF_RootCA.cer +BUNDLE=/opt/optf-has/AAF_RootCA.cer + +OSDF_IMG=${NEXUS_DOCKER_REPO}/onap/optf-osdf:${OSDF_IMAGE_VERSION} +HAS_IMG=${NEXUS_DOCKER_REPO}/onap/optf-has:${HAS_IMAGE_VERSION} + +# pull OOF images from repo +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull ${OSDF_IMG} +docker pull ${HAS_IMG} + +# Install MUSIC +# MUSIC parameters +CASS_IMG=${NEXUS_DOCKER_REPO}/onap/music/cassandra_music:$CASS_MUSIC_IMAGE_VERSION +MUSIC_IMG=${NEXUS_DOCKER_REPO}/onap/music/music:$MUSIC_IMAGE_VERSION +TOMCAT_IMG=library/tomcat:8.5 +ZK_IMG=library/zookeeper:3.4 +WORK_DIR=/opt/optf-has +CASS_USERNAME=cassandra1 +CASS_PASSWORD=cassandra1 + +# pull MUSIC images +docker pull ${ZK_IMG} +docker pull ${TOMCAT_IMG} +docker pull ${CASS_IMG} +docker pull ${MUSIC_IMG} + +# create directory for music properties and logs +mkdir -p /opt/optf-has/music/properties +mkdir -p /opt/optf-has/music/logs + +# add music.properties file +cat > /opt/optf-has/music/properties/music.properties<<NEWFILE +my.id=0 +all.ids=0 +my.public.ip=localhost +all.public.ips=localhost + +####################################### + +# Optional current values are defaults + +####################################### +zookeeper.host=music-zk +cassandra.host=music-db +#music.ip=localhost +#debug=true +#music.rest.ip=localhost +#lock.lease.period=6000 +cassandra.user=cassandra1 +cassandra.password=cassandra1 + +# AAF Endpoint if using AAF +aaf.endpoint.url=https://aaf.api.simpledemo.onap.org +NEWFILE + +# Create Volume for mapping war file and tomcat +docker volume create music-vol + +# Create a network for all the containers to run in. +docker network create music-net + +# Start Cassandra +docker run -d --rm --name music-db --network music-net -p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" -e CASSUSER=${CASS_USERNAME} -e CASSPASS=${CASS_PASSWORD} ${CASS_IMG} + +# Start Music war +docker run -d --rm --name music-war -v music-vol:/app ${MUSIC_IMG} + +# Start Zookeeper +docker run -d --rm --name music-zk --network music-net -p "2181:2181" -p "2888:2888" -p "3888:3888" ${ZK_IMG} + +# Delay for Cassandra +sleep 20; + +# Start Up tomcat - Needs to have properties,logs dir and war file volume mapped. +docker run -d --rm --name music-tomcat --network music-net -p "8080:8080" -v music-vol:/usr/local/tomcat/webapps -v ${WORK_DIR}/music/properties:/opt/app/music/etc:ro -v ${WORK_DIR}/music/logs:/opt/app/music/logs ${TOMCAT_IMG} + +# Connect tomcat to host bridge network so that its port can be seen. +docker network connect bridge music-tomcat; +sleep 6; +echo "Running onboarding curl command" +curl -X POST \ + http://localhost:8080/MUSIC/rest/v2/admin/onboardAppWithMusic \ + -H 'Cache-Control: no-cache' \ + -H 'Content-Type: application/json' \ + -H 'Postman-Token: 7d2839f4-b032-487a-8998-4d1b27a932d7' \ + -d '{ +"appname": "conductor", +"userId" : "conductor", +"isAAF" : false, +"password" : "c0nduct0r" +} +' +echo "Onboarding curl complete" + +# Get MUSIC url +MUSIC_URL=$(docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' music-tomcat) + +# Run OOF-HAS +# Set A&AI and MUSIC url inside OOF-HAS conductor.conf +sed -i "138 s%.*%server_url = https://aai.api.simpledemo.onap.org:8443/aai%" $COND_CONF +sed -i "141 s%.*%server_url_version = v13%" $COND_CONF +sed -i "257 s%.*%server_url = http://$MUSIC_URL:8080/MUSIC/rest/v2%" $COND_CONF +sed -i "284 s%.*%replication_factor = 1%" $COND_CONF +sed -i "359 s%.*%server_url = http://msb.api.simpledemo.onap.org/api/multicloud%" $COND_CONF + +# Set A&AI authentication file locations inside OOF-HAS conductor.conf +sed -i "153 s%.*%certificate_authority_bundle_file = $AAI_cert%" $COND_CONF + + +echo "Values to data component" +echo $BUNDLE + +# run optf-has +docker run -d --name controller -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${HAS_IMG} python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf + +docker run -d --name api -p "8091:8091" -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${HAS_IMG} python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf + +docker run -d --name solver -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${HAS_IMG} python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf + +docker run -d --name reservation -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${HAS_IMG} python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf + +docker run -d --name data -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf -v $BUNDLE:/usr/local/bin/AAF_RootCA.cer ${HAS_IMG} python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf + +sleep 10 + +echo "Inserting healthcheck plan" + +curl -X POST \ + http://$MUSIC_URL:8080/MUSIC/rest/v2/keyspaces/conductor/tables/plans/rows/ \ + -H 'Cache-Control: no-cache' \ + -H 'Content-Type: application/json' \ + -H 'Postman-Token: 502781e8-d588-475d-b181-c2e26625ac95' \ + -H 'X-minorVersion: 3' \ + -H 'X-patchVersion: 0' \ + -H 'ns: conductor' \ + -H 'password: c0nduct0r' \ + -H 'userId: conductor' \ + -d '{ + "consistencyInfo": { + "type": "eventual" + }, + "values": { + "id" : "healthcheck", + "created": 1479482603641, + "message": "", + "name": "foo", + "recommend_max": 1, + "solution": "{\"healthcheck\": \" healthcheck\"}", + "status": "done", + "template": "{\"healthcheck\": \"healthcheck\"}", + "timeout": 3600, + "translation": "{\"healthcheck\": \" healthcheck\"}", + "updated": 1484324150629 + } +} +' + +echo "Healthcheck plan inserted" + + +#run optf-osdf +OSDF_CONFIG=/opt/optf-osdf/config/osdf_config.yaml +HAS_HOST=$(docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress}}' api) + +mkdir -p /opt/optf-osdf/config + +cat > $OSDF_CONFIG<<NEWFILE + +# Credentials for SO +soUsername: "" # SO username for call back. +soPassword: "" # SO password for call back. + +# Credentials for Conductor +conductorUrl: http://$HAS_HOST:8091/v1/plans/ +conductorUsername: admin1 +conductorPassword: plan.15 +conductorPingWaitTime: 60 # seconds to wait before calling the conductor retry URL +conductorMaxRetries: 30 # if we don't get something in 30 minutes, give up + +# Policy Platform -- requires ClientAuth, Authorization, and Environment +policyPlatformUrl: http://policy.api.simpledemo.onap.org:8081/pdp/api/getConfig # Policy Dev platform URL +policyPlatformEnv: TEST # Environment for policy platform +policyPlatformUsername: testpdp # Policy platform username. +policyPlatformPassword: alpha123 # Policy platform password. +policyClientUsername: python # For use with ClientAuth +policyClientPassword: test # For use with ClientAuth + +# Credentials for DMaaP +messageReaderHosts: NA +messageReaderTopic: NA +messageReaderAafUserId: NA +messageReaderAafPassword: NA + +# Credentials for SDC +sdcUrl: NA +sdcUsername: NA +sdcPassword: NA +sdcONAPInstanceID: NA + +# Credentials for the OOF placement service - Generic +osdfPlacementUsername: test +osdfPlacementPassword: testpwd + +# Credentials for the OOF placement service - SO +osdfPlacementSOUsername: so_test +osdfPlacementSOPassword: so_testpwd + +# Credentials for the OOF CM scheduling service - Generic +osdfCMSchedulerUsername: test1 +osdfCMSchedulerPassword: testpwd1 + +NEWFILE + +docker run -d --name osdf -v $OSDF_CONFIG:/opt/app/config/osdf_config.yaml -p 8698:8699 ${OSDF_IMG} diff --git a/heat/ONAP/cloud-config/openo_all_serv.sh b/heat/ONAP/cloud-config/openo_all_serv.sh new file mode 100644 index 00000000..57de2908 --- /dev/null +++ b/heat/ONAP/cloud-config/openo_all_serv.sh @@ -0,0 +1,16 @@ +#!/bin/bash +HTTP_PROXY=$(cat /opt/config/http_proxy.txt) +HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + export https_proxy=$HTTPS_PROXY +fi + +bash /opt/msb_vm_init.sh &>/dev/null &disown +bash /opt/vnfsdk_vm_init.sh &>/dev/null &disown +bash /opt/mvim_vm_init.sh &>/dev/null &disown +bash /opt/vfc_vm_init.sh &>/dev/null &disown +bash /opt/uui_vm_init.sh &>/dev/null &disown +bash /opt/esr_vm_init.sh &>/dev/null &disown
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/openo_install.sh b/heat/ONAP/cloud-config/openo_install.sh index 57e00949..e9150a27 100644 --- a/heat/ONAP/cloud-config/openo_install.sh +++ b/heat/ONAP/cloud-config/openo_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) VNFSDK_BRANCH=$(cat /opt/config/vnfsdk_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) VNFSDK_REPO=$(cat /opt/config/vnfsdk_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,82 +12,29 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - # Download dependencies apt-get update -apt-get install -y apt-transport-https ca-certificates wget git unzip mysql-client-core-5.6 ntp ntpdate make +apt-get install -y mysql-client-core-5.6 # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip vnfsdk_vm_init.sh > /opt/vnfsdk_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip msb_vm_init.sh > /opt/msb_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip mvim_vm_init.sh > /opt/mvim_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip vfc_vm_init.sh > /opt/vfc_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip uui_vm_init.sh > /opt/uui_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip openo_all_serv.sh > /opt/openo_all_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/openo_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip cli_install.sh > /opt/cli_install.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip esr_vm_init.sh > /opt/esr_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh +cp /opt/boot/vnfsdk_vm_init.sh /opt/vnfsdk_vm_init.sh +cp /opt/boot/msb_vm_init.sh /opt/msb_vm_init.sh +cp /opt/boot/mvim_vm_init.sh /opt/mvim_vm_init.sh +cp /opt/boot/vfc_vm_init.sh /opt/vfc_vm_init.sh +cp /opt/boot/uui_vm_init.sh /opt/uui_vm_init.sh +cp /opt/boot/openo_all_serv.sh /opt/openo_all_serv.sh +cp /opt/boot/esr_vm_init.sh /opt/esr_vm_init.sh chmod +x /opt/vnfsdk_vm_init.sh chmod +x /opt/msb_vm_init.sh chmod +x /opt/mvim_vm_init.sh chmod +x /opt/vfc_vm_init.sh chmod +x /opt/uui_vm_init.sh chmod +x /opt/openo_all_serv.sh -chmod +x /opt/openo_serv.sh -chmod +x /opt/cli_install.sh chmod +x /opt/esr_vm_init.sh -sed -i "s|cmd=\"\"|cmd=\"./openo_all_serv.sh\"|g" /opt/openo_serv.sh -mv /opt/openo_serv.sh /etc/init.d update-rc.d openo_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u - # Clone Gerrit repository and run docker containers cd /opt git clone -b $VNFSDK_BRANCH --single-branch $VNFSDK_REPO source ./cli_install.sh -./openo_all_serv.sh
\ No newline at end of file +./openo_all_serv.sh diff --git a/heat/ONAP/cloud-config/policy_install.sh b/heat/ONAP/cloud-config/policy_install.sh index c77323d1..43537c03 100644 --- a/heat/ONAP/cloud-config/policy_install.sh +++ b/heat/ONAP/cloud-config/policy_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,65 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip policy_vm_init.sh > /opt/policy_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/policy_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/policy_vm_init.sh -chmod +x /opt/policy_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./policy_vm_init.sh\"|g" /opt/policy_serv.sh -mv /opt/policy_serv.sh /etc/init.d update-rc.d policy_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/policy_vm_init.sh b/heat/ONAP/cloud-config/policy_vm_init.sh new file mode 100644 index 00000000..12818402 --- /dev/null +++ b/heat/ONAP/cloud-config/policy_vm_init.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +# destroy running instances if any + +for container in $(docker ps -q) +do + echo "stopping container ${container}" + docker stop "${container}" +done + +for container in $(docker ps -a -q) +do + echo "removing container ${container}" + docker rm -v "${container}" +done + +# remove dangling resources + +for volume in $(docker volume ls -qf dangling=true) +do + echo "removing volume ${volume}" + docker volume rm "${volume}" +done + +for image in $(docker images -f dangling=true -q) +do + echo "removing image ${image}" + docker rmi "${image}" +done + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) +export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) +export DOCKER_REPOSITORY=${NEXUS_DOCKER_REPO} + +cd /opt/policy +git pull + +chmod +x config/pe/brmsgw-tweaks.sh +chmod +x config/pe/pap-tweaks.sh +chmod +x config/pe/pdp-tweaks.sh +chmod +x config/pe/push-policies.sh +chmod +x config/drools/apps-install.sh +chmod +x config/drools/drools-preinstall.sh +chmod +x config/drools/drools-tweaks.sh +chmod +x config/db/db.sh + +# ensure brmsgw dependency configuration is set up correctly + +sed -i -e "s/^BRMS_DEPENDENCY_VERSION=.*$/BRMS_DEPENDENCY_VERSION=${ARTIFACT_VERSION}/g" /opt/policy/config/pe/brmsgw.conf + + +if [ -e /opt/config/public_ip.txt ] +then + IP_ADDRESS=$(cat /opt/config/public_ip.txt) +else + IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) +fi + +echo $IP_ADDRESS > config/pe/ip_addr.txt + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +#docker pull $NEXUS_DOCKER_REPO/onap/policy-db:$DOCKER_IMAGE_VERSION +#docker tag $NEXUS_DOCKER_REPO/onap/policy-db:$DOCKER_IMAGE_VERSION onap/policy/policy-db:latest + +docker pull $NEXUS_DOCKER_REPO/onap/policy-pe:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/policy-pe:$DOCKER_IMAGE_VERSION onap/policy-pe:latest + +docker pull $NEXUS_DOCKER_REPO/onap/policy-drools:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/policy-drools:$DOCKER_IMAGE_VERSION onap/policy-drools:latest + +#docker pull $NEXUS_DOCKER_REPO/onap/policy-nexus:$DOCKER_IMAGE_VERSION +#docker tag $NEXUS_DOCKER_REPO/onap/policy-nexus:$DOCKER_IMAGE_VERSION onap/policy-nexus:latest + +/opt/docker/docker-compose up -d diff --git a/heat/ONAP/cloud-config/portal_install.sh b/heat/ONAP/cloud-config/portal_install.sh index d052d655..7945d0e5 100644 --- a/heat/ONAP/cloud-config/portal_install.sh +++ b/heat/ONAP/cloud-config/portal_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,65 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git unzip mysql-client-core-5.6 ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip portal_vm_init.sh > /opt/portal_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/portal_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/portal_vm_init.sh -chmod +x /opt/portal_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./portal_vm_init.sh\"|g" /opt/portal_serv.sh -mv /opt/portal_serv.sh /etc/init.d update-rc.d portal_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/portal_vm_init.sh b/heat/ONAP/cloud-config/portal_vm_init.sh new file mode 100644 index 00000000..17640058 --- /dev/null +++ b/heat/ONAP/cloud-config/portal_vm_init.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# Starts docker containers for ONAP Portal in Rackspace. +# Version for Amsterdam/R1 uses docker-compose. + +# be verbose +set -x + +# Establish environment variables +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) +# Use "latest" to deploy snapshot images: +# DOCKER_IMAGE_VERSION=latest +CLI_DOCKER_VERSION=$(cat /opt/config/cli_docker_version.txt) +CDR_IMAGE_VERSION=latest +ZK_IMAGE_VERSION=3.4 + +# Refresh configuration and scripts +cd /opt/portal +git pull +cd deliveries + +# Get image names used below from docker-compose environment file +source .env + +# Refresh images +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/$DB_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$EP_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$SDK_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$CDR_IMG_NAME:$CDR_IMAGE_VERSION +docker pull $ZK_IMG_NAME:$ZK_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$WMS_IMG_NAME:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION + +# Tag them as expected by docker-compose file +docker tag $NEXUS_DOCKER_REPO/$DB_IMG_NAME:$DOCKER_IMAGE_VERSION $DB_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$EP_IMG_NAME:$DOCKER_IMAGE_VERSION $EP_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$SDK_IMG_NAME:$DOCKER_IMAGE_VERSION $SDK_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$CDR_IMG_NAME:$CDR_IMAGE_VERSION $CDR_IMG_NAME:$PORTAL_TAG +docker tag $ZK_IMG_NAME:$ZK_IMAGE_VERSION $ZK_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$WMS_IMG_NAME:$DOCKER_IMAGE_VERSION $WMS_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION $CLI_IMG_NAME:$PORTAL_TAG + +# Export variable for local logs directory, and create directory too +# The leading "./" is required for docker-compose +export LOGS_DIR=./logs +mkdir -p $LOGS_DIR + +# Export variable for subdirectory with appropriate property files +# The leading "./" is required for docker-compose +export PROPS_DIR=./properties_simpledemo + +# docker-compose is not in /usr/bin +/opt/docker/docker-compose down +/opt/docker/docker-compose up -d
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/robot_install.sh b/heat/ONAP/cloud-config/robot_install.sh index 7896ecde..3441dd85 100644 --- a/heat/ONAP/cloud-config/robot_install.sh +++ b/heat/ONAP/cloud-config/robot_install.sh @@ -1,10 +1,6 @@ #!/bin/bash -x # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -17,73 +13,22 @@ fi # Short-term fix to get around MSO to SO name change cp /opt/config/so_ip_addr.txt /opt/config/mso_ip_addr.txt -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip robot_vm_init.sh > /opt/robot_vm_init.sh -chmod +x /opt/robot_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/robot_serv.sh -chmod +x /opt/robot_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./robot_vm_init.sh\"|g" /opt/robot_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh - mkdir -p /opt/eteshare/config -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip robot/integration_preload_parameters.py > /opt/eteshare/config/integration_preload_parameters.py -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip robot/integration_robot_properties.py > /opt/eteshare/config/integration_robot_properties.py -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip robot/vm_config2robot.sh > /opt/eteshare/config/vm_config2robot.sh +cp /opt/boot/robot/integration_preload_parameters.py /opt/eteshare/config/integration_preload_parameters.py +cp /opt/boot/robot/integration_robot_properties.py /opt/eteshare/config/integration_robot_properties.py +cp /opt/boot/robot/vm_config2robot.sh /opt/eteshare/config/vm_config2robot.sh chmod +x /opt/eteshare/config/vm_config2robot.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip robot/ete.sh > /opt/ete.sh +cp /opt/boot/robot/ete.sh /opt/ete.sh chmod +x /opt/ete.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip robot/demo.sh > /opt/demo.sh +cp /opt/boot/robot/demo.sh /opt/demo.sh chmod +x /opt/demo.sh mkdir -p /opt/eteshare/logs -cp /opt/robot_serv.sh /etc/init.d update-rc.d robot_serv.sh defaults -# Download and install docker-engine -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Run docker containers. ./robot_vm_init.sh diff --git a/heat/ONAP/cloud-config/robot_vm_init.sh b/heat/ONAP/cloud-config/robot_vm_init.sh new file mode 100644 index 00000000..65eec434 --- /dev/null +++ b/heat/ONAP/cloud-config/robot_vm_init.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) +SNIRO_DOCKER_IMAGE_VERSION=$(cat /opt/config/sniro_docker_version.txt) + +/bin/bash /opt/eteshare/config/vm_config2robot.sh + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/onap/testsuite:$DOCKER_IMAGE_VERSION +docker rm -f openecompete_container + +docker pull $NEXUS_DOCKER_REPO/onap/sniroemulator:$SNIRO_DOCKER_IMAGE_VERSION +docker rm -f sniroemulator + +docker run -d --name openecompete_container -v /opt/eteshare:/share -p 88:88 $NEXUS_DOCKER_REPO/onap/testsuite:$DOCKER_IMAGE_VERSION +docker run -d --name sniroemulator -p 8080:9999 $NEXUS_DOCKER_REPO/onap/sniroemulator:$SNIRO_DOCKER_IMAGE_VERSION diff --git a/heat/ONAP/cloud-config/sdc_install.sh b/heat/ONAP/cloud-config/sdc_install.sh index 55963734..a77cdc92 100644 --- a/heat/ONAP/cloud-config/sdc_install.sh +++ b/heat/ONAP/cloud-config/sdc_install.sh @@ -1,11 +1,8 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,50 +13,19 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip sdc_vm_init.sh > /opt/sdc_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/sdc_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip sdc_wfd_vm_init.sh > /opt/sdc_wfd_vm_init.sh -chmod +x /opt/sdc_vm_init.sh -chmod +x /opt/sdc_serv.sh -chmod +x /opt/sdc_wfd_vm_init.sh -sed -i "s|cmd=\"\"|cmd=\"./sdc_vm_init.sh\"|g" /opt/sdc_serv.sh -mv /opt/sdc_serv.sh /etc/init.d update-rc.d sdc_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - # Create partition and mount the external volume -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip sdc_ext_volume_partitions.txt > /opt/sdc_ext_volume_partitions.txt +cp /opt/boot/sdc_ext_volume_partitions.txt /opt/sdc_ext_volume_partitions.txt if [[ $CLOUD_ENV == "rackspace" ]] then - DISK="xvdb" + DISK="xvdb" else - DISK=$(ls /dev |grep -e '^.*db$') - sed -i "s/xvdb/$DISK/g" /opt/sdc_ext_volume_partitions.txt + DISK=$(ls /dev |grep -e '^.*db$') + sed -i "s/xvdb/$DISK/g" /opt/sdc_ext_volume_partitions.txt fi sfdisk /dev/$DISK < /opt/sdc_ext_volume_partitions.txt @@ -68,30 +34,6 @@ mkdir -p /data mount /dev/$DISK"1" /data echo "/dev/"$DISK"1 /data ext4 errors=remount-ro,noatime,barrier=0 0 1" >> /etc/fstab -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository cd /opt diff --git a/heat/ONAP/cloud-config/sdc_vm_init.sh b/heat/ONAP/cloud-config/sdc_vm_init.sh new file mode 100644 index 00000000..9626a2ee --- /dev/null +++ b/heat/ONAP/cloud-config/sdc_vm_init.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +ENV_NAME=$(cat /opt/config/env_name.txt) +MR_IP_ADDR=$(cat /opt/config/mr_ip_addr.txt) +RELEASE=$(cat /opt/config/docker_version.txt) + +cd /opt/sdc +git pull + +cd /opt +cp sdc/sdc-os-chef/environments/Template.json /data/environments +cp sdc/sdc-os-chef/scripts/docker_run.sh /data/scripts +cp sdc/sdc-os-chef/scripts/docker_health.sh /data/scripts +chmod +x /data/scripts/docker_run.sh +chmod +x /data/scripts/docker_health.sh + +IP_ADDRESS=$(cat /opt/config/private_ip.txt) + +cat /data/environments/Template.json | sed "s/yyy/"$IP_ADDRESS"/g" > /data/environments/$ENV_NAME.json +sed -i "s/xxx/"$ENV_NAME"/g" /data/environments/$ENV_NAME.json +sed -i "s/\"ueb_url_list\":.*/\"ueb_url_list\": \""$MR_IP_ADDR","$MR_IP_ADDR"\",/g" /data/environments/$ENV_NAME.json +sed -i "s/\"fqdn\":.*/\"fqdn\": [\""$MR_IP_ADDR"\", \""$MR_IP_ADDR"\"]/g" /data/environments/$ENV_NAME.json + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +bash /data/scripts/docker_run.sh -r $RELEASE diff --git a/heat/ONAP/cloud-config/sdc_wfd_vm_init.sh b/heat/ONAP/cloud-config/sdc_wfd_vm_init.sh new file mode 100644 index 00000000..bcbcb4ac --- /dev/null +++ b/heat/ONAP/cloud-config/sdc_wfd_vm_init.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +RELEASE=$(cat /opt/config/sdc_wfd_docker.txt) + +source /opt/config/onap_ips.txt + +# pull sdc-workflow-designer docker image +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/onap/sdc/sdc-workflow-designer:$RELEASE + +docker rm -f sdc-workflow-designer + + +# setup sdc-workflow-designer docker image +docker run --detach --name sdc-workflow-designer --ulimit memlock=-1:-1 --memory 1g --memory-swap=1g --ulimit nofile=4096:100000 --publish 9527:8080 $NEXUS_DOCKER_REPO/onap/sdc/sdc-workflow-designer:$RELEASE diff --git a/heat/ONAP/cloud-config/sdnc_install.sh b/heat/ONAP/cloud-config/sdnc_install.sh index 2c82eea5..3eae650d 100644 --- a/heat/ONAP/cloud-config/sdnc_install.sh +++ b/heat/ONAP/cloud-config/sdnc_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,65 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make jq # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip sdnc_vm_init.sh > /opt/sdnc_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/sdnc_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/sdnc_vm_init.sh -chmod +x /opt/sdnc_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./sdnc_vm_init.sh\"|g" /opt/sdnc_serv.sh -mv /opt/sdnc_serv.sh /etc/init.d update-rc.d sdnc_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/sdnc_vm_init.sh b/heat/ONAP/cloud-config/sdnc_vm_init.sh new file mode 100644 index 00000000..7816eab4 --- /dev/null +++ b/heat/ONAP/cloud-config/sdnc_vm_init.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +export NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) +DGBUILDER_IMAGE_VERSION=$(cat /opt/config/dgbuilder_version.txt) +export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) +export DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) + +cd /opt/sdnc +git pull + +cd /opt/sdnc/installation/src/main/yaml +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO + +docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$DOCKER_IMAGE_VERSION onap/sdnc-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$DOCKER_IMAGE_VERSION onap/sdnc-ansible-server-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/admportal-sdnc-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/admportal-sdnc-image:$DOCKER_IMAGE_VERSION onap/admportal-sdnc-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$DGBUILDER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-dgbuilder-image:$DGBUILDER_IMAGE_VERSION onap/ccsdk-dgbuilder-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-ueb-listener-image:latest + +docker pull $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION +docker tag $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-dmaap-listener-image:latest + +echo "Waiting for 10 minutes for SDC to start"; +RES=$(curl -s -X GET http://10.0.3.1:8080/sdc2/rest/healthCheck -H 'Accept: application/json' -H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -H 'Postman-Token: ffeba4a6-82b6-44d8-87e6-8b510f1127fd' | jq '.componentsInfo[] | select(.healthCheckComponent == "BE") | .description') +counter=0; +while [[ $RES != "\"OK\"" ]]; do + sleep 10; + let counter=$counter+1 + if [[ $counter -eq 60 ]]; then + break; + fi +done + +if [[ $RES == "\"OK\"" ]]; then + echo "Starting SDNC containers" +else + echo "Timeout expired before SDC BE health check passed. SDNC containers starting, but UEB Listener may not be healthy" +fi + +/opt/docker/docker-compose up -d diff --git a/heat/ONAP/cloud-config/serv.sh b/heat/ONAP/cloud-config/serv.sh new file mode 100644 index 00000000..62466d9c --- /dev/null +++ b/heat/ONAP/cloud-config/serv.sh @@ -0,0 +1,106 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: __vm_init_script__ +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start daemon at boot time +# Description: Enable service provided by daemon. +### END INIT INFO +HTTP_PROXY=$(cat /opt/config/http_proxy.txt) +HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + export https_proxy=$HTTPS_PROXY +fi + +dir="/opt" +cmd="./__vm_init_script__" +user="root" + +name=`basename $0` +pid_file="/var/run/$name.pid" +stdout_log="/var/log/$name.log" +stderr_log="/var/log/$name.err" + +get_pid() { + cat "$pid_file" +} + +is_running() { + [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1 +} + +case "$1" in + start) + if is_running; then + echo "Already started" + else + echo "Starting $name" + cd "$dir" + if [ -z "$user" ]; then + sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & + else + sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & + fi + echo $! > "$pid_file" + if ! is_running; then + echo "Unable to start, see $stdout_log and $stderr_log" + exit 1 + fi + fi + ;; + stop) + if is_running; then + echo -n "Stopping $name.." + kill `get_pid` + for i in {1..10} + do + if ! is_running; then + break + fi + + echo -n "." + sleep 1 + done + echo + + if is_running; then + echo "Not stopped; may still be shutting down or shutdown may have failed" + exit 1 + else + echo "Stopped" + if [ -f "$pid_file" ]; then + rm "$pid_file" + fi + fi + else + echo "Not running" + fi + ;; + restart) + $0 stop + if is_running; then + echo "Unable to stop, will not attempt to start" + exit 1 + fi + $0 start + ;; + status) + if is_running; then + echo "Running" + else + echo "Stopped" + exit 1 + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/heat/ONAP/cloud-config/sms_install.sh b/heat/ONAP/cloud-config/sms_install.sh index bdd3a630..11617ea9 100644 --- a/heat/ONAP/cloud-config/sms_install.sh +++ b/heat/ONAP/cloud-config/sms_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,65 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip sms_vm_init.sh > /opt/sms_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/sms_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/sms_vm_init.sh -chmod +x /opt/sms_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./sms_vm_init.sh\"|g" /opt/sms_serv.sh -mv /opt/sms_serv.sh /etc/init.d update-rc.d sms_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/sms_vm_init.sh b/heat/ONAP/cloud-config/sms_vm_init.sh new file mode 100644 index 00000000..62a9ac82 --- /dev/null +++ b/heat/ONAP/cloud-config/sms_vm_init.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) + +docker pull library/vault:0.10.0 +docker pull library/consul:1.0.6 + +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/onap/aaf/sms:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/onap/aaf/smsquorumclient:$DOCKER_IMAGE_VERSION + +cd /opt/sms/sms-service/bin/deploy + +#Stop existing docker containers (if any) +if [ $(docker ps | wc -l) > 1 ]; then + ./sms.sh stop + sleep 10 +fi + +./sms.sh start
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/so_install.sh b/heat/ONAP/cloud-config/so_install.sh index e47a73f2..18995249 100644 --- a/heat/ONAP/cloud-config/so_install.sh +++ b/heat/ONAP/cloud-config/so_install.sh @@ -1,12 +1,8 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) OPENSTACK_API_KEY=$(cat /opt/config/openstack_api_key.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -17,65 +13,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip so_vm_init.sh > /opt/so_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/so_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/so_vm_init.sh -chmod +x /opt/so_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./so_vm_init.sh\"|g" /opt/so_serv.sh -mv /opt/so_serv.sh /etc/init.d update-rc.d so_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers. cd /opt diff --git a/heat/ONAP/cloud-config/so_vm_init.sh b/heat/ONAP/cloud-config/so_vm_init.sh new file mode 100644 index 00000000..58ee9921 --- /dev/null +++ b/heat/ONAP/cloud-config/so_vm_init.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DMAAP_TOPIC=$(cat /opt/config/dmaap_topic.txt) +OPENSTACK_USERNAME=$(cat /opt/config/openstack_username.txt) +OPENSTACK_APIKEY=$(cat /opt/config/api_key.txt) +export MSO_DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) +export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) +export OPENO_IP=$(cat /opt/config/openo_ip.txt) + +# Deployments in OpenStack require a keystone file +if [ -e /opt/config/keystone.txt ] +then + KEYSTONE_URL=$(cat /opt/config/keystone.txt) + OPENSTACK_REGION=$(cat /opt/config/openstack_region.txt) + DCP_CLLI="DEFAULT_KEYSTONE" + AUTH_TYPE="USERNAME_PASSWORD" + read -d '' CLOUD_SITES <<-EOF + "cloud_sites": [{ + "aic_version": "2.5", + "id": "$OPENSTACK_REGION", + "identity_service_id": "$DCP_CLLI", + "lcp_clli": "$OPENSTACK_REGION", + "region_id": "$OPENSTACK_REGION" + }], +EOF +else + KEYSTONE_URL="https://identity.api.rackspacecloud.com/v2.0" + DCP_CLLI="RAX_KEYSTONE" + AUTH_TYPE="RACKSPACE_APIKEY" + read -d '' CLOUD_SITES <<-EOF + "cloud_sites": [ + { + "id": "Dallas", + "aic_version": "2.5", + "lcp_clli": "DFW", + "region_id": "DFW", + "identity_service_id": "$DCP_CLLI" + }, + + { + "id": "Northern Virginia", + "aic_version": "2.5", + "lcp_clli": "IAD", + "region_id": "IAD", + "identity_service_id": "$DCP_CLLI" + }, + + { + "id": "Chicago", + "aic_version": "2.5", + "lcp_clli": "ORD", + "region_id": "ORD", + "identity_service_id": "$DCP_CLLI" + } + ], +EOF +fi + +# Update the SO configuration file. +read -d '' MSO_CONFIG_UPDATES <<-EOF +{ +"default_attributes": + { + "asdc-connections": + { + "asdc-controller1": + { + "environmentName": "$DMAAP_TOPIC" + } + }, + "mso-po-adapter-config": + { + $CLOUD_SITES + "identity_services": + [ + {"dcp_clli": "$DCP_CLLI", + "identity_url": "$KEYSTONE_URL/v2.0", + "mso_id": "$OPENSTACK_USERNAME", + "mso_pass": "$OPENSTACK_APIKEY", + "admin_tenant": "service", + "member_role": "admin", + "tenant_metadata": "true", + "identity_server_type": "KEYSTONE", + "identity_authentication_type": "$AUTH_TYPE" + + } + ] + }, + "mso-bpmn-urn-config": { + "msoDefaultCloudOwnerId": "CloudOwner" + } + } +} +EOF +export MSO_CONFIG_UPDATES + +# Deploy the environment +cd /opt/test_lab +git pull +chmod +x deploy.sh +#This script takes in input 2 nexus repos (the first one for the SO image, the second one for mariadb) +./deploy.sh $NEXUS_DOCKER_REPO $NEXUS_USERNAME $NEXUS_PASSWD $NEXUS_DOCKER_REPO $NEXUS_USERNAME $NEXUS_PASSWD diff --git a/heat/ONAP/cloud-config/vid_install.sh b/heat/ONAP/cloud-config/vid_install.sh index 2f36e9f0..a73a6832 100644 --- a/heat/ONAP/cloud-config/vid_install.sh +++ b/heat/ONAP/cloud-config/vid_install.sh @@ -1,11 +1,7 @@ #!/bin/bash # Read configuration files -ARTIFACTS_VERSION=$(cat /opt/config/artifacts_version.txt) -DNS_IP_ADDR=$(cat /opt/config/dns_ip_addr.txt) -CLOUD_ENV=$(cat /opt/config/cloud_env.txt) GERRIT_BRANCH=$(cat /opt/config/gerrit_branch.txt) -MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) CODE_REPO=$(cat /opt/config/remote_repo.txt) HTTP_PROXY=$(cat /opt/config/http_proxy.txt) HTTPS_PROXY=$(cat /opt/config/https_proxy.txt) @@ -16,65 +12,10 @@ then export https_proxy=$HTTPS_PROXY fi -# Add host name to /etc/host to avoid warnings in openstack images -if [[ $CLOUD_ENV != "rackspace" ]] -then - echo 127.0.0.1 $(hostname) >> /etc/hosts - - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh -fi - -# Download dependencies -apt-get update -apt-get install -y apt-transport-https ca-certificates wget git ntp ntpdate make # Download scripts from Nexus -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip vid_vm_init.sh > /opt/vid_vm_init.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip serv.sh > /opt/vid_serv.sh -unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip imagetest.sh > /opt/imagetest.sh -chmod +x /opt/imagetest.sh -chmod +x /opt/vid_vm_init.sh -chmod +x /opt/vid_serv.sh -sed -i "s|cmd=\"\"|cmd=\"./vid_vm_init.sh\"|g" /opt/vid_serv.sh -mv /opt/vid_serv.sh /etc/init.d update-rc.d vid_serv.sh defaults -# Download and install docker-engine and docker-compose -echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/docker.list -apt-get update -apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual -apt-get install -y --allow-unauthenticated docker-engine - -mkdir /opt/docker -curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /opt/docker/docker-compose -chmod +x /opt/docker/docker-compose - -# Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP -DNS_FLAG="" -if [ -s /opt/config/dns_ip_addr.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " -fi -if [ -s /opt/config/external_dns.txt ] -then - DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " -fi -echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker - -cp /lib/systemd/system/docker.service /etc/systemd/system -sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service -if [ $HTTP_PROXY != "no_proxy" ] -then -cd /opt -./imagetest.sh -fi -service docker restart - -# DNS IP address configuration -echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head -resolvconf -u # Clone Gerrit repository and run docker containers cd /opt diff --git a/heat/ONAP/cloud-config/vid_vm_init.sh b/heat/ONAP/cloud-config/vid_vm_init.sh new file mode 100644 index 00000000..9c67307f --- /dev/null +++ b/heat/ONAP/cloud-config/vid_vm_init.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) +NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) +NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) +DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) + +cd /opt/vid +git pull +cd /opt + +docker pull mariadb:10 +docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +docker pull $NEXUS_DOCKER_REPO/onap/vid:$DOCKER_IMAGE_VERSION + +docker rm -f vid-mariadb +docker rm -f vid-server + +docker run --name vid-mariadb -e MYSQL_DATABASE=vid_openecomp_epsdk -e MYSQL_USER=vidadmin -e MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -e MYSQL_ROOT_PASSWORD=LF+tp_1WqgSY -v /opt/vid/lf_config/vid-my.cnf:/etc/mysql/my.cnf -v /opt/vid/lf_config/vid-pre-init.sql:/docker-entrypoint-initdb.d/vid-pre-init.sql -v /var/lib/mysql -d mariadb:10 + +docker run -e VID_MYSQL_DBNAME=vid_openecomp_epsdk -e VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U --name vid-server -p 8080:8080 --link vid-mariadb:vid-mariadb-docker-instance -d $NEXUS_DOCKER_REPO/onap/vid:$DOCKER_IMAGE_VERSION diff --git a/heat/ONAP/onap_openstack.yaml b/heat/ONAP/onap_openstack.yaml index 5e925a64..2f95e8bc 100644 --- a/heat/ONAP/onap_openstack.yaml +++ b/heat/ONAP/onap_openstack.yaml @@ -661,6 +661,16 @@ resources: echo "__openstack_api_key__" > /opt/config/openstack_api_key.txt echo "__openstack_region__" > /opt/config/openstack_region.txt + # Add host name to /etc/host to avoid warnings in openstack images + if [[ "__cloud_env__" != "rackspace" ]] + then + echo 127.0.0.1 $(hostname) >> /etc/hosts + + # Allow remote login as root + mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk + cp /home/ubuntu/.ssh/authorized_keys /root/.ssh + fi + if [ __http_proxy__ != "no_proxy" ] then echo "Acquire" > /etc/apt/apt.conf.d/apt.conf @@ -674,15 +684,58 @@ resources: export https_proxy=__https_proxy__ fi - # Download and run install script apt update - apt-get -y install unzip + apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual apt-transport-https ca-certificates wget git ntp ntpdate make jq unzip + + # Download boot scripts if [[ "__artifacts_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi - while [ ! -s /opt/boot-__artifacts_version__.zip ]; do - curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo&a=boot&e=zip&v=__artifacts_version__" -o /opt/boot-__artifacts_version__.zip + cd /opt + while [ -z "$ZIP_NAME" ] || [ ! -s "$ZIP_NAME" ]; do + wget --content-disposition "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo&a=boot&e=zip&v=__artifacts_version__" + ZIP_NAME=$(ls -1 /opt/boot-*.zip) done - ln -s /opt/boot-__artifacts_version__.zip /opt/boot.zip + mkdir -p /opt/boot + unzip $ZIP_NAME -d /opt/boot + + # Download and install docker-engine + echo "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main" | tee /etc/apt/sources.list.d/docker.list + apt-get update + apt-get install -y --allow-unauthenticated docker-engine + + # Install docker-compose + mkdir -p /opt/docker + curl -L "https://github.com/docker/compose/releases/download/1.16.1/docker-compose-$(uname -s)-$(uname -m)" > /opt/docker/docker-compose + chmod +x /opt/docker/docker-compose + + # Set the MTU size of docker containers to the minimum MTU size supported by vNICs. OpenStack deployments may need to know the external DNS IP + DNS_FLAG="" + if [ -s /opt/config/dns_ip_addr.txt ] + then + DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/dns_ip_addr.txt) " + fi + if [ -s /opt/config/external_dns.txt ] + then + DNS_FLAG=$DNS_FLAG"--dns $(cat /opt/config/external_dns.txt) " + fi + MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) + echo "DOCKER_OPTS=\"$DNS_FLAG--mtu=$MTU\"" >> /etc/default/docker + + cp /lib/systemd/system/docker.service /etc/systemd/system + sed -i "/ExecStart/s/$/ --mtu=$MTU/g" /etc/systemd/system/docker.service + if [ __http_proxy__ != "no_proxy" ] + then + echo "[Service]" > /etc/systemd/system/docker.service.d/http-proxy.conf + echo "Environment=\"http_proxy=http://__http_proxy__" >> /etc/systemd/system/docker.service.d/http-proxy.conf + echo "Environment=\"https_proxy=https://__https_proxy__" >>/etc/systemd/system/docker.service.d/http-proxy.conf + echo "Environment=\"HTTP_PROXY=HTTP://__http_proxy__" >>/etc/systemd/system/docker.service.d/http-proxy.conf + echo "Environment=\"HTTPS_PROXY=HTTPS://__https_proxy__" >>/etc/systemd/system/docker.service.d/http-proxy.conf + fi + systemctl daemon-reload + service docker restart + # DNS IP address configuration + echo "nameserver __dns_ip_addr__" >> /etc/resolvconf/resolv.conf.d/head + resolvconf -u # DNS Server instantiation dns_private_port: @@ -824,6 +877,17 @@ resources: - path: /opt/aai_install.sh permissions: '0755' content: { get_file: cloud-config/aai_install.sh } + - path: /opt/aai_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/aai_vm_init.sh } + - path: /etc/init.d/aai_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: aai_vm_init.sh + template: + get_file: cloud-config/serv.sh aai1_vm_config: type: OS::Heat::MultipartMime @@ -890,6 +954,17 @@ resources: - path: /opt/aai_install.sh permissions: '0755' content: { get_file: cloud-config/aai_install.sh } + - path: /opt/aai_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/aai_vm_init.sh } + - path: /etc/init.d/aai_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: aai_vm_init.sh + template: + get_file: cloud-config/serv.sh aai2_vm_config: type: OS::Heat::MultipartMime @@ -957,6 +1032,17 @@ resources: - path: /opt/so_install.sh permissions: '0755' content: { get_file: cloud-config/so_install.sh } + - path: /opt/so_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/so_vm_init.sh } + - path: /etc/init.d/so_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: so_vm_init.sh + template: + get_file: cloud-config/serv.sh so_vm_config: type: OS::Heat::MultipartMime @@ -1028,6 +1114,20 @@ resources: - path: /opt/mr_install.sh permissions: '0755' content: { get_file: cloud-config/mr_install.sh } + - path: /opt/mr_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/mr_vm_init.sh } + - path: /opt/dbcl_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/dbcl_vm_init.sh } + - path: /etc/init.d/mr_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: mr_vm_init.sh + template: + get_file: cloud-config/serv.sh mrouter_vm_config: type: OS::Heat::MultipartMime @@ -1092,6 +1192,17 @@ resources: - path: /opt/robot_install.sh permissions: '0755' content: { get_file: cloud-config/robot_install.sh } + - path: /opt/robot_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/robot_vm_init.sh } + - path: /etc/init.d/robot_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: robot_vm_init.sh + template: + get_file: cloud-config/serv.sh robot_vm_config: type: OS::Heat::MultipartMime @@ -1232,6 +1343,17 @@ resources: - path: /opt/vid_install.sh permissions: '0755' content: { get_file: cloud-config/vid_install.sh } + - path: /opt/vid_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/vid_vm_init.sh } + - path: /etc/init.d/vid_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: vid_vm_init.sh + template: + get_file: cloud-config/serv.sh vid_vm_config: type: OS::Heat::MultipartMime @@ -1296,6 +1418,17 @@ resources: - path: /opt/sdnc_install.sh permissions: '0755' content: { get_file: cloud-config/sdnc_install.sh } + - path: /opt/sdnc_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/sdnc_vm_init.sh } + - path: /etc/init.d/sdnc_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: sdnc_vm_init.sh + template: + get_file: cloud-config/serv.sh sdnc_vm_config: type: OS::Heat::MultipartMime @@ -1371,6 +1504,20 @@ resources: - path: /opt/sdc_install.sh permissions: '0755' content: { get_file: cloud-config/sdc_install.sh } + - path: /opt/sdc_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/sdc_vm_init.sh } + - path: /opt/sdc_wfd_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/sdc_wfd_vm_init.sh } + - path: /etc/init.d/sdc_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: sdc_vm_init.sh + template: + get_file: cloud-config/serv.sh sdc_vm_config: type: OS::Heat::MultipartMime @@ -1443,6 +1590,17 @@ resources: - path: /opt/portal_install.sh permissions: '0755' content: { get_file: cloud-config/portal_install.sh } + - path: /opt/portal_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/portal_vm_init.sh } + - path: /etc/init.d/portal_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: portal_vm_init.sh + template: + get_file: cloud-config/serv.sh portal_vm_config: type: OS::Heat::MultipartMime @@ -1511,6 +1669,17 @@ resources: - path: /opt/policy_install.sh permissions: '0755' content: { get_file: cloud-config/policy_install.sh } + - path: /opt/policy_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/policy_vm_init.sh } + - path: /etc/init.d/policy_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: policy_vm_init.sh + template: + get_file: cloud-config/serv.sh policy_vm_config: type: OS::Heat::MultipartMime @@ -1577,6 +1746,17 @@ resources: - path: /opt/appc_install.sh permissions: '0755' content: { get_file: cloud-config/appc_install.sh } + - path: /opt/appc_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/appc_vm_init.sh } + - path: /etc/init.d/appc_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: appc_vm_init.sh + template: + get_file: cloud-config/serv.sh appc_vm_config: type: OS::Heat::MultipartMime @@ -1645,6 +1825,17 @@ resources: - path: /opt/clamp_install.sh permissions: '0755' content: { get_file: cloud-config/clamp_install.sh } + - path: /opt/clamp_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/clamp_vm_init.sh } + - path: /etc/init.d/clamp_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: clamp_vm_init.sh + template: + get_file: cloud-config/serv.sh clamp_vm_config: type: OS::Heat::MultipartMime @@ -1714,6 +1905,17 @@ resources: - path: /opt/openo_install.sh permissions: '0755' content: { get_file: cloud-config/openo_install.sh } + - path: /opt/cli_install.sh + permissions: '0755' + content: { get_file: cloud-config/cli_install.sh } + - path: /etc/init.d/openo_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: openo_all_serv.sh + template: + get_file: cloud-config/serv.sh openo_vm_config: type: OS::Heat::MultipartMime @@ -1855,6 +2057,14 @@ resources: - path: /opt/dcae2_install.sh permissions: '0755' content: { get_file: cloud-config/dcae2_install.sh } + - path: /etc/init.d/dcae2_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: dcae2_vm_init.sh + template: + get_file: cloud-config/serv.sh dcae_c_vm_config: type: OS::Heat::MultipartMime @@ -2023,7 +2233,7 @@ resources: echo "__holmes_rm_docker__" > /opt/config/holmes_docker_rm.txt cd /opt - ./dcae2_install.sh > /tmp/dcae2_install.log 2>&1 + ./dcae2_install.sh 2>&1 | tee -a /tmp/dcae2_install.log # MUSIC instantiation @@ -2065,6 +2275,17 @@ resources: - path: /opt/music_install.sh permissions: '0755' content: { get_file: cloud-config/music_install.sh } + - path: /opt/music_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/music_vm_init.sh } + - path: /etc/init.d/music_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: music_vm_init.sh + template: + get_file: cloud-config/serv.sh music_vm_config: type: OS::Heat::MultipartMime @@ -2129,6 +2350,17 @@ resources: - path: /opt/oof_install.sh permissions: '0755' content: { get_file: cloud-config/oof_install.sh } + - path: /opt/oof_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/oof_vm_init.sh } + - path: /etc/init.d/oof_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: oof_vm_init.sh + template: + get_file: cloud-config/serv.sh oof_vm_config: type: OS::Heat::MultipartMime @@ -2199,6 +2431,17 @@ resources: - path: /opt/aaf_install.sh permissions: '0755' content: { get_file: cloud-config/aaf_install.sh } + - path: /opt/aaf_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/aaf_vm_init.sh } + - path: /etc/init.d/aaf_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: aaf_vm_init.sh + template: + get_file: cloud-config/serv.sh aaf_vm_config: type: OS::Heat::MultipartMime @@ -2265,6 +2508,17 @@ resources: - path: /opt/sms_install.sh permissions: '0755' content: { get_file: cloud-config/sms_install.sh } + - path: /opt/sms_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/sms_vm_init.sh } + - path: /etc/init.d/sms_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: sms_vm_init.sh + template: + get_file: cloud-config/serv.sh sms_vm_config: type: OS::Heat::MultipartMime @@ -2331,6 +2585,17 @@ resources: - path: /opt/nbi_install.sh permissions: '0755' content: { get_file: cloud-config/nbi_install.sh } + - path: /opt/nbi_vm_init.sh + permissions: '0755' + content: { get_file: cloud-config/nbi_vm_init.sh } + - path: /etc/init.d/nbi_serv.sh + permissions: '0755' + content: + str_replace: + params: + __vm_init_script__: nbi_vm_init.sh + template: + get_file: cloud-config/serv.sh nbi_vm_config: type: OS::Heat::MultipartMime |