From 0868afe5cf7cbbabb0641e84b0eeb79704171f04 Mon Sep 17 00:00:00 2001
From: Janki Chhatbar <jchhatba@redhat.com>
Date: Thu, 16 Nov 2017 17:58:42 +0530
Subject: [PATCH] Optimize opendaylight_api container healhcheck

This patch optimises ODL's healthcheck test to avoid using
hard-coded values

Change-Id: I0bc0d1e9161b978a5b3bd7a7b4b9cea19d7b8476
---
 healthcheck/opendaylight-api | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/healthcheck/opendaylight-api b/healthcheck/opendaylight-api
index 72f510533..0f5a1e43e 100644
--- a/healthcheck/opendaylight-api
+++ b/healthcheck/opendaylight-api
@@ -2,10 +2,8 @@
 
 . ${HEALTHCHECK_SCRIPTS:-/usr/share/openstack-tripleo-common/healthcheck}/common.sh
 
-username=$(get_config_val /opt/opendaylight/etc/org.jolokia.osgi.cfg DEFAULT org.jolokia.user admin)
-password=$(get_config_val /opt/opendaylight/etc/org.jolokia.osgi.cfg DEFAULT org.jolokia.password admin)
-bind_host=$(grep -r '<Set name="host">' "/opt/opendaylight/etc/jetty.xml" | awk -F'>' FNR==1'{print $2}')
-bind_port=$(grep -r '<Property name="jetty.port" default=' "/opt/opendaylight/etc/jetty.xml" | awk FNR==2'{print $3}' | cut -d'"' -f2)
-odl_check_url=restconf/operational/network-topology:network-topology/topology/netvirt:1
+file=/opt/opendaylight/etc/jetty.xml
+bind_host=$(grep -r '<Set name="host">' $file | awk -F'>' FNR==1'{print $2}')
+bind_port=$(grep -r '<Property name="jetty.port" default=' $file | awk FNR==2'{print $3}' | cut -d'"' -f2)
 
-healthcheck_curl -u $username:$password http://$bind_host:$bind_port/$odl_check_url
+healthcheck_curl http://$bind_host:$bind_port/index.html
\ No newline at end of file