-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_setup.sh
More file actions
229 lines (190 loc) · 8.74 KB
/
test_setup.sh
File metadata and controls
229 lines (190 loc) · 8.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#!/bin/bash
# shellcheck source=/dev/null
source "$HOME"/base_config.sh
NOVA_MIN_MICROVERSION=$1
NOVA_MAX_MICROVERSION=$2
STORAGE_MIN_MICROVERSION=$3
STORAGE_MAX_MICROVERSION=$4
PLACEMENT_MIN_MICROVERSION=$5
PLACEMENT_MAX_MICROVERSION=$6
REFSTACK_TEST_IMAGE=$7
UBUNTU1_NAME=$8
UBUNTU2_NAME=$9
UBUNTU1_VERSION=${10}
UBUNTU2_VERSION=${11}
# Copy files necessary for both:
sudo cp /etc/kolla/certificates/ca/root.crt "$HOME"/root.crt
sudo chown "$USER":"$USER" "$HOME"/root.crt
# Create accounts and tempest files:
source /etc/kolla/admin-openrc.sh
openstack flavor create --id 100 --vcpus 1 --ram 256 --disk 1 ref.nano || true
openstack flavor create --id 101 --vcpus 2 --ram 512 --disk 2 ref.micro || true
DATE=$(date '+%Y-%m-%d')
UBUNTU1_URL="http://cloud-images.ubuntu.com/$UBUNTU1_NAME/current/$UBUNTU1_NAME-server-cloudimg-amd64.img"
UBUNTU2_URL="http://cloud-images.ubuntu.com/$UBUNTU2_NAME/current/$UBUNTU2_NAME-server-cloudimg-amd64.img"
UPLOADED_IMAGES="$(openstack image list -c Name -f value)"
if [[ $UPLOADED_IMAGES != *Ubuntu_"$UBUNTU1_VERSION"_LTS* ]]; then
echo "Downloading Ubuntu $UBUNTU1_VERSION ($UBUNTU1_NAME) Image"
wget "$UBUNTU1_URL" -O Ubuntu"$UBUNTU1_NAME"-"$DATE".img
openstack image create --disk-format qcow2 --container-format bare --public --min-disk 5 --min-ram 2048 --file Ubuntu"$UBUNTU1_NAME"-"$DATE".img --property os_distro=ubuntu --property os_type=linux --property os_version="$UBUNTU1_VERSION" --property architecture=x86_64 Ubuntu_"$UBUNTU1_VERSION"_LTS
fi
if [[ $UPLOADED_IMAGES != *Ubuntu_"$UBUNTU2_VERSION"_LTS* ]]; then
echo "Downloading Ubuntu $UBUNTU2_VERSION ($UBUNTU2_NAME) Image"
wget "$UBUNTU2_URL" -O Ubuntu"$UBUNTU2_NAME"-"$DATE".img
openstack image create --disk-format qcow2 --container-format bare --public --min-disk 5 --min-ram 2048 --file Ubuntu"$UBUNTU2_NAME"-"$DATE".img --property os_distro=ubuntu --property os_type=linux --property os_version="$UBUNTU2_VERSION" --property architecture=x86_64 Ubuntu_"$UBUNTU2_VERSION"_LTS
fi
if [[ $UPLOADED_IMAGES != *CirrOS* ]]; then
wget "$REFSTACK_TEST_IMAGE" -O /tmp/CirrOS.img
openstack image create --disk-format qcow2 --container-format bare --public --file /tmp/CirrOS.img "CirrOS"
fi
if [[ $UPLOADED_IMAGES != *CirrOS-2* ]]; then
wget "$REFSTACK_TEST_IMAGE" -O /tmp/CirrOS.img
openstack image create --disk-format qcow2 --container-format bare --public --file /tmp/CirrOS.img "CirrOS-2"
fi
ADMIN_PASS="$(grep 'OS_PASSWORD=' '/etc/kolla/admin-openrc.sh' | cut -d '=' -f2)"
CIRROSID="$(openstack image list -f value -c ID --name CirrOS)"
CIRROSID2="$(openstack image list -f value -c ID --name CirrOS-2)"
PUBLICNETWORKID="$(openstack network list --external -c ID -f value)"
PUBLICNETWORKNAME="$(openstack network list --external -c Name -f value)"
URILINKV2="$(openstack endpoint list --service identity --interface public -c URL -f value)/v2.0"
URILINKV3="$(openstack endpoint list --service identity --interface public -c URL -f value)/v3"
REGION="$(openstack region list -c Region -f value)"
MIN_COMPUTE_NODES="$(openstack compute service list -f value -c Host --service nova-compute | wc -l)"
IMAGE_FILE_NAME="${REFSTACK_TEST_IMAGE##*/}"
SERVICE_LIST="$(openstack service list)"
cat >"$HOME"/accounts.yaml <<__EOF__
- username: 'swiftop'
project_name: 'openstack'
password: 'a_big_secret'
roles:
- 'Member'
- 'ResellerAdmin'
__EOF__
# https://docs.openstack.org/tempest/latest/sampleconf.html
cat >"$HOME"/tempest.conf <<__EOF__
[DEFAULT]
debug = False
use_stderr = False
log_file = $HOME/Tempest.log
[auth]
# tempest_roles = admin
use_dynamic_credentials = True
test_accounts_file = $HOME/refstack-client/etc/accounts.yaml
default_credentials_domain_name = Default
create_isolated_networks = True
admin_username = admin
admin_project_name = admin
admin_password = $ADMIN_PASS
admin_domain_name = Default
[compute]
min_compute_nodes = $MIN_COMPUTE_NODES
min_microversion = $NOVA_MIN_MICROVERSION
max_microversion = $NOVA_MAX_MICROVERSION
flavor_ref = 100
flavor_ref_alt = 101
image_ref = $CIRROSID
image_ref_alt = $CIRROSID2
endpoint_type = publicURL
fixed_network_name = mynet
# build_timeout = 60
[compute-feature-enabled]
validation.run_validation = True
live_migration = True
live_migrate_paused_instances = True
preserve_ports = True
console_output = True
resize = True
attach_encrypted_volume = False
pause = True
shelve = True
suspend = True
cold_migration = True
vnc_console = True
[dashboard]
# Set to True if using self-signed SSL certificates. (boolean value)
disable_ssl_certificate_validation = True
[heat_plugin]
minimal_instance_type = 100
instance_type = 101
minimal_image_ref = $CIRROSID
image_ref = $CIRROSID
[identity]
catalog_type = identity
disable_ssl_certificate_validation = False
ca_certificates_file = $HOME/root.crt
uri = $URILINKV2
uri_v3 = $URILINKV3
auth_version = v3
region = $REGION
v3_endpoint_type = publicURL
[identity-feature-enabled]
api_v2 = False
api_v3 = True
#api_extensions = s3tokens,OS-EP-FILTER,OS-TRUST,OS-REVOKE,OS-ENDPOINT-POLICY,OS-INHERIT,OS-PKI,OS-OAUTH1,OS-SIMPLE-CERT,OS-FEDERATION,OS-EC2
[image]
image_path = $REFSTACK_TEST_IMAGE
http_image = $REFSTACK_TEST_IMAGE
#[image-feature-enabled]
#api_v1 = False
#api_v2 = True
[network]
public_network_id = $PUBLICNETWORKID
floating_network_name = $PUBLICNETWORKNAME
#[network-feature-enabled]
#ipv6_subnet_attributes = false
#api_extensions = address-scope,router-admin-state-down-before-update,agent,agent-resources-synced,allowed-address-pairs,auto-allocated-topology,availability_zone,availability_zone_filter,default-subnetpools,dhcp_agent_scheduler,dvr,empty-string-filtering,external-net,extra_dhcp_opt,extraroute,extraroute-atomic,filter-validation,fip-port-details,flavors,floatingip-pools,ip-substring-filtering,router,ext-gw-mode,l3-ha,l3-flavors,l3-port-ip-change-not-allowed,l3_agent_scheduler,metering,multi-provider,net-mtu,net-mtu-writable,network_availability_zone,network-ip-availability,pagination,port-mac-address-regenerate,binding,binding-extended,port-security,project-id,provider,quotas,quota_details,rbac-policies,rbac-security-groups,revision-if-match,standard-attr-revisions,router_availability_zone,port-security-groups-filtering,security-group,service-type,sorting,standard-attr-description,subnet_onboard,subnet-service-types,subnet_allocation,subnetpool-prefix-ops,standard-attr-tag,standard-attr-timestamp
[object-storage]
region = $REGION
operator_role = member
reseller_admin_role = ResellerAdmin
endpoint_type = internal
[object-storage-feature-enabled]
discoverability = True
[oslo-concurrency]
lock_path = /tmp
[placement]
min_microversion = $PLACEMENT_MIN_MICROVERSION
max_microversion = $PLACEMENT_MAX_MICROVERSION
#[scenario]
#img_dir = etc
#img_file = $IMAGE_FILE_NAME
[validation]
image_ssh_user = cirros
run_validation = True
connect_method = floating
auth_method = keypair
ip_version_for_ssh = 4
network_for_ssh = $PUBLICNETWORKNAME
security_group = True
security_group_rules = True
image_ssh_password = gocubsgo
image_alt_ssh_password = rebuildPassw0rd
ssh_timeout = 180
[volume]
#build_timeout = 60
#backend_names = block
min_microversion = $STORAGE_MIN_MICROVERSION
max_microversion = $STORAGE_MAX_MICROVERSION
volume_size = 1
#[volume-feature-enabled]
#api_v2 = True
#backup = True
#api_v3 = True
#api_extensions = OS-SCH-HNT,os-vol-image-meta,os-volume-type-access,os-quota-sets,os-vol-mig-status-attr,os-quota-class-sets,os-volume-unmanage,scheduler-stats,os-extended-snapshot-attributes,os-volume-transfer,os-snapshot-manage,os-snapshot-unmanage,os-volume-manage,backups,consistencygroups,encryption,os-types-extra-specs,os-snapshot-actions,os-vol-host-attr,os-extended-services,cgsnapshots,os-hosts,os-vol-tenant-attr,os-volume-encryption-metadata,os-admin-actions,os-volume-actions,os-used-limits,os-services,os-types-manage,os-availability-zone,qos-specs,capabilities,OS-SCH-HNT,os-vol-image-meta,os-volume-type-access,os-quota-sets,os-vol-mig-status-attr,os-quota-class-sets,os-volume-unmanage,scheduler-stats,os-extended-snapshot-attributes,os-volume-transfer,os-snapshot-manage,os-snapshot-unmanage,os-volume-manage,backups,consistencygroups,encryption,os-types-extra-specs,os-snapshot-actions,os-vol-host-attr,os-extended-services,cgsnapshots,os-hosts,os-vol-tenant-attr,os-volume-encryption-metadata,os-admin-actions,os-volume-actions,os-used-limits,os-services,os-types-manage,os-availability-zone,qos-specs,capabilities
[service_available]
horizon = True
__EOF__
services_to_check=("cinder" "glance" "heat" "keystone" "neutron" "nova" "octavia" "placement" "sahara" "swift" "trove")
check_service() {
service="$1"
shift
string="$*"
if [ -z "${string##*"$service"*}" ]; then
echo "$service = True" >>tempest.conf
else
echo "$service = False" >>tempest.conf
fi
}
for service in "${services_to_check[@]}"; do
check_service "$service" "$SERVICE_LIST"
done