blob: 8b979e1b14c3393e0251d7e178522e3a9b67da54 [file] [log] [blame]
Andy Bavierfacd0be2018-05-24 15:56:31 -07001#!/bin/bash
2#
3# Copyright 2017-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17set -xe
18
Andy Bavier49ec1a02018-06-18 14:03:29 -070019# This script assumes the following repos exist and will create them if not
Andy Bavierfacd0be2018-05-24 15:56:31 -070020# ~/cord/automation-tools
Andy Bavier49ec1a02018-06-18 14:03:29 -070021# ~/cord/helm-charts
22
23# Sanity tests
24if [[ $UID == 0 ]]; then
25 echo "Please run this script as non-root user"
26 exit 1
27fi
28
29if ! sudo -n true; then
30 echo "Please configure passwordless sudo on this account"
31 exit 1
32fi
33
34
Andy Bavierfacd0be2018-05-24 15:56:31 -070035
36# Location of 'cord' directory for checkouts on the local system
37CORDDIR="${CORDDIR:-${HOME}/cord}"
38
39[ ! -d "$CORDDIR" ] && mkdir -p "$CORDDIR"
40[ ! -d "$CORDDIR"/automation-tools ] && cd "$CORDDIR" && git clone https://gerrit.opencord.org/automation-tools
41[ ! -d "$CORDDIR"/helm-charts ] && cd "$CORDDIR" && git clone https://gerrit.opencord.org/helm-charts
42
43
44# Install K8S, Helm, Openstack
45"$CORDDIR"/automation-tools/openstack-helm/openstack-helm-dev-setup.sh
46
47
Andy Bavierfacd0be2018-05-24 15:56:31 -070048# Add keys for VTN
49[ ! -e ~/.ssh/id_rsa ] && ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ""
50cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
51cp ~/.ssh/id_rsa "$CORDDIR"/helm-charts/xos-profiles/base-openstack/files/node_key
52
53# Add dummy fabric interface
Andy Bavier99588852018-06-05 12:59:51 -070054if ! ifconfig fabric &>> /dev/null
55then
56 sudo modprobe dummy
57 sudo ip link set name fabric dev dummy0
58 sudo ifconfig fabric up
59fi
Andy Bavierfacd0be2018-05-24 15:56:31 -070060
61# Install charts for M-CORD
62cd "$CORDDIR"/helm-charts
Andy Bavier306279b2018-06-26 10:09:31 -070063sudo mkdir -p /var/local/vol1
64helm upgrade --install local-persistent-volume ./local-persistent-volume \
65 --set volumeHostName="$( hostname -f )"
66
Andy Bavierfacd0be2018-05-24 15:56:31 -070067helm dep update ./xos-core
Andy Bavier49ec1a02018-06-18 14:03:29 -070068helm upgrade --install xos-core ./xos-core \
Andy Bavier306279b2018-06-26 10:09:31 -070069 --set xos-gui.xos_projectName="M-CORD" \
70 --set needDBPersistence=true
Andy Bavierfacd0be2018-05-24 15:56:31 -070071~/openstack-helm/tools/deployment/common/wait-for-pods.sh default
72
73helm dep update ./xos-profiles/base-openstack
74helm upgrade --install base-openstack ./xos-profiles/base-openstack \
75 --set computeNodes.master.name="$( hostname )" \
76 --set vtn-service.sshUser="$( whoami )"
77~/openstack-helm/tools/deployment/common/wait-for-pods.sh default
78
79helm upgrade --install onos-cord ./onos
80~/openstack-helm/tools/deployment/common/wait-for-pods.sh default
81
82helm dep update ./xos-profiles/mcord
83helm upgrade --install mcord ./xos-profiles/mcord \
84 --set global.proxySshUser="$( whoami )"
85~/openstack-helm/tools/deployment/common/wait-for-pods.sh default
86
87
Andy Bavier99588852018-06-05 12:59:51 -070088# Firewall VNC ports for security (CloudLab)
89if [ -d /mnt/extra ]
90then
91 sudo ufw default allow incoming
92 sudo ufw default allow outgoing
93 sudo ufw default allow routed
94 sudo ufw deny proto tcp from any to any port 5900:5950 comment 'vnc'
95 sudo ufw --force enable
96fi
Andy Bavierfacd0be2018-05-24 15:56:31 -070097
98echo "M-CORD has been successfully installed"