9dd61cfc9d1746c899952fcc1e8f1f0a6cd79154
[csit.git] / resources / libraries / bash / entry / bootstrap_setup_testbed.sh
1 #!/usr/bin/env bash
2
3 # Copyright (c) 2018 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 set -exuo pipefail
17
18 # Assumptions:
19 # + There is a directory holding CSIT code to use (this script is there).
20 # ++ This entry script has access to arguments:
21 # ++ ${@} = <linux_ip> <mgmt_ip> <mgmt_username> <mgmt_pass>
22 # Consequences (and specific assumptions) are multiple,
23 # examine tree of functions for current description.
24
25 # "set -eu" handles failures from the following two lines.
26 BASH_ENTRY_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
27 BASH_FUNCTION_DIR="$(readlink -e "${BASH_ENTRY_DIR}/../function")"
28 source "${BASH_FUNCTION_DIR}/common.sh" || {
29     echo "Source failed." >&2
30     exit 1
31 }
32 source "${BASH_FUNCTION_DIR}/setup.sh" || die "Source failed."
33 common_dirs || die
34 pxe_host "${@}" || die
35 ansible_host || die