-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·170 lines (155 loc) · 3.63 KB
/
run.sh
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/bash
# Deploy Docker containers to two remote locations and have them run sdwan performance tests
# this script is responsible for building the .ENV file and creating the entry into the Orchestration container
#
REMOTE_SERVER=""
REMOTE_SERVER_PORT=22
REMOTE_SERVER_USER=root
REMOTE_CLIENT=""
REMOTE_CLIENT_PORT=22
REMOTE_CLIENT_USER=root
RESULTS_SERVER=""
RESULTS_SERVER_PORT=22
RESULTS_SERVER_USER=root
REMOTE_DEVICE=""
REMOTE_DEVICE_PORT=22
REMOTE_DEVICE_USER=root
REMOTE_DEVICE_PW=passwd
DEVICE="Unknown"
ORCH_CONFIG=""
ORCHESTRATOR=""
for arg in "$@"
do
case $arg in
-s|--server)
REMOTE_SERVER="$2"
shift
shift
;;
-su|--serveruser)
REMOTE_SERVER_USER="$2"
shift
shift
;;
-sp|--serverport)
REMOTE_SERVER_PORT="$2"
shift
shift
;;
-c|--client)
REMOTE_CLIENT="$2"
shift
shift
;;
-cp|--clientport)
REMOTE_CLIENT_PORT="$2"
shift
shift
;;
-cu|--clientuser)
REMOTE_CLIENT_USER="$2"
shift
shift
;;
-rs|--resultserver)
RESULTS_SERVER="$2"
shift
shift
;;
-ru|--resultserveruser)
RESULTS_SERVER_USER="$2"
shift
shift
;;
-rp|--resultserverport)
RESULTS_SERVER_PORT="$2"
shift
shift
;;
-rd|--remotedevice)
REMOTE_DEVICE="$2"
shift
shift
;;
-rdpw|--remotedevicepass)
REMOTE_DEVICE_PW="$2"
shift
shift
;;
-rdu|--remotedeviceuser)
REMOTE_DEVICE_USER="$2"
shift
shift
;;
-rdp|--remotedeviceport)
REMOTE_DEVICE_PORT="$2"
shift
shift
;;
-d|--device)
DEVICE="$2"
shift
shift
;;
-o|--orchestrator)
ORCHESTRATOR="$2"
shift
shift
;;
-oc|--config)
ORCH_CONFIG="$2"
shift
shift
;;
esac
done
# Cleanup the environment files before running
rm .env
if [ -n "$DEVICE" ]
then
echo TEST_DEVICE=$DEVICE>>.env
fi
# Create Env files before setting up containers
if [ -n "$RESULTS_SERVER" ]
then
# These are used for docker context creation
echo RES_SRV=$RESULTS_SERVER>>.env
echo RES_SRV_USER=$RESULTS_SERVER_USER>>.env
echo RES_SRV_PORT=$RESULTS_SERVER_PORT>>.env
# These are used for RSync SSH config
echo RES_SSH_PORT=13474>>.env
echo RES_SSH_USER=root>>.env
else
echo RES_SSH_PORT=22>>.env
fi
if [ -n "$REMOTE_SERVER" ]
then
echo PERF_SRV=$REMOTE_SERVER>>.env
echo PERF_SRV_PORT=$REMOTE_SERVER_PORT>>.env
echo PERF_SRV_USER=$REMOTE_SERVER_USER>>.env
fi
if [ -n "$REMOTE_CLIENT" ]
then
echo PERF_CLIENT=$REMOTE_CLIENT>>.env
echo PERF_CLIENT_PORT=$REMOTE_CLIENT_PORT>>.env
echo PERF_CLIENT_USER=$REMOTE_CLIENT_USER>>.env
fi
if [ -n "$REMOTE_DEVICE" ]
then
echo DEVICE_ADDR=$REMOTE_DEVICE>>.env
echo DEVICE_PORT=$REMOTE_DEVICE_PORT>>.env
echo DEVICE_USER=$REMOTE_DEVICE_USER>>.env
echo DEVICE_PW=$REMOTE_DEVICE_PW>>.env
fi
echo ORCH_CONFIG=$ORCH_CONFIG>>.env
# Let the orchestrator handle python/run script tasks, unless explicitly told not to...
# If the orchestrator flag is not passed in, then source the env file and call run-tests.sh (Typically used for one off tests)
#
if [ -n "$ORCHESTRATOR" ]
then
echo "Bringing up the orchestrator image..."
docker-compose -f docker-compose.yml --env-file .env up -d --build perf-results-orchestrator
else
source .env
run-tests.sh
fi