blob: b3d9db31c864b4d67088e143d4a571a1a75c5c78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
overcloud_file_name=overcloudrc # change this if needed
odl_username=admin
odl_password=admin
odl_port=8081
odl_dir=/opt/opendaylight
hc_username=admin
hc_password=admin
hc_netconf_port=2831
NODE_PATTERN=overcloud
CONTROLLER_PATTERN=controller
overcloudrc_path=/root/$overcloud_file_name
overcloud_fds_repo_loc=/root
overcloud_script_loc=$overcloud_fds_repo_loc/fds/scripts
IPV4_REGEX='([0-9]{1,3}.){3}[0-9]{1,3}'
get_nodes() {
if [[ $1 ]]
then
NODES=$(grep -o "$NODE_PATTERN-$1-[0-9]" /etc/hosts)
else
NODES=$(grep -Eo "$NODE_PATTERN-[^-]+-[0-9]" /etc/hosts)
fi
}
copy_to_controllers () {
get_nodes $CONTROLLER_PATTERN
LOCAL_FILE=$1
REMOTE_LOC=$2
for NODE in $NODES
do
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $LOCAL_FILE $NODE:$REMOTE_LOC &
done
wait
}
exec_on_controllers() {
get_nodes $CONTROLLER_PATTERN
for NODE in $NODES
do
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $NODE $@ &
done
wait
}
in_array() {
key=$1
shift
items=$@
for item in $items
do
if [ $item == $key ]
then
return 0
break
fi
done
return 1
}
|