From 7687bc27268fee5ac35f13a0a560a9f3f6136adb Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Wed, 20 Jul 2016 15:55:56 -0400 Subject: Adds utility to connect to ODL karaf console JIRA: APEX-185 Change-Id: I1e281f5905cc1db05d0f654503d91acda853c183 Signed-off-by: Tim Rozet --- ci/util.sh | 8 +++++++- lib/utility-functions.sh | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ci/util.sh b/ci/util.sh index ad7f0788..f48dcd74 100755 --- a/ci/util.sh +++ b/ci/util.sh @@ -5,7 +5,7 @@ CONFIG=${CONFIG:-'/var/opt/opnfv'} RESOURCES=${RESOURCES:-"$CONFIG/images"} LIB=${LIB:-"$CONFIG/lib"} -VALID_CMDS="undercloud overcloud debug-stack -h --help" +VALID_CMDS="undercloud overcloud opendaylight debug-stack -h --help" source $LIB/utility-functions.sh @@ -27,6 +27,8 @@ display_usage() { echo -e " user Optional: Defaults to 'stack'\n" echo -e " command Optional: Defaults to none\n" echo -e "" + echo -e " opendaylight Connect to OpenDaylight Karaf console\n" + echo -e "" echo -e " overcloud [ node [ command ] ] Connect to an Overcloud node and optionally execute a command\n" echo -e " node Required: in format controller|compute. Example: controller0\n" echo -e " command Optional: Defaults to none\n" @@ -79,6 +81,10 @@ parse_cmdline() { fi exit 0 ;; + opendaylight) + opendaylight_connect + exit 0 + ;; debug-stack) undercloud_connect stack "$(typeset -f debug_stack); debug_stack" exit 0 diff --git a/lib/utility-functions.sh b/lib/utility-functions.sh index f73a2d85..bc9a9592 100644 --- a/lib/utility-functions.sh +++ b/lib/utility-functions.sh @@ -61,6 +61,22 @@ controller or compute" fi } +##connects to opendaylight karaf console +##params: None +function opendaylight_connect { + local opendaylight_ip + opendaylight_ip=$(undercloud_connect "stack" "cat overcloudrc | grep SDN_CONTROLLER_IP | grep -Eo [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+") + + if [ "$opendaylight_ip" == "" ]; then + echo -e "Unable to find IP for OpenDaylight in overcloudrc" + return 1 + else + echo -e "Connecting to ODL Karaf console. Default password is 'karaf'" + fi + + ssh -p 8101 ${SSH_OPTIONS[@]} karaf@${opendaylight_ip} +} + ##outputs heat stack deployment failures ##params: none function debug_stack { -- cgit 1.2.3-korg