diff options
author | 2017-01-10 16:11:55 +0800 | |
---|---|---|
committer | 2017-01-25 17:34:08 +0800 | |
commit | 1eb8d4ccfbc9c34723586980d5a912e2ffa903cd (patch) | |
tree | b1764b819ef45ea93b5f263211a736748b7c57c4 /prepare.sh | |
parent | 495994be89cc04be704767ed3f6630c6663c11eb (diff) |
Opera deploy scripts
JIRA: OPERA-2
Requirement:
After compass4nfv deployment
Function:
1. Launch a VM (defaultly CentOS 7)
2. Launch Open-O dockers inside VM
3. Launch juju inside openstack
Directory conf/ need config according to local environment
Change-Id: Iac24051668e15b60f76f4819760f7b7c9b1867f3
Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'prepare.sh')
-rwxr-xr-x | prepare.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/prepare.sh b/prepare.sh new file mode 100755 index 0000000..1b07679 --- /dev/null +++ b/prepare.sh @@ -0,0 +1,53 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2016-2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +function generate_conf() +{ + rm -rf ${WORK_DIR}/scripts + mkdir -p ${WORK_DIR}/scripts + python ${OPERA_DIR}/process_conf.py ${CONF_DIR}/openo-vm.yml ${CONF_DIR}/network.yml +} + +function package_prepare() +{ + if [[ $(grep Ubuntu /etc/issue) ]]; then + sudo apt-get update -y + sudo apt-get install -y wget mkisofs qemu-utils qemu-kvm libvirt-bin openvswitch-switch python-pip sshpass figlet + else + # not test with redhat server yet + sudo yum update -y + sudo yum install -y wget mkisofs qemu-kvm libvirt-bin openvswitch-switch python-pip sshpass figlet + fi + service openvswitch-switch start +} + +function network_prepare() +{ + sudo ovs-vsctl list-br |grep br-external + br_exist=$? + external_nic=`ip route |grep '^default'|awk '{print $5F}'` + route_info=`ip route |grep -Eo '^default via [^ ]+'` + ip_info=`ip addr show $external_nic|grep -Eo '[^ ]+ brd [^ ]+ '` + if [ $br_exist -eq 0 ]; then + if [ "$external_nic" != "br-external" ]; then + sudo ovs-vsctl --may-exist add-port br-external $external_nic + sudo ip addr flush $external_nic + sudo ip addr add $ip_info dev br-external + sudo ip route add $route_info dev br-external + fi + else + sudo ovs-vsctl add-br br-external + sudo ifconfig br-external up + sudo ovs-vsctl add-port br-external $external_nic + sudo ip addr flush $external_nic + sudo ip addr add $ip_info dev br-external + sudo ip route add $route_info dev br-external + fi +} |