Joe Topjian | 4b6ce84 | 2016-07-26 02:15:43 +0000 | [diff] [blame] | 1 | #!/bin/bash |
Joe Topjian | e361ee8 | 2016-07-26 16:46:31 +0000 | [diff] [blame] | 2 | # |
| 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 Topjian | 4b6ce84 | 2016-07-26 02:15:43 +0000 | [diff] [blame] | 24 | |
| 25 | set -e |
| 26 | |
| 27 | cd |
| 28 | sudo apt-get update |
| 29 | sudo apt-get install -y git make mercurial |
| 30 | |
| 31 | sudo wget -O /usr/local/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme |
| 32 | sudo chmod +x /usr/local/bin/gimme |
| 33 | gimme 1.6 >> .bashrc |
| 34 | |
| 35 | mkdir ~/go |
| 36 | eval "$(/usr/local/bin/gimme 1.6)" |
| 37 | echo 'export GOPATH=$HOME/go' >> .bashrc |
| 38 | export GOPATH=$HOME/go |
| 39 | source .bashrc |
| 40 | |
Joe Topjian | 3a4e1b9 | 2016-09-06 10:08:51 -0600 | [diff] [blame^] | 41 | go get golang.org/x/crypto/ssh |
| 42 | go get github.com/gophercloud/gophercloud |
| 43 | |
Joe Topjian | 4b6ce84 | 2016-07-26 02:15:43 +0000 | [diff] [blame] | 44 | git clone https://git.openstack.org/openstack-dev/devstack -b stable/mitaka |
| 45 | cd devstack |
| 46 | cat >local.conf <<EOF |
| 47 | [[local|localrc]] |
| 48 | # OpenStack version |
| 49 | OPENSTACK_VERSION="mitaka" |
| 50 | |
| 51 | # devstack password |
| 52 | DEVSTACK_PASSWORD="password" |
| 53 | |
| 54 | # Configure passwords and the Swift Hash |
| 55 | MYSQL_PASSWORD=\$DEVSTACK_PASSWORD |
| 56 | RABBIT_PASSWORD=\$DEVSTACK_PASSWORD |
| 57 | SERVICE_TOKEN=\$DEVSTACK_PASSWORD |
| 58 | ADMIN_PASSWORD=\$DEVSTACK_PASSWORD |
| 59 | SERVICE_PASSWORD=\$DEVSTACK_PASSWORD |
| 60 | SWIFT_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/ |
| 65 | CINDER_BRANCH=stable/\$OPENSTACK_VERSION |
| 66 | CEILOMETER_BRANCH=stable/\$OPENSTACK_VERSION |
| 67 | GLANCE_BRANCH=stable/\$OPENSTACK_VERSION |
| 68 | HEAT_BRANCH=stable/\$OPENSTACK_VERSION |
| 69 | HORIZON_BRANCH=stable/\$OPENSTACK_VERSION |
| 70 | KEYSTONE_BRANCH=stable/\$OPENSTACK_VERSION |
| 71 | NEUTRON_BRANCH=stable/\$OPENSTACK_VERSION |
| 72 | NOVA_BRANCH=stable/\$OPENSTACK_VERSION |
| 73 | SWIFT_BRANCH=stable/\$OPENSTACK_VERSION |
| 74 | ZAQAR_BRANCH=stable/\$OPENSTACK_VERSION |
| 75 | |
| 76 | # Enable Swift |
| 77 | enable_service s-proxy |
| 78 | enable_service s-object |
| 79 | enable_service s-container |
| 80 | enable_service s-account |
| 81 | |
| 82 | # Disable Nova Network and enable Neutron |
| 83 | disable_service n-net |
| 84 | enable_service q-svc |
| 85 | enable_service q-agt |
| 86 | enable_service q-dhcp |
| 87 | enable_service q-l3 |
| 88 | enable_service q-meta |
| 89 | #enable_service q-flavors |
| 90 | |
| 91 | # Disable Neutron metering |
| 92 | disable_service q-metering |
| 93 | |
| 94 | # Enable LBaaS V1 |
| 95 | enable_service q-lbaas |
| 96 | |
| 97 | # Enable FWaaS |
| 98 | enable_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 |
| 111 | enable_plugin trove git://git.openstack.org/openstack/trove.git stable/\$OPENSTACK_VERSION |
| 112 | enable_service trove,tr-api,tr-tmgr,tr-cond |
| 113 | |
| 114 | # Disable Temptest |
| 115 | disable_service tempest |
| 116 | |
| 117 | # Disable Horizon |
| 118 | disable_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 |
| 147 | LOGDAYS=1 |
| 148 | LOGFILE=/opt/stack/logs/stack.sh.log |
| 149 | LOGDIR=/opt/stack/logs |
| 150 | EOF |
| 151 | ./stack.sh |
| 152 | |
Joe Topjian | 4b6ce84 | 2016-07-26 02:15:43 +0000 | [diff] [blame] | 153 | # Prep the testing environment by creating the required testing resources and environment variables |
| 154 | source openrc admin |
| 155 | wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img |
| 156 | glance image-create --name CirrOS --disk-format qcow2 --container-format bare < cirros-0.3.4-x86_64-disk.img |
Joe Topjian | 3a4e1b9 | 2016-09-06 10:08:51 -0600 | [diff] [blame^] | 157 | nova flavor-create m1.acctest 99 512 5 1 --ephemeral 10 |
| 158 | nova flavor-create m1.resize 98 512 6 1 --ephemeral 10 |
Joe Topjian | 4b6ce84 | 2016-07-26 02:15:43 +0000 | [diff] [blame] | 159 | _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) |
| 162 | echo export OS_IMAGE_NAME="cirros-0.3.4-x86_64-uec" >> openrc |
| 163 | echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc |
| 164 | echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc |
| 165 | echo export OS_EXTGW_ID=$_EXTGW_ID >> openrc |
| 166 | echo export OS_POOL_NAME="public" >> openrc |
| 167 | echo export OS_FLAVOR_ID=99 >> openrc |
Joe Topjian | 3a4e1b9 | 2016-09-06 10:08:51 -0600 | [diff] [blame^] | 168 | echo export OS_FLAVOR_ID_RESIZE=98 >> openrc |
Joe Topjian | 4b6ce84 | 2016-07-26 02:15:43 +0000 | [diff] [blame] | 169 | source openrc demo |