diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2018-08-02 12:04:01 -0700 |
---|---|---|
committer | Gary Wu <gary.i.wu@huawei.com> | 2018-08-02 14:10:08 -0700 |
commit | 16509432a21feb3f90bbf954ec4815c2bf7f0033 (patch) | |
tree | f41f14f1102c7eeddbf3c0509bf9d69ce18818e4 /heat/ONAP/cloud-config | |
parent | 3ddd88cf4cb92f5b8e0eebca9afe806f96a09fba (diff) |
Refactor ONAP HEAT template config scripts
Change-Id: I5f95acc7c67d48ea1f7f9e819d6c9e742e4b52cc
Issue-ID: INT-605
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'heat/ONAP/cloud-config')
20 files changed, 2178 insertions, 0 deletions
diff --git a/heat/ONAP/cloud-config/aaf_install.sh b/heat/ONAP/cloud-config/aaf_install.sh new file mode 100644 index 00000000..171592ce --- /dev/null +++ b/heat/ONAP/cloud-config/aaf_install.sh @@ -0,0 +1,502 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +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 + +# 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO +chmod +x /opt/authz/auth/auth-cass/docker/dinstall.sh +chmod +x /opt/authz/auth/auth-cass/docker/backup/backup.sh +chmod +x /opt/authz/auth/docker/dbuild.sh +chmod +x /opt/authz/auth/docker/drun.sh +chmod +x /opt/authz/auth/docker/dstart.sh +chmod +x /opt/authz/auth/docker/dstop.sh + +#Update maven settings +cat > /usr/share/maven/conf/settings.xml << EOF +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<!-- + | This is the configuration file for Maven. It can be specified at two levels: + | + | 1. User Level. This settings.xml file provides configuration for a single user, +| and is normally provided in \${user.home}/.m2/settings.xml. + | + | NOTE: This location can be overridden with the CLI option: + | + | -s /path/to/user/settings.xml + | + | 2. Global Level. This settings.xml file provides configuration for all Maven + | users on a machine (assuming they're all using the same Maven + | installation). It's normally provided in +| \${maven.home}/conf/settings.xml. + | + | NOTE: This location can be overridden with the CLI option: + | + | -gs /path/to/global/settings.xml + | + | The sections in this sample file are intended to give you a running start at + | getting the most out of your Maven installation. Where appropriate, the default + | values (values used when the setting is not specified) are provided. + | + |--> +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> + <!-- localRepository + | The path to the local repository maven will use to store artifacts. + | +| Default: \${user.home}/.m2/repository + <localRepository>/path/to/local/repo</localRepository> + --> + + <!-- interactiveMode + | This will determine whether maven prompts you when it needs input. If set to false, + | maven will use a sensible default value, perhaps based on some other setting, for + | the parameter in question. + | + | Default: true + <interactiveMode>true</interactiveMode> + --> + + <!-- offline + | Determines whether maven should attempt to connect to the network when executing a build. + | This will have an effect on artifact downloads, artifact deployment, and others. + | + | Default: false + <offline>false</offline> + --> + + <!-- pluginGroups + | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e. + | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers + | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list. + |--> + <pluginGroups> + <!-- pluginGroup + | Specifies a further group identifier to use for plugin lookup. + <pluginGroup>com.your.plugins</pluginGroup> + --> + </pluginGroups> + + <!-- proxies + | This is a list of proxies which can be used on this machine to connect to the network. + | Unless otherwise specified (by system property or command-line switch), the first proxy + | specification in this list marked as active will be used. + |--> + <proxies> + <proxy> + <id>optional</id> + <active>true</active> + <protocol>http</protocol> + <username>proxyuser</username> + <password>proxypass</password> + <host>$(cat /opt/config/http_proxy.txt | cut -d ':' -f1)</host> + <port>$(cat /opt/config/http_proxy.txt | cut -d ':' -f2)</port> + <nonProxyHosts>local.net|some.host.com</nonProxyHosts> + </proxy> + <proxy> + <id>optional</id> + <active>true</active> + <protocol>https</protocol> + <username>proxyuser</username> + <password>proxypass</password> + <host>$(cat /opt/config/https_proxy.txt | cut -d ':' -f1)</host> + <port>$(cat /opt/config/https_proxy.txt | cut -d ':' -f2)</port> + <nonProxyHosts>local.net|some.host.com</nonProxyHosts> + </proxy> + </proxies> + + + <!-- servers + | This is a list of authentication profiles, keyed by the server-id used within the system. + | Authentication profiles can be used whenever maven must make a connection to a remote server. + |--> + <servers> + <!-- server + | Specifies the authentication information to use when connecting to a particular server, identified by + | a unique name within the system (referred to by the 'id' attribute below). + | + | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are + | used together. + | + <server> + <id>deploymentRepo</id> + <username>repouser</username> + <password>repopwd</password> + </server> + --> + + <!-- Another sample, using keys to authenticate. + <server> + <id>siteServer</id> + <privateKey>/path/to/private/key</privateKey> + <passphrase>optional; leave empty if not used.</passphrase> + </server> + --> + </servers> + + <!-- mirrors + | This is a list of mirrors to be used in downloading artifacts from remote repositories. + | + | It works like this: a POM may declare a repository to use in resolving certain artifacts. + | However, this repository may have problems with heavy traffic at times, so people have mirrored + | it to several places. + | + | That repository definition will have a unique id, so we can create a mirror reference for that + | repository, to be used as an alternate download site. The mirror site will be the preferred + | server for that repository. + |--> + + <!-- profiles + | This is a list of profiles which can be activated in a variety of ways, and which can modify + | the build process. Profiles provided in the settings.xml are intended to provide local machine- + | specific paths and repository locations which allow the build to work in the local environment. + | + | For example, if you have an integration testing plugin - like cactus - that needs to know where + | your Tomcat instance is installed, you can provide a variable here such that the variable is + | dereferenced during the build process to configure the cactus plugin. + | + | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles + | section of this document (settings.xml) - will be discussed later. Another way essentially + | relies on the detection of a system property, either matching a particular value for the property, + | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a + | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'. + | Finally, the list of active profiles can be specified directly from the command line. + | + | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact + | repositories, plugin repositories, and free-form properties to be used as configuration + | variables for plugins in the POM. + | + |--> + + + + + + <profiles> + <profile> + + <id>10_nexus</id> + <!--Enable snapshots for the built in central repo to direct --> + <!--all requests to nexus via the mirror --> + <repositories> + <repository> + <id>10_nexus</id> + <url>http://repo.maven.apache.org/maven2/</url> + <releases><enabled>true</enabled></releases> + <snapshots><enabled>true</enabled></snapshots> + </repository> + </repositories> + + <pluginRepositories> + <pluginRepository> + <id>10_nexus</id> + <url>http://repo.maven.apache.org/maven2/</url> + <releases><enabled>true</enabled></releases> + <snapshots><enabled>true</enabled></snapshots> + </pluginRepository> + </pluginRepositories> + + </profile> + <profile> + <id>20_openecomp-public</id> + <repositories> + <repository> + <id>20_openecomp-public</id> + <name>20_openecomp-public</name> + <url>https://nexus.onap.org/content/repositories/public/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>20_openecomp-public</id> + <name>20_openecomp-public</name> + <url>https://nexus.onap.org/content/repositories/public/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + <profile> + <id>30_openecomp-staging</id> + <repositories> + <repository> + <id>30_openecomp-staging</id> + <name>30_openecomp-staging</name> + <url>https://nexus.onap.org/content/repositories/staging/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>30_openecomp-staging</id> + <name>30_openecomp-staging</name> + <url>https://nexus.onap.org/content/repositories/staging/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + <profile> + <id>40_openecomp-release</id> + <repositories> + <repository> + <id>40_openecomp-release</id> + <name>40_openecomp-release</name> + <url>https://nexus.onap.org/content/repositories/releases/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>40_openecomp-release</id> + <name>40_openecomp-release</name> + <url>https://nexus.onap.org/content/repositories/releases/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + + <profile> + <id>50_openecomp-snapshots</id> + <repositories> + <repository> + <id>50_openecomp-snapshot</id> + <name>50_openecomp-snapshot</name> + <url>https://nexus.onap.org/content/repositories/snapshots/</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>50_openecomp-snapshot</id> + <name>50_openecomp-snapshot</name> + <url>https://nexus.onap.org/content/repositories/snapshots/</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + <profile> + <id>60_opendaylight-release</id> + <repositories> + <repository> + <id>60_opendaylight-mirror</id> + <name>60_opendaylight-mirror</name> + <url>https://nexus.opendaylight.org/content/repositories/public/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>60_opendaylight-mirror</id> + <name>60_opendaylight-mirror</name> + <url>https://nexus.opendaylight.org/content/repositories/public/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>daily</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + + <profile> + <id>70_opendaylight-snapshots</id> + <repositories> + <repository> + <id>70_opendaylight-snapshot</id> + <name>70_opendaylight-snapshot</name> + <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>70_opendaylight-snapshot</id> + <name>70_opendaylight-snapshot</name> + <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + </profiles> + + <activeProfiles> + <activeProfile>10_nexus</activeProfile> + <activeProfile>20_openecomp-public</activeProfile> + <activeProfile>30_openecomp-staging</activeProfile> + <activeProfile>40_openecomp-release</activeProfile> + <activeProfile>50_openecomp-snapshots</activeProfile> + <activeProfile>60_opendaylight-release</activeProfile> + <activeProfile>70_opendaylight-snapshots</activeProfile> + + </activeProfiles> + +</settings> +EOF + +cd /opt/authz +mvn install -Dmaven.test.skip=true + +cd /opt +./aaf_vm_init.sh diff --git a/heat/ONAP/cloud-config/aai_install.sh b/heat/ONAP/cloud-config/aai_install.sh new file mode 100644 index 00000000..b238fd6e --- /dev/null +++ b/heat/ONAP/cloud-config/aai_install.sh @@ -0,0 +1,97 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO + +if [[ $AAI_INSTANCE == "aai_instance_1" ]] +then + mkdir -p /opt/aai/logroot/AAI-RESOURCES + mkdir -p /opt/aai/logroot/AAI-TRAVERSAL + mkdir -p /opt/aai/logroot/AAI-ML + mkdir -p /opt/aai/logroot/AAI-SDB + mkdir -p /opt/aai/logroot/AAI-DRMS + mkdir -p /opt/aai/logroot/AAI-UI + chown -R 999:999 /opt/aai/logroot/AAI-RESOURCES /opt/aai/logroot/AAI-TRAVERSAL + + sleep 300 +fi + +./aai_vm_init.sh
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/appc_install.sh b/heat/ONAP/cloud-config/appc_install.sh new file mode 100644 index 00000000..e871bfc1 --- /dev/null +++ b/heat/ONAP/cloud-config/appc_install.sh @@ -0,0 +1,82 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO appc +./appc_vm_init.sh
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/clamp_install.sh b/heat/ONAP/cloud-config/clamp_install.sh new file mode 100644 index 00000000..ffe4d14e --- /dev/null +++ b/heat/ONAP/cloud-config/clamp_install.sh @@ -0,0 +1,82 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO +./clamp_vm_init.sh diff --git a/heat/ONAP/cloud-config/cli_install.sh b/heat/ONAP/cloud-config/cli_install.sh new file mode 100644 index 00000000..4593c686 --- /dev/null +++ b/heat/ONAP/cloud-config/cli_install.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +#******************************************************************************* +# Copyright 2017 Huawei Technologies Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#******************************************************************************* + +CLI_LATEST_BINARY="https://nexus.onap.org/content/repositories/releases/org/onap/cli/cli-zip/1.1.0/cli-zip-1.1.0.zip" +CLI_INSTALL_DIR=/opt/onap/cli +CLI_ZIP=cli.zip +CLI_BIN=/usr/bin/onap +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 + +export ONAP_CLI_HOME=$CLI_INSTALL_DIR +export CLI_PRODUCT_VERSION=onap-1.1 + +#create install dir +if [ -d $CLI_INSTALL_DIR ] +then + mv $CLI_INSTALL_DIR $CLI_INSTALL_DIR/../cli_`date +"%m-%d-%y-%H-%M-%S"` + rm $CLI_BIN +fi + +mkdir -p $CLI_INSTALL_DIR +cd $CLI_INSTALL_DIR + +#Download and unzip CLI +apt-get install -y wget unzip + +#check for java +java -version +if [ $? == 127 ] +then + apt-get install -y openjdk-8-jre +fi + +wget -O $CLI_ZIP $CLI_LATEST_BINARY + +unzip $CLI_ZIP +if [ ! -d ./data ]; then mkdir ./data; fi +if [ ! -d ./onap-cli-schema ]; then mkdir ./onap-cli-schema; fi +chmod +x ./bin/onap.sh + +#Make onap available in path +ln ./bin/onap.sh $CLI_BIN + +#Print the version +onap -v + +cd - diff --git a/heat/ONAP/cloud-config/dcae2_install.sh b/heat/ONAP/cloud-config/dcae2_install.sh new file mode 100755 index 00000000..d0f5fd6e --- /dev/null +++ b/heat/ONAP/cloud-config/dcae2_install.sh @@ -0,0 +1,115 @@ +#!/bin/bash +############################################################################# +# +# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +############################################################################# + +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) +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 + +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 + +# 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 +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 +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 + +# add hostname aliases +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 + +# private key +sed -e 's/\\n/\n/g' /opt/config/priv_key | sed -e 's/^[ \t]*//g; s/[ \t]*$//g' > /opt/app/config/key +chmod 777 /opt/app/config/key + +cd /opt +./dcae2_vm_init.sh diff --git a/heat/ONAP/cloud-config/dns_install.sh b/heat/ONAP/cloud-config/dns_install.sh new file mode 100644 index 00000000..1f940ac3 --- /dev/null +++ b/heat/ONAP/cloud-config/dns_install.sh @@ -0,0 +1,99 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + export https_proxy=$HTTPS_PROXY +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" +else + 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 + +# 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 + +# Set the private IP address of each ONAP VM in the Bind configuration in OpenStack deployments +if [[ $CLOUD_ENV != "rackspace" ]] +then + sed -i "s/dns_forwarder/"$(cat /opt/config/dns_forwarder.txt)"/g" /etc/bind/named.conf.options + sed -i "s/dns_ip_addr/"$(cat /opt/config/dns_ip_addr.txt)"/g" /etc/bind/named.conf.options + sed -i "s/external_dns/"$(cat /opt/config/external_dns.txt)"/g" /etc/bind/named.conf.options + sed -i "s/aai1_ip_addr/"$(cat /opt/config/aai1_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/aai2_ip_addr/"$(cat /opt/config/aai2_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/appc_ip_addr/"$(cat /opt/config/appc_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/dcae_ip_addr/"$(cat /opt/config/dcae_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/dns_ip_addr/"$(cat /opt/config/dns_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/so_ip_addr/"$(cat /opt/config/so_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/mr_ip_addr/"$(cat /opt/config/mr_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/policy_ip_addr/"$(cat /opt/config/policy_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/portal_ip_addr/"$(cat /opt/config/portal_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/robot_ip_addr/"$(cat /opt/config/robot_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/sdc_ip_addr/"$(cat /opt/config/sdc_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/sdnc_ip_addr/"$(cat /opt/config/sdnc_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/vid_ip_addr/"$(cat /opt/config/vid_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/clamp_ip_addr/"$(cat /opt/config/clamp_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/openo_ip_addr/"$(cat /opt/config/openo_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/music_ip_addr/"$(cat /opt/config/music_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/oof_ip_addr/"$(cat /opt/config/oof_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/aaf_ip_addr/"$(cat /opt/config/aaf_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/sms_ip_addr/"$(cat /opt/config/sms_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + sed -i "s/nbi_ip_addr/"$(cat /opt/config/nbi_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.openecomp.org + + sed -i "s/aai1_ip_addr/"$(cat /opt/config/aai1_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/aai2_ip_addr/"$(cat /opt/config/aai2_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/appc_ip_addr/"$(cat /opt/config/appc_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/dcae_ip_addr/"$(cat /opt/config/dcae_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/dns_ip_addr/"$(cat /opt/config/dns_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/so_ip_addr/"$(cat /opt/config/so_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/mr_ip_addr/"$(cat /opt/config/mr_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/policy_ip_addr/"$(cat /opt/config/policy_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/portal_ip_addr/"$(cat /opt/config/portal_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/robot_ip_addr/"$(cat /opt/config/robot_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/sdc_ip_addr/"$(cat /opt/config/sdc_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/sdnc_ip_addr/"$(cat /opt/config/sdnc_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/vid_ip_addr/"$(cat /opt/config/vid_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/clamp_ip_addr/"$(cat /opt/config/clamp_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/openo_ip_addr/"$(cat /opt/config/openo_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/music_ip_addr/"$(cat /opt/config/music_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/oof_ip_addr/"$(cat /opt/config/oof_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/aaf_ip_addr/"$(cat /opt/config/aaf_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/sms_ip_addr/"$(cat /opt/config/sms_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org + sed -i "s/nbi_ip_addr/"$(cat /opt/config/nbi_ip_addr.txt)"/g" /etc/bind/zones/db.simpledemo.onap.org +fi + +# Configure Bind +modprobe ip_gre +sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9 +service bind9 restart + diff --git a/heat/ONAP/cloud-config/mr_install.sh b/heat/ONAP/cloud-config/mr_install.sh new file mode 100644 index 00000000..b7573589 --- /dev/null +++ b/heat/ONAP/cloud-config/mr_install.sh @@ -0,0 +1,87 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO /opt/startup-vm-message-router +./mr_vm_init.sh diff --git a/heat/ONAP/cloud-config/music_install.sh b/heat/ONAP/cloud-config/music_install.sh new file mode 100644 index 00000000..84ba5629 --- /dev/null +++ b/heat/ONAP/cloud-config/music_install.sh @@ -0,0 +1,82 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO +./music_vm_init.sh
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/nbi_install.sh b/heat/ONAP/cloud-config/nbi_install.sh new file mode 100644 index 00000000..7705a25a --- /dev/null +++ b/heat/ONAP/cloud-config/nbi_install.sh @@ -0,0 +1,83 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +./nbi_vm_init.sh diff --git a/heat/ONAP/cloud-config/oof_install.sh b/heat/ONAP/cloud-config/oof_install.sh new file mode 100644 index 00000000..d8eda1de --- /dev/null +++ b/heat/ONAP/cloud-config/oof_install.sh @@ -0,0 +1,82 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO optf-has +./oof_vm_init.sh
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/openo_install.sh b/heat/ONAP/cloud-config/openo_install.sh new file mode 100644 index 00000000..57e00949 --- /dev/null +++ b/heat/ONAP/cloud-config/openo_install.sh @@ -0,0 +1,97 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 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 +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 diff --git a/heat/ONAP/cloud-config/policy_install.sh b/heat/ONAP/cloud-config/policy_install.sh new file mode 100644 index 00000000..c77323d1 --- /dev/null +++ b/heat/ONAP/cloud-config/policy_install.sh @@ -0,0 +1,82 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO policy +./policy_vm_init.sh
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/portal_install.sh b/heat/ONAP/cloud-config/portal_install.sh new file mode 100644 index 00000000..d052d655 --- /dev/null +++ b/heat/ONAP/cloud-config/portal_install.sh @@ -0,0 +1,82 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO +./portal_vm_init.sh diff --git a/heat/ONAP/cloud-config/robot_install.sh b/heat/ONAP/cloud-config/robot_install.sh new file mode 100644 index 00000000..7896ecde --- /dev/null +++ b/heat/ONAP/cloud-config/robot_install.sh @@ -0,0 +1,89 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + export https_proxy=$HTTPS_PROXY +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 +chmod +x /opt/eteshare/config/vm_config2robot.sh +unzip -p -j /opt/boot-$ARTIFACTS_VERSION.zip 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 +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/sdc_install.sh b/heat/ONAP/cloud-config/sdc_install.sh new file mode 100644 index 00000000..55963734 --- /dev/null +++ b/heat/ONAP/cloud-config/sdc_install.sh @@ -0,0 +1,117 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 + +if [[ $CLOUD_ENV == "rackspace" ]] +then + DISK="xvdb" +else + 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 +mkfs -t ext4 /dev/$DISK"1" +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 +mkdir -p /data/environments +mkdir -p /data/scripts +mkdir -p /data/logs/BE +mkdir -p /data/logs/FE +chmod 777 /data +chmod 777 /data/logs/BE +chmod 777 /data/logs/FE + +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO + +cat > /root/.bash_aliases << EOF +alias dcls='/data/scripts/docker_clean.sh \$1' +alias dlog='/data/scripts/docker_login.sh \$1' +alias rund='/data/scripts/docker_run.sh' +alias health='/data/scripts/docker_health.sh' +EOF + +# Run docker containers. For openstack Ubuntu 16.04 images this will run as a service after the VM has restarted +./sdc_vm_init.sh +./sdc_wfd_vm_init.sh diff --git a/heat/ONAP/cloud-config/sdnc_install.sh b/heat/ONAP/cloud-config/sdnc_install.sh new file mode 100644 index 00000000..2c82eea5 --- /dev/null +++ b/heat/ONAP/cloud-config/sdnc_install.sh @@ -0,0 +1,82 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO sdnc +./sdnc_vm_init.sh
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/sms_install.sh b/heat/ONAP/cloud-config/sms_install.sh new file mode 100644 index 00000000..bdd3a630 --- /dev/null +++ b/heat/ONAP/cloud-config/sms_install.sh @@ -0,0 +1,82 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO +./sms_vm_init.sh
\ No newline at end of file diff --git a/heat/ONAP/cloud-config/so_install.sh b/heat/ONAP/cloud-config/so_install.sh new file mode 100644 index 00000000..e47a73f2 --- /dev/null +++ b/heat/ONAP/cloud-config/so_install.sh @@ -0,0 +1,86 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO test_lab +SO_ENCRYPTION_KEY=$(cat /opt/test_lab/encryption.key) +echo -n "$OPENSTACK_API_KEY" | openssl aes-128-ecb -e -K $SO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt + +./so_vm_init.sh diff --git a/heat/ONAP/cloud-config/vid_install.sh b/heat/ONAP/cloud-config/vid_install.sh new file mode 100644 index 00000000..2f36e9f0 --- /dev/null +++ b/heat/ONAP/cloud-config/vid_install.sh @@ -0,0 +1,82 @@ +#!/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) + +if [ $HTTP_PROXY != "no_proxy" ] +then + export http_proxy=$HTTP_PROXY + 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 +git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO +./vid_vm_init.sh
\ No newline at end of file |