blob: c74db62477a0aa51fa2b414199e3084c035ec597 [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
ehdou10f1f852016-10-14 20:58:23 +030022# * Manila v2
Joe Topjiane361ee82016-07-26 16:46:31 +000023#
24# Go 1.6 is also installed.
Joe Topjian4b6ce842016-07-26 02:15:43 +000025
26set -e
27
28cd
29sudo apt-get update
30sudo apt-get install -y git make mercurial
31
32sudo wget -O /usr/local/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
33sudo chmod +x /usr/local/bin/gimme
34gimme 1.6 >> .bashrc
35
36mkdir ~/go
37eval "$(/usr/local/bin/gimme 1.6)"
38echo 'export GOPATH=$HOME/go' >> .bashrc
39export GOPATH=$HOME/go
40source .bashrc
41
Joe Topjian3a4e1b92016-09-06 10:08:51 -060042go get golang.org/x/crypto/ssh
43go get github.com/gophercloud/gophercloud
44
Joe Topjian4b6ce842016-07-26 02:15:43 +000045git clone https://git.openstack.org/openstack-dev/devstack -b stable/mitaka
46cd devstack
47cat >local.conf <<EOF
48[[local|localrc]]
49# OpenStack version
50OPENSTACK_VERSION="mitaka"
51
52# devstack password
53DEVSTACK_PASSWORD="password"
54
55# Configure passwords and the Swift Hash
56MYSQL_PASSWORD=\$DEVSTACK_PASSWORD
57RABBIT_PASSWORD=\$DEVSTACK_PASSWORD
58SERVICE_TOKEN=\$DEVSTACK_PASSWORD
59ADMIN_PASSWORD=\$DEVSTACK_PASSWORD
60SERVICE_PASSWORD=\$DEVSTACK_PASSWORD
61SWIFT_HASH=\$DEVSTACK_PASSWORD
62
63# Configure the stable OpenStack branches used by DevStack
64# For stable branches see
65# http://git.openstack.org/cgit/openstack-dev/devstack/refs/
66CINDER_BRANCH=stable/\$OPENSTACK_VERSION
67CEILOMETER_BRANCH=stable/\$OPENSTACK_VERSION
68GLANCE_BRANCH=stable/\$OPENSTACK_VERSION
69HEAT_BRANCH=stable/\$OPENSTACK_VERSION
70HORIZON_BRANCH=stable/\$OPENSTACK_VERSION
71KEYSTONE_BRANCH=stable/\$OPENSTACK_VERSION
72NEUTRON_BRANCH=stable/\$OPENSTACK_VERSION
73NOVA_BRANCH=stable/\$OPENSTACK_VERSION
74SWIFT_BRANCH=stable/\$OPENSTACK_VERSION
75ZAQAR_BRANCH=stable/\$OPENSTACK_VERSION
76
77# Enable Swift
78enable_service s-proxy
79enable_service s-object
80enable_service s-container
81enable_service s-account
82
83# Disable Nova Network and enable Neutron
84disable_service n-net
85enable_service q-svc
86enable_service q-agt
87enable_service q-dhcp
88enable_service q-l3
89enable_service q-meta
90#enable_service q-flavors
91
92# Disable Neutron metering
93disable_service q-metering
94
95# Enable LBaaS V1
96enable_service q-lbaas
97
98# Enable FWaaS
99enable_service q-fwaas
100
101# Enable LBaaS v2
102#enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas stable/\$OPENSTACK_VERSION
103#enable_plugin octavia https://git.openstack.org/openstack/octavia stable/\$OPENSTACK_VERSION
104#enable_service q-lbaasv2
105#enable_service octavia
106#enable_service o-cw
107#enable_service o-hk
108#enable_service o-hm
109#enable_service o-api
110
111# Enable Trove
112enable_plugin trove git://git.openstack.org/openstack/trove.git stable/\$OPENSTACK_VERSION
113enable_service trove,tr-api,tr-tmgr,tr-cond
114
115# Disable Temptest
116disable_service tempest
117
118# Disable Horizon
119disable_service horizon
120
121# Disable Keystone v2
122#ENABLE_IDENTITY_V2=False
123
124# Enable SSL/tls
125#enable_service tls-proxy
126#USE_SSL=True
127
128# Enable Ceilometer
129#enable_service ceilometer-acompute
130#enable_service ceilometer-acentral
131#enable_service ceilometer-anotification
132#enable_service ceilometer-collector
133#enable_service ceilometer-alarm-evaluator
134#enable_service ceilometer-alarm-notifier
135#enable_service ceilometer-api
136
137# Enable Zaqar
138#enable_plugin zaqar https://github.com/openstack/zaqar
139#enable_service zaqar-server
140
ehdou10f1f852016-10-14 20:58:23 +0300141# Enable Manila
142enable_plugin manila https://github.com/openstack/manila
143
Joe Topjian4b6ce842016-07-26 02:15:43 +0000144# Automatically download and register a VM image that Heat can launch
145# For more information on Heat and DevStack see
146# http://docs.openstack.org/developer/heat/getting_started/on_devstack.html
147#IMAGE_URLS+=",http://cloud.fedoraproject.org/fedora-20.x86_64.qcow2"
148#IMAGE_URLS+=",https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img"
149
150# Logging
151LOGDAYS=1
152LOGFILE=/opt/stack/logs/stack.sh.log
153LOGDIR=/opt/stack/logs
154EOF
155./stack.sh
156
Joe Topjian4b6ce842016-07-26 02:15:43 +0000157# Prep the testing environment by creating the required testing resources and environment variables
158source openrc admin
159wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
160glance 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 -0600161nova flavor-create m1.acctest 99 512 5 1 --ephemeral 10
162nova flavor-create m1.resize 98 512 6 1 --ephemeral 10
Joe Topjian4b6ce842016-07-26 02:15:43 +0000163_NETWORK_ID=$(nova net-list | grep private | awk -F\| '{print $2}' | tr -d ' ')
164_EXTGW_ID=$(nova net-list | grep public | awk -F\| '{print $2}' | tr -d ' ')
165_IMAGE_ID=$(nova image-list | grep CirrOS | awk -F\| '{print $2}' | tr -d ' ' | head -1)
166echo export OS_IMAGE_NAME="cirros-0.3.4-x86_64-uec" >> openrc
167echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc
168echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc
169echo export OS_EXTGW_ID=$_EXTGW_ID >> openrc
170echo export OS_POOL_NAME="public" >> openrc
171echo export OS_FLAVOR_ID=99 >> openrc
Joe Topjian3a4e1b92016-09-06 10:08:51 -0600172echo export OS_FLAVOR_ID_RESIZE=98 >> openrc
Mikko Valkonen9368c002017-01-16 18:31:39 +0200173
174# Manila share-network needs to be created
175_IDTOVALUE="-F id -f value"
176_NEUTRON_NET_ID=$(neutron net-list --name private $_IDTOVALUE)
177_NEUTRON_IPV4_SUB=$(neutron subnet-list \
178 --ip_version 4 \
179 --network_id "$_NEUTRON_NET_ID" \
180 $_IDTOVALUE)
181
182manila share-network-create \
183 --neutron-net-id "$_NEUTRON_NET_ID" \
184 --neutron-subnet-id "$_NEUTRON_IPV4_SUB" \
185 --name "acc_share_nw"
186
187_SHARE_NETWORK=$(manila share-network-list \
188 --neutron-net-id "$_NEUTRON_NET_ID" \
189 --neutron-subnet-id "$_NEUTRON_IPV4_SUB" \
190 --name "acc_share_nw" \
191 | awk 'FNR == 4 {print $2}')
192
193echo export OS_SHARE_NETWORK_ID="$_SHARE_NETWORK" >> openrc
Joe Topjian4b6ce842016-07-26 02:15:43 +0000194source openrc demo