builders:
- inject:
properties-content: 'URL=/home/$USER/rpmbuild/RPMS/noarch/*.rpm'
- # Use *-escape to make double brace expansion work. JJB strangeness.
- shell: !include-raw: test-rpm-deps.sh
- shell: !include-raw-escape: install-rpm.sh
- shell: !include-raw: start-odl.sh
# Install nmap to check status of ODL's SSH port
sudo yum install -y expect nmap
- shell: !include-raw: test-karaf.expect
+ - shell: !include-raw: test-rest-ok.sh
- shell: !include-raw: stop-odl.sh
- shell: !include-raw: uninstall-rpm.sh
- shell: |
# Install nmap to check status of ODL's SSH port
sudo yum install -y expect nmap
- shell: !include-raw: test-karaf.expect
+ - shell: !include-raw-escape: test-rest-ok.sh
- shell: !include-raw: stop-odl.sh
- shell: !include-raw: uninstall-rpm.sh
--- /dev/null
+#!/bin/bash
+
+# Options:
+# -x: Echo commands
+# -e: Fail on errors
+# -o pipefail: Fail on errors in scripts this calls, give stacktrace
+set -ex -o pipefail
+
+echo "Waiting for ODL REST API to come up..."
+COUNT="0"
+while true; do
+ # Will fail if 8181 isn't open, check for that first
+ RESP=$( curl --user admin:admin --silent --head --output /dev/null --write-out '%{http_code}' http://localhost:8181/restconf/modules )
+ echo "Curl of ODL REST API HTTP response code: $RESP"
+ if [[ $RESP = *200* ]]; then
+ echo "ODL REST API returned 200"
+ break
+ elif [ $COUNT -gt 120 ]; then
+ echo "Timeout waiting for HTTP 200 from REST API"
+ exit 1
+ else
+ ((COUNT+=1))
+ sleep 1
+ fi
+done