Andy Bavier | facd0be | 2018-05-24 15:56:31 -0700 | [diff] [blame^] | 1 | #!/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 | |
| 17 | set -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 |
| 23 | CORDDIR="${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 |
| 35 | POD=$( kubectl get pod --namespace openstack|grep openvswitch-db|awk '{print $1}' ) |
| 36 | kubectl --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 "" |
| 41 | cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys |
| 42 | cp ~/.ssh/id_rsa "$CORDDIR"/helm-charts/xos-profiles/base-openstack/files/node_key |
| 43 | |
| 44 | # Add dummy fabric interface |
| 45 | sudo modprobe dummy |
| 46 | sudo ip link set name fabric dev dummy0 |
| 47 | sudo ifconfig fabric up |
| 48 | |
| 49 | |
| 50 | # Install charts for M-CORD |
| 51 | cd "$CORDDIR"/helm-charts |
| 52 | helm dep update ./xos-core |
| 53 | helm upgrade --install xos-core ./xos-core |
| 54 | ~/openstack-helm/tools/deployment/common/wait-for-pods.sh default |
| 55 | |
| 56 | helm dep update ./xos-profiles/base-openstack |
| 57 | helm 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 | |
| 62 | helm upgrade --install onos-cord ./onos |
| 63 | ~/openstack-helm/tools/deployment/common/wait-for-pods.sh default |
| 64 | |
| 65 | helm dep update ./xos-profiles/mcord |
| 66 | helm 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 |
| 72 | sudo ufw default allow incoming |
| 73 | sudo ufw default allow outgoing |
| 74 | sudo ufw default allow routed |
| 75 | sudo ufw deny proto tcp from any to any port 5900:5950 comment 'vnc' |
| 76 | sudo ufw --force enable |
| 77 | |
| 78 | |
| 79 | echo "M-CORD has been successfully installed" |