blob: 66fddcf178c563b3a1b7e9cc65ec0a759e3e1312 [file] [log] [blame]
Dean Troyer4d883472012-03-13 23:56:49 -05001#!/usr/bin/env bash
2
3# Test OpenStack client authentication aguemnts handling
4
Dean Troyer27e32692012-03-16 16:16:56 -05005echo "*********************************************************************"
Dean Troyer4d883472012-03-13 23:56:49 -05006echo "Begin DevStack Exercise: $0"
Dean Troyer27e32692012-03-16 16:16:56 -05007echo "*********************************************************************"
Dean Troyer4d883472012-03-13 23:56:49 -05008
9# Settings
10# ========
11
12# Keep track of the current directory
13EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
14TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
15
16# Import common functions
17source $TOP_DIR/functions
18
19# Import configuration
20source $TOP_DIR/openrc
21
22# Import exercise configuration
23source $TOP_DIR/exerciserc
24
25# Unset all of the known NOVA_ vars
26unset NOVA_API_KEY
27unset NOVA_ENDPOINT_NAME
28unset NOVA_PASSWORD
29unset NOVA_PROJECT_ID
30unset NOVA_REGION_NAME
31unset NOVA_URL
32unset NOVA_USERNAME
33unset NOVA_VERSION
34
35# Save the known variables for later
36export x_TENANT_NAME=$OS_TENANT_NAME
37export x_USERNAME=$OS_USERNAME
38export x_PASSWORD=$OS_PASSWORD
39export x_AUTH_URL=$OS_AUTH_URL
40
41#Unset the usual variables to force argument processing
42unset OS_TENANT_NAME
43unset OS_USERNAME
44unset OS_PASSWORD
45unset OS_AUTH_URL
46
47# Common authentication args
48TENANT_ARG="--os_tenant_name=$x_TENANT_NAME"
49ARGS="--os_username=$x_USERNAME --os_password=$x_PASSWORD --os_auth_url=$x_AUTH_URL"
50
51# Set global return
52RETURN=0
53
54# Keystone client
55# ---------------
56if [[ "$ENABLED_SERVICES" =~ "key" ]]; then
57 if [[ "$SKIP_EXERCISES" =~ "key" ]] ; then
58 STATUS_KEYSTONE="Skipped"
59 else
60 echo -e "\nTest Keystone"
61 if keystone $TENANT_ARG $ARGS catalog --service identity; then
62 STATUS_KEYSTONE="Succeeded"
63 else
64 STATUS_KEYSTONE="Failed"
65 RETURN=1
66 fi
67 fi
68fi
69
70# Nova client
71# -----------
72
73if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
74 if [[ "$SKIP_EXERCISES" =~ "n-api" ]] ; then
75 STATUS_NOVA="Skipped"
76 STATUS_EC2="Skipped"
77 else
78 # Test OSAPI
79 echo -e "\nTest Nova"
80 if nova $TENANT_ARG $ARGS flavor-list; then
81 STATUS_NOVA="Succeeded"
82 else
83 STATUS_NOVA="Failed"
84 RETURN=1
85 fi
86 fi
87fi
88
89# Glance client
90# -------------
91
92if [[ "$ENABLED_SERVICES" =~ "g-api" ]]; then
93 if [[ "$SKIP_EXERCISES" =~ "g-api" ]] ; then
94 STATUS_GLANCE="Skipped"
95 else
96 echo -e "\nTest Glance"
97 if glance $TENANT_ARG $ARGS index; then
98 STATUS_GLANCE="Succeeded"
99 else
100 STATUS_GLANCE="Failed"
101 RETURN=1
102 fi
103 fi
104fi
105
106# Swift client
107# ------------
108
109if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
110 if [[ "$SKIP_EXERCISES" =~ "swift" ]] ; then
111 STATUS_SWIFT="Skipped"
112 else
113 echo -e "\nTest Swift"
114 if swift $ARGS stat; then
115 STATUS_SWIFT="Succeeded"
116 else
117 STATUS_SWIFT="Failed"
118 RETURN=1
119 fi
120 fi
121fi
122
123# Results
124# -------
125
126function report() {
127 if [[ -n "$2" ]]; then
128 echo "$1: $2"
129 fi
130}
131
132echo -e "\n"
133report "Keystone" $STATUS_KEYSTONE
134report "Nova" $STATUS_NOVA
135report "Glance" $STATUS_GLANCE
136report "Swift" $STATUS_SWIFT
137
Dean Troyer27e32692012-03-16 16:16:56 -0500138echo "*********************************************************************"
139echo "SUCCESS: End DevStack Exercise: $0"
140echo "*********************************************************************"
Dean Troyer4d883472012-03-13 23:56:49 -0500141
142exit $RETURN