blob: cd520ac4f9344a951d5339ac08e7e28acfc08787 [file] [log] [blame]
Joe Topjian4b6ce842016-07-26 02:15:43 +00001#!/bin/bash
Joe Topjiane361ee82016-07-26 16:46:31 +00002#
3# This script is useful for creating a devstack environment to run gophercloud
4# acceptance tests on.
5#
6# This can be considered a "legacy" devstack environment since it uses
7# Keystone v2 and LBaaS v1.
8#
9# To run, simply execute this script within a virtual machine.
10#
11# The following OpenStack versions are installed:
12# * OpenStack Mitaka
13# * Keystone v2
14# * Glance v1 and v2
15# * Nova v2 and v2.1
16# * Cinder v1 and v2
17# * Trove v1
18# * Swift v1
19# * Neutron v2
20# * Neutron LBaaS v1.0
21# * Neutron FWaaS v2.0
22#
23# Go 1.6 is also installed.
Joe Topjian4b6ce842016-07-26 02:15:43 +000024
25set -e
26
27cd
28sudo apt-get update
29sudo apt-get install -y git make mercurial
30
31sudo wget -O /usr/local/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
32sudo chmod +x /usr/local/bin/gimme
33gimme 1.6 >> .bashrc
34
35mkdir ~/go
36eval "$(/usr/local/bin/gimme 1.6)"
37echo 'export GOPATH=$HOME/go' >> .bashrc
38export GOPATH=$HOME/go
39source .bashrc
40
Joe Topjian3a4e1b92016-09-06 10:08:51 -060041go get golang.org/x/crypto/ssh
42go get github.com/gophercloud/gophercloud
43
Joe Topjian4b6ce842016-07-26 02:15:43 +000044git clone https://git.openstack.org/openstack-dev/devstack -b stable/mitaka
45cd devstack
46cat >local.conf <<EOF
47[[local|localrc]]
48# OpenStack version
49OPENSTACK_VERSION="mitaka"
50
51# devstack password
52DEVSTACK_PASSWORD="password"
53
54# Configure passwords and the Swift Hash
55MYSQL_PASSWORD=\$DEVSTACK_PASSWORD
56RABBIT_PASSWORD=\$DEVSTACK_PASSWORD
57SERVICE_TOKEN=\$DEVSTACK_PASSWORD
58ADMIN_PASSWORD=\$DEVSTACK_PASSWORD
59SERVICE_PASSWORD=\$DEVSTACK_PASSWORD
60SWIFT_HASH=\$DEVSTACK_PASSWORD
61
62# Configure the stable OpenStack branches used by DevStack
63# For stable branches see
64# http://git.openstack.org/cgit/openstack-dev/devstack/refs/
65CINDER_BRANCH=stable/\$OPENSTACK_VERSION
66CEILOMETER_BRANCH=stable/\$OPENSTACK_VERSION
67GLANCE_BRANCH=stable/\$OPENSTACK_VERSION
68HEAT_BRANCH=stable/\$OPENSTACK_VERSION
69HORIZON_BRANCH=stable/\$OPENSTACK_VERSION
70KEYSTONE_BRANCH=stable/\$OPENSTACK_VERSION
71NEUTRON_BRANCH=stable/\$OPENSTACK_VERSION
72NOVA_BRANCH=stable/\$OPENSTACK_VERSION
73SWIFT_BRANCH=stable/\$OPENSTACK_VERSION
74ZAQAR_BRANCH=stable/\$OPENSTACK_VERSION
75
76# Enable Swift
77enable_service s-proxy
78enable_service s-object
79enable_service s-container
80enable_service s-account
81
82# Disable Nova Network and enable Neutron
83disable_service n-net
84enable_service q-svc
85enable_service q-agt
86enable_service q-dhcp
87enable_service q-l3
88enable_service q-meta
89#enable_service q-flavors
90
91# Disable Neutron metering
92disable_service q-metering
93
94# Enable LBaaS V1
95enable_service q-lbaas
96
97# Enable FWaaS
98enable_service q-fwaas
99
100# Enable LBaaS v2
101#enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas stable/\$OPENSTACK_VERSION
102#enable_plugin octavia https://git.openstack.org/openstack/octavia stable/\$OPENSTACK_VERSION
103#enable_service q-lbaasv2
104#enable_service octavia
105#enable_service o-cw
106#enable_service o-hk
107#enable_service o-hm
108#enable_service o-api
109
110# Enable Trove
111enable_plugin trove git://git.openstack.org/openstack/trove.git stable/\$OPENSTACK_VERSION
112enable_service trove,tr-api,tr-tmgr,tr-cond
113
114# Disable Temptest
115disable_service tempest
116
117# Disable Horizon
118disable_service horizon
119
120# Disable Keystone v2
121#ENABLE_IDENTITY_V2=False
122
123# Enable SSL/tls
124#enable_service tls-proxy
125#USE_SSL=True
126
127# Enable Ceilometer
128#enable_service ceilometer-acompute
129#enable_service ceilometer-acentral
130#enable_service ceilometer-anotification
131#enable_service ceilometer-collector
132#enable_service ceilometer-alarm-evaluator
133#enable_service ceilometer-alarm-notifier
134#enable_service ceilometer-api
135
136# Enable Zaqar
137#enable_plugin zaqar https://github.com/openstack/zaqar
138#enable_service zaqar-server
139
140# Automatically download and register a VM image that Heat can launch
141# For more information on Heat and DevStack see
142# http://docs.openstack.org/developer/heat/getting_started/on_devstack.html
143#IMAGE_URLS+=",http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2"
144#IMAGE_URLS+=",https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img"
145
146# Logging
147LOGDAYS=1
148LOGFILE=/opt/stack/logs/stack.sh.log
149LOGDIR=/opt/stack/logs
150EOF
151./stack.sh
152
Joe Topjian4b6ce842016-07-26 02:15:43 +0000153# Prep the testing environment by creating the required testing resources and environment variables
154source openrc admin
155wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
156glance image-create --name CirrOS --disk-format qcow2 --container-format bare < cirros-0.3.4-x86_64-disk.img
Joe Topjian3a4e1b92016-09-06 10:08:51 -0600157nova flavor-create m1.acctest 99 512 5 1 --ephemeral 10
158nova flavor-create m1.resize 98 512 6 1 --ephemeral 10
Joe Topjian4b6ce842016-07-26 02:15:43 +0000159_NETWORK_ID=$(nova net-list | grep private | awk -F\| '{print $2}' | tr -d ' ')
160_EXTGW_ID=$(nova net-list | grep public | awk -F\| '{print $2}' | tr -d ' ')
161_IMAGE_ID=$(nova image-list | grep CirrOS | awk -F\| '{print $2}' | tr -d ' ' | head -1)
162echo export OS_IMAGE_NAME="cirros-0.3.4-x86_64-uec" >> openrc
163echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc
164echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc
165echo export OS_EXTGW_ID=$_EXTGW_ID >> openrc
166echo export OS_POOL_NAME="public" >> openrc
167echo export OS_FLAVOR_ID=99 >> openrc
Joe Topjian3a4e1b92016-09-06 10:08:51 -0600168echo export OS_FLAVOR_ID_RESIZE=98 >> openrc
Joe Topjian4b6ce842016-07-26 02:15:43 +0000169source openrc demo