Make sure keystonemiddleware is up to date
[releng/builder.git] / jjb / ovsdb / include-raw-openstack-ci.sh
1 #!/bin/bash
2
3 export PATH=$PATH:/bin:/sbin:/usr/sbin
4 export DEVSTACKDIR=$WORKSPACE/$BUILD_TAG
5 mkdir $DEVSTACKDIR
6 cd $DEVSTACKDIR
7
8 cat <<EOL > firewall.sh
9 sudo iptables -I INPUT -p tcp --dport 5672 -j ACCEPT
10 sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT
11 sudo iptables -I INPUT -p tcp --dport 9292 -j ACCEPT
12 sudo iptables -I INPUT -p tcp --dport 9696 -j ACCEPT
13 sudo iptables -I INPUT -p tcp --dport 35357 -j ACCEPT
14 sudo iptables -I INPUT -p tcp --dport 6080 -j ACCEPT
15 sudo iptables -I INPUT -p tcp --dport 8773 -j ACCEPT
16 sudo iptables -I INPUT -p udp --dport 8472 -j ACCEPT
17 sudo iptables -I INPUT -p udp --dport 4789 -j ACCEPT
18
19 # For the client
20 sudo iptables -I INPUT -p tcp --dport 5000 -j ACCEPT
21 sudo iptables -I INPUT -p tcp --dport 8774 -j ACCEPT
22
23 # For ODL
24 sudo iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
25 EOL
26 chmod +x firewall.sh
27
28 env
29 cat $DEVSTACKDIR/firewall.sh
30 $DEVSTACKDIR/firewall.sh
31
32 # FIXME: update version of pip being used here
33 curl -O https://pypi.python.org/packages/source/p/pip/pip-6.0.8.tar.gz
34 tar xvfz pip-6.0.8.tar.gz
35 cd pip-6.0.8
36 sudo -E python setup.py install
37 sudo pip install testtools
38
39 sudo mkdir -p /opt/stack
40 sudo chown $(whoami) /opt/stack
41 sudo chmod 755 /opt/stack
42 cd /opt/stack
43
44 # Workaround for bug:
45 # https://bugs.launchpad.net/devstack/+bug/1276297
46 sudo rm -rf /usr/lib/python2.7/site-packages/oslo*
47
48 # Workaround for "keystone not found" issues
49 sudo rm -rf /usr/lib/python2.7/site-packages/*client*
50
51 # Make sure keystonemiddleware is up to date
52 sudo pip install --upgrade keystonemiddleware
53
54 # Workaround: Pull neutron first
55 cd /opt/stack
56 git clone -q git://git.openstack.org/openstack/neutron.git
57 cd neutron
58 sudo python ./setup.py -q install
59
60 cd $DEVSTACKDIR
61
62 sudo yum -y install qemu libvirt-daemon
63 git clone https://github.com/openstack-dev/devstack.git
64 cd devstack
65
66 ####
67 # Specify changeset being worked on if it's networking-odl
68 ####
69 if [ "$GERRIT_PROJECT" == "stackforge/networking-odl" ]; then
70     cat <<EOLLC > local.conf
71 [[local|localrc]]
72 enable_plugin networking-odl https://$GERRIT_HOST/$GERRIT_PROJECT $GERRIT_REFSPEC
73 EOLLC
74 else
75     cat <<EOLLC > local.conf
76 [[local|localrc]]
77 enable_plugin networking-odl https://github.com/stackforge/networking-odl
78 EOLLC
79 fi
80
81 cat <<EOLLC >> local.conf
82 LOGFILE=stack.sh.log
83 SCREEN_LOGDIR=/opt/stack/data/log
84 VERBOSE=True
85 LOG_COLOR=False
86 RECLONE=yes
87 GIT_TIMEOUT=0
88 GIT_BASE=https://git.openstack.org
89
90 # Only uncomment the below two lines if you are running on Fedora
91 disable_service swift
92 disable_service rabbit
93 enable_service qpid
94 enable_service n-cpu
95 enable_service n-cond
96 disable_service n-net
97 enable_service q-svc
98 enable_service q-dhcp
99 enable_service q-l3
100 enable_service q-meta
101 enable_service quantum
102 enable_service tempest
103
104 API_RATE_LIMIT=False
105
106 Q_PLUGIN=ml2
107 Q_ML2_PLUGIN_MECHANISM_DRIVERS=logger,opendaylight
108 ENABLE_TENANT_TUNNELS=True
109
110 ODL_MODE=allinone
111 ODL_NETVIRT_DEBUG_LOGS=True
112 ODL_MGR_IP=$(ip addr | grep inet | grep eth0 | awk -F" " '{print $2}'| sed -e 's/\/.*$//')
113 ODL_ARGS="-Xmx1024m -XX:MaxPermSize=512m"
114 ODL_BOOT_WAIT=90
115
116 VNCSERVER_LISTEN=0.0.0.0
117
118 HOST_NAME=$(hostname)
119 SERVICE_HOST_NAME=$(hostname)
120 HOST_IP=$(ip addr | grep inet | grep eth0 | awk -F" " '{print $2}'| sed -e 's/\/.*$//')
121 SERVICE_HOST=$(hostname)
122
123 MYSQL_HOST=$(hostname)
124 RABBIT_HOST=$(hostname)
125 GLANCE_HOSTPORT=$(hostname):9292
126 KEYSTONE_AUTH_HOST=$(hostname)
127 KEYSTONE_SERVICE_HOST=$(hostname)
128
129 MYSQL_PASSWORD=mysql
130 RABBIT_PASSWORD=rabbit
131 QPID_PASSWORD=rabbit
132 SERVICE_TOKEN=service
133 SERVICE_PASSWORD=admin
134 ADMIN_PASSWORD=admin
135 EOLLC
136
137 # Add Neutron specific config if required
138 if [ "$GERRIT_PROJECT" == "openstack/neutron" ]; then
139     cat <<EOLLC >> local.conf
140 NEUTRON_REPO=https://$GERRIT_HOST/$GERRIT_PROJECT
141 NEUTRON_BRANCH=$GERRIT_REFSPEC
142 EOLLC
143 fi
144
145 cat local.conf
146
147 ####
148 # Clone the changeset being worked on if it's devstack
149 ####
150 if [ "$GERRIT_PROJECT" == "openstack-dev/devstack" ]; then
151     git fetch https://$GERRIT_HOST/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout FETCH_HEAD
152 fi
153
154 # Run devstack
155 ./stack.sh
156
157 if [ "$?" != "0" ]; then
158     echo "stack.sh failed"
159     # Copy logs off
160     mkdir -p $WORKSPACE/logs/devstack
161     mkdir -p $WORKSPACE/logs/opendaylight
162     cp -r /opt/stack/data/log/* $WORKSPACE/logs/devstack
163     cp -r $DEVSTACKDIR/devstack/stack.sh.log* $WORKSPACE/logs
164     cp -r $DEVSTACKDIR/devstack/local.conf $WORKSPACE/logs
165     cp -r /opt/stack/opendaylight/*/logs $WORKSPACE/logs/opendaylight
166     cp -r /opt/stack/opendaylight/*/data/log $WORKSPACE/logs/opendaylight
167     cp -r /opt/stack/opendaylight/*/etc $WORKSPACE/logs/opendaylight
168     tar cvzf $WORKSPACE/opendaylight-full-logs.tgz $WORKSPACE/logs
169     exit 1
170 fi
171
172 # running tempest
173 if [[ -n ${BUILD_ID} ]]; then
174     cd /opt/stack/tempest
175
176     # put all the info in the following file for processing later
177     log_for_review=odl_tempest_test_list.txt
178
179     echo "Running tempest tests:" > /tmp/${log_for_review}
180     echo "" >> /tmp/${log_for_review}
181     testr init > /dev/null 2>&1 || true
182     cmd="testr run  tempest.api.network.test_networks"
183     echo "opendaylight-test:$ "${cmd}  >> /tmp/${log_for_review}
184     ${cmd} >> /tmp/${log_for_review}
185     echo "" >> /tmp/${log_for_review}
186     echo "" >> /tmp/${log_for_review}
187
188     x=$(grep "id=" /tmp/${log_for_review})
189     y="${x//[()=]/ }"
190     z=$(echo ${y} | awk '{print $3}' | sed 's/\,//g')
191
192     #echo "x ($x) y ($y) z ($z)"
193
194     echo "List of tempest tests ran (id="${z}"):" >> /tmp/${log_for_review}
195     echo "" >> /tmp/${log_for_review}
196
197     grep -ri successful   .testrepository/${z}  |  awk '{ gsub(/\[/, "\ ");  print $1 " " $2}' >> /tmp/${log_for_review}
198 fi
199
200
201 # Copy logs off
202 mkdir -p $WORKSPACE/logs/devstack
203 mkdir -p $WORKSPACE/logs/tempest
204 mkdir -p $WORKSPACE/logs/opendaylight
205 cp -r /opt/stack/tempest/tempest.log* $WORKSPACE/logs/tempest
206 cp -r /opt/stack/data/log/* $WORKSPACE/logs/devstack
207 cp -r /opt/stack/opendaylight/*/logs $WORKSPACE/logs/opendaylight
208 cp -r /opt/stack/opendaylight/*/data/log $WORKSPACE/logs/opendaylight
209 cp -r /opt/stack/opendaylight/*/etc $WORKSPACE/logs/opendaylight
210 cp -r /tmp/${log_for_review} $WORKSPACE/logs
211 cp -r /tmp/${log_for_review} $WORKSPACE
212 cp -r $DEVSTACKDIR/devstack/stack.sh.log* $WORKSPACE/logs
213 cp -r $DEVSTACKDIR/devstack/local.conf $WORKSPACE/logs
214 tar cvzf $WORKSPACE/opendaylight-full-logs.tgz $WORKSPACE/logs