aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/optf-osdf/osdf/wait_for_port.sh
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-10-04 03:11:32 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-04 03:11:32 +0000
commit7f551a931f9d806b1cce6795837f2b936bd501e5 (patch)
tree9b47762888054e76ff96b6422c1628d639190149 /scripts/optf-osdf/osdf/wait_for_port.sh
parentabf1f1c931a21689e5a097a6de9290678f6a61e5 (diff)
parent3fe70c777050581f090f1bcc9ebf9e44857d0b56 (diff)
Merge "Initial implementation of optf-osdf csit"
Diffstat (limited to 'scripts/optf-osdf/osdf/wait_for_port.sh')
-rwxr-xr-xscripts/optf-osdf/osdf/wait_for_port.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/optf-osdf/osdf/wait_for_port.sh b/scripts/optf-osdf/osdf/wait_for_port.sh
new file mode 100755
index 00000000..360fc210
--- /dev/null
+++ b/scripts/optf-osdf/osdf/wait_for_port.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# -------------------------------------------------------------------------
+# Copyright (c) 2018 AT&T Intellectual Property
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -------------------------------------------------------------------------
+#
+
+if [[ $# -ne 2 ]]; then
+ echo "Usage: wait-for-port hostname port" >&2
+ exit 1
+fi
+
+host=$1
+port=$2
+
+echo "Waiting for $host port $port open"
+until telnet $host $port </dev/null 2>/dev/null | grep -q '^Connected'; do
+ sleep 1
+done
+
+echo "$host port $port is open"
+
+exit 0