Adapt Parser test case to the new template
[functest.git] / functest / opnfv_tests / sdn / onos / teston / dependencies / onos
1 #!/bin/bash
2 # -----------------------------------------------------------------------------
3 # ONOS remote command-line client.
4 # -----------------------------------------------------------------------------
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11
12 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
13 . /root/.bashrc
14 . $ONOS_ROOT/tools/build/envDefaults
15 . $ONOS_ROOT/tools/test/bin/find-node.sh
16
17 [ "$1" = "-w" ] && shift && onos-wait-for-start $1
18
19 [ -n "$1" ] && OCI=$(find_node $1) && shift
20
21 if which client 1>/dev/null 2>&1 && [ -z "$ONOS_USE_SSH" ]; then
22     # Use Karaf client only if we can and are allowed to
23     unset KARAF_HOME
24     client -h $OCI -u karaf "$@" 2>/dev/null
25 else
26     # Otherwise use raw ssh; strict checking is off for dev environments only
27     #ssh -p 8101 -o StrictHostKeyChecking=no $OCI "$@"
28     sshpass -p karaf ssh -l karaf -p 8101 $OCI "$@"
29 fi