blob: 4b11c19c97116a58ba67172f180af7af2cc8e77a [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
19# This script assumes the following repos exist
20# ~/cord/automation-tools
21
22# Location of 'cord' directory for checkouts on the local system
23CORDDIR="${CORDDIR:-${HOME}/cord}"
24
25[ ! -d "$CORDDIR" ] && mkdir -p "$CORDDIR"
26[ ! -d "$CORDDIR"/automation-tools ] && cd "$CORDDIR" && git clone https://gerrit.opencord.org/automation-tools
27[ ! -d "$CORDDIR"/helm-charts ] && cd "$CORDDIR" && git clone https://gerrit.opencord.org/helm-charts
28
29
30# Install K8S, Helm, Openstack
31"$CORDDIR"/automation-tools/openstack-helm/openstack-helm-dev-setup.sh
32
33
34# VTN requirements
35POD=$( kubectl get pod --namespace openstack|grep openvswitch-db|awk '{print $1}' )
36kubectl --namespace openstack exec "$POD" \
37 -- ovs-appctl -t ovsdb-server ovsdb-server/add-remote ptcp:6641
38
39# Add keys for VTN
40[ ! -e ~/.ssh/id_rsa ] && ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ""
41cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
42cp ~/.ssh/id_rsa "$CORDDIR"/helm-charts/xos-profiles/base-openstack/files/node_key
43
44# Add dummy fabric interface
45sudo modprobe dummy
46sudo ip link set name fabric dev dummy0
47sudo ifconfig fabric up
48
49
50# Install charts for M-CORD
51cd "$CORDDIR"/helm-charts
52helm dep update ./xos-core
53helm upgrade --install xos-core ./xos-core
54~/openstack-helm/tools/deployment/common/wait-for-pods.sh default
55
56helm dep update ./xos-profiles/base-openstack
57helm upgrade --install base-openstack ./xos-profiles/base-openstack \
58 --set computeNodes.master.name="$( hostname )" \
59 --set vtn-service.sshUser="$( whoami )"
60~/openstack-helm/tools/deployment/common/wait-for-pods.sh default
61
62helm upgrade --install onos-cord ./onos
63~/openstack-helm/tools/deployment/common/wait-for-pods.sh default
64
65helm dep update ./xos-profiles/mcord
66helm upgrade --install mcord ./xos-profiles/mcord \
67 --set global.proxySshUser="$( whoami )"
68~/openstack-helm/tools/deployment/common/wait-for-pods.sh default
69
70
71# Firewall VNC ports for security
72sudo ufw default allow incoming
73sudo ufw default allow outgoing
74sudo ufw default allow routed
75sudo ufw deny proto tcp from any to any port 5900:5950 comment 'vnc'
76sudo ufw --force enable
77
78
79echo "M-CORD has been successfully installed"