aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRene Robert <rene.robert@orange.com>2018-04-16 12:48:30 +0000
committerRene Robert <rene.robert@orange.com>2018-04-16 12:50:32 +0000
commitd0a28c37338215265449d013dbbdd96962334b00 (patch)
tree9782a63ffd7b9b9b9d723ad0a613dee65e1467a0
parentdc99e44fd343d7236bfa4c4d54f8444c421b0e72 (diff)
complete nbi install
Issue-ID: INT-456 Change-Id: I8a16fde4627f61af7556006fafc0dcbfd9a429cc Signed-off-by: Rene Robert <rene.robert@orange.com>
-rw-r--r--boot/nbi_install.sh18
-rw-r--r--boot/nbi_vm_init.sh16
-rw-r--r--heat/ONAP/onap_openstack.env2
-rw-r--r--heat/ONAP/onap_openstack.yaml9
-rw-r--r--heat/ONAP/onap_openstack_light.yaml9
5 files changed, 50 insertions, 4 deletions
diff --git a/boot/nbi_install.sh b/boot/nbi_install.sh
index c5f5ce4c..71546016 100644
--- a/boot/nbi_install.sh
+++ b/boot/nbi_install.sh
@@ -5,7 +5,9 @@ NEXUS_REPO=$(cat /opt/config/nexus_repo.txt)
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)
# Add host name to /etc/host to avoid warnings in openstack images
if [[ $CLOUD_ENV != "rackspace" ]]
@@ -60,7 +62,7 @@ mv /opt/nbi_serv.sh /etc/init.d
update-rc.d nbi_serv.sh defaults
# Download and install docker-engine and docker-compose
-echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | tee /etc/apt/sources.list.d/docker.list
+echo "deb https://apt.dockerproject.org/repo ubuntu-xenial 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
@@ -89,6 +91,18 @@ service docker restart
echo "nameserver "$DNS_IP_ADDR >> /etc/resolvconf/resolv.conf.d/head
resolvconf -u
-# Clone Gerrit repository and run docker containers
+# Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
+if [[ $CLOUD_ENV != "rackspace" ]]
+then
+ sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
+ grub-mkconfig -o /boot/grub/grub.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
+ sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
+ echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
+ echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic
+ reboot
+fi
+
+# Run docker containers
cd /opt
./nbi_vm_init.sh
diff --git a/boot/nbi_vm_init.sh b/boot/nbi_vm_init.sh
index f50c8986..45cce7c9 100644
--- a/boot/nbi_vm_init.sh
+++ b/boot/nbi_vm_init.sh
@@ -4,3 +4,19 @@ 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 docker-compose.yml
+cd /opt/nbi
+wget https://git.onap.org/externalapi/nbi/tree/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
+
+# Change the Clamp docker image name in the docker-compose.yml to match the one downloaded
+sed -i "/image: onap\/nbi/c\ image: $NEXUS_DOCKER_REPO\/onap\/nbi:$DOCKER_IMAGE_VERSION" docker-compose.yml
+
+# Start nbi, MariaDB and MongoDB containers with docker compose and nbi/docker-compose.yml
+/opt/docker/docker-compose up -d \ No newline at end of file
diff --git a/heat/ONAP/onap_openstack.env b/heat/ONAP/onap_openstack.env
index ccd67fe9..00bdeeec 100644
--- a/heat/ONAP/onap_openstack.env
+++ b/heat/ONAP/onap_openstack.env
@@ -133,6 +133,7 @@ parameters:
clamp_branch: master
vnfsdk_branch: master
music_branch: master
+ nbi_branch: master
aai_docker: 1.2-STAGING-latest
aai_sparky_docker: 1.2-STAGING-latest
@@ -204,3 +205,4 @@ parameters:
clamp_repo: http://gerrit.onap.org/r/clamp.git
vnfsdk_repo: http://gerrit.onap.org/r/vnfsdk/refrepo.git
music_repo: http://gerrit.onap.org/r/music.git
+ nbi_repo: http://gerrit.onap.org/r/externalapi/nbi.git
diff --git a/heat/ONAP/onap_openstack.yaml b/heat/ONAP/onap_openstack.yaml
index 5ee87b56..eba6d0d5 100644
--- a/heat/ONAP/onap_openstack.yaml
+++ b/heat/ONAP/onap_openstack.yaml
@@ -296,6 +296,8 @@ parameters:
type: string
music_repo:
type: string
+ nbi_repo:
+ type: string
################################
# #
@@ -418,7 +420,8 @@ parameters:
type: string
music_branch:
type: string
-
+ nbi_branch:
+ type: string
#############
# #
@@ -2077,6 +2080,8 @@ resources:
__artifacts_version__: { get_param: artifacts_version }
__dns_ip_addr__: { get_param: dns_ip_addr }
__docker_version__: { get_param: nbi_docker }
+ __nbi_repo__: { get_param: nbi_repo }
+ __gerrit_branch__: { get_param: nbi_branch }
__cloud_env__: { get_param: cloud_env }
__external_dns__: { get_param: external_dns }
template: |
@@ -2091,6 +2096,8 @@ resources:
echo "__artifacts_version__" > /opt/config/artifacts_version.txt
echo "__dns_ip_addr__" > /opt/config/dns_ip_addr.txt
echo "__docker_version__" > /opt/config/docker_version.txt
+ echo "__nbi_repo__" > /opt/config/remote_repo.txt
+ echo "__gerrit_branch__" > /opt/config/gerrit_branch.txt
echo "__cloud_env__" > /opt/config/cloud_env.txt
echo "__external_dns__" > /opt/config/external_dns.txt
diff --git a/heat/ONAP/onap_openstack_light.yaml b/heat/ONAP/onap_openstack_light.yaml
index 720b39d2..19819566 100644
--- a/heat/ONAP/onap_openstack_light.yaml
+++ b/heat/ONAP/onap_openstack_light.yaml
@@ -292,6 +292,8 @@ parameters:
type: string
music_repo:
type: string
+ nbi_repo:
+ type: string
################################
# #
@@ -412,7 +414,8 @@ parameters:
type: string
music_branch:
type: string
-
+ nbi_branch:
+ type: string
#############
# #
@@ -2065,6 +2068,8 @@ resources:
__artifacts_version__: { get_param: artifacts_version }
__dns_ip_addr__: { get_param: dns_ip_addr }
__docker_version__: { get_param: nbi_docker }
+ __nbi_repo__: { get_param: nbi_repo }
+ __gerrit_branch__: { get_param: nbi_branch }
__cloud_env__: { get_param: cloud_env }
__external_dns__: { get_param: external_dns }
template: |
@@ -2079,6 +2084,8 @@ resources:
echo "__artifacts_version__" > /opt/config/artifacts_version.txt
echo "__dns_ip_addr__" > /opt/config/dns_ip_addr.txt
echo "__docker_version__" > /opt/config/docker_version.txt
+ echo "__nbi_repo__" > /opt/config/remote_repo.txt
+ echo "__gerrit_branch__" > /opt/config/gerrit_branch.txt
echo "__cloud_env__" > /opt/config/cloud_env.txt
echo "__external_dns__" > /opt/config/external_dns.txt