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