]>
Commit | Line | Data |
---|---|---|
eeecce05 BP |
1 | #! /bin/sh |
2 | # | |
fa183acc | 3 | # Copyright (c) 2013, 2015, 2016 Nicira, Inc. |
eeecce05 BP |
4 | # |
5 | # Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | # you may not use this file except in compliance with the License. | |
7 | # You may obtain a copy of the License at: | |
8 | # | |
9 | # http://www.apache.org/licenses/LICENSE-2.0 | |
10 | # | |
11 | # Unless required by applicable law or agreed to in writing, software | |
12 | # distributed under the License is distributed on an "AS IS" BASIS, | |
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | # See the License for the specific language governing permissions and | |
15 | # limitations under the License. | |
16 | ||
17 | set -e | |
18 | ||
8da7cd8c | 19 | run() { |
1b1d2e6d | 20 | echo "$@" |
eeecce05 BP |
21 | (cd "$sandbox" && "$@") || exit 1 |
22 | } | |
23 | ||
8da7cd8c | 24 | run_xterm() { |
4cf272aa AZ |
25 | title=$1; |
26 | shift | |
27 | run xterm -T "$title" -e "$@" & | |
8da7cd8c AZ |
28 | } |
29 | ||
30 | rungdb() { | |
31 | under_gdb=$1 | |
60ceeb6c | 32 | gdb_run=$2 |
8da7cd8c | 33 | shift |
60ceeb6c AZ |
34 | shift |
35 | ||
8da7cd8c AZ |
36 | # Remove the --detach and to put the process under gdb control. |
37 | # Also remove --vconsole:off to allow error message to show up | |
38 | # on the console. | |
39 | # Use "DISPLAY" variable to determine out if X is supported | |
40 | if $under_gdb && [ "$DISPLAY" ]; then | |
41 | args=`echo $@ |sed s/--detach//g | sed s/--vconsole:off//g` | |
30a67866 | 42 | xterm_title=$1 |
60ceeb6c AZ |
43 | |
44 | gdb_cmd="" | |
45 | if $gdb_run; then | |
46 | gdb_cmd="-ex run" | |
47 | fi | |
48 | ||
49 | run_xterm $xterm_title gdb $gdb_cmd --args $args | |
8da7cd8c AZ |
50 | else |
51 | run $@ | |
52 | fi | |
53 | } | |
54 | ||
4b814d41 AZ |
55 | gdb_vswitchd=false |
56 | gdb_ovsdb=false | |
60ceeb6c AZ |
57 | gdb_vswitchd_ex=false |
58 | gdb_ovsdb_ex=false | |
91ae2065 | 59 | gdb_ovn_northd=false |
2c6bcfa2 | 60 | gdb_ovn_northd_ex=false |
717c7fc5 | 61 | gdb_ovn_controller=false |
2c6bcfa2 | 62 | gdb_ovn_controller_ex=false |
36561090 RB |
63 | gdb_ovn_controller_vtep=false |
64 | gdb_ovn_controller_vtep_ex=false | |
eeecce05 BP |
65 | builddir= |
66 | srcdir= | |
67 | schema= | |
68 | installed=false | |
69 | built=false | |
ff358c71 | 70 | ovn=false |
1369720c JP |
71 | ovnsb_schema= |
72 | ovnnb_schema= | |
e170fc09 | 73 | ovn_rbac=true |
1e8eeb66 | 74 | n_northds=1 |
047458de | 75 | n_controllers=1 |
1b1d2e6d BP |
76 | nbdb_model=standalone |
77 | nbdb_servers=3 | |
78 | sbdb_model=backup | |
79 | sbdb_servers=3 | |
24d04cff | 80 | dummy=override |
8da7cd8c | 81 | |
eeecce05 BP |
82 | for option; do |
83 | # This option-parsing mechanism borrowed from a Autoconf-generated | |
84 | # configure script under the following license: | |
85 | ||
86 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | |
87 | # 2002, 2003, 2004, 2005, 2006, 2009, 2013 Free Software Foundation, Inc. | |
88 | # This configure script is free software; the Free Software Foundation | |
89 | # gives unlimited permission to copy, distribute and modify it. | |
90 | ||
91 | # If the previous option needs an argument, assign it. | |
92 | if test -n "$prev"; then | |
93 | eval $prev=\$option | |
94 | prev= | |
95 | continue | |
96 | fi | |
97 | case $option in | |
98 | *=*) optarg=`expr "X$option" : '[^=]*=\(.*\)'` ;; | |
99 | *) optarg=yes ;; | |
100 | esac | |
101 | ||
102 | case $dashdash$option in | |
103 | --) | |
104 | dashdash=yes ;; | |
105 | -h|--help) | |
106 | cat <<EOF | |
107 | ovs-sandbox, for starting a sandboxed dummy Open vSwitch environment | |
108 | usage: $0 [OPTION...] | |
109 | ||
110 | If you run ovs-sandbox from an OVS build directory, it uses the OVS that | |
111 | you built. Otherwise, if you have an installed Open vSwitch, it uses | |
112 | the installed version. | |
113 | ||
114 | These options force ovs-sandbox to use a particular OVS build: | |
115 | -b, --builddir=DIR specify Open vSwitch build directory | |
116 | -s, --srcdir=DIR specify Open vSwitch source directory | |
117 | These options force ovs-sandbox to use an installed Open vSwitch: | |
118 | -i, --installed use installed Open vSwitch | |
1b1d2e6d BP |
119 | |
120 | General options: | |
8da7cd8c | 121 | -g, --gdb-vswitchd run ovs-vswitchd under gdb |
4b814d41 | 122 | -d, --gdb-ovsdb run ovsdb-server under gdb |
91ae2065 | 123 | --gdb-ovn-northd run ovn-northd under gdb |
717c7fc5 | 124 | --gdb-ovn-controller run ovn-controller under gdb |
36561090 | 125 | --gdb-ovn-controller-vtep run ovn-controller-vtep under gdb |
24d04cff | 126 | --dummy=ARG pass --enable-dummy=ARG to vswitchd (default: override) |
2c6bcfa2 RB |
127 | -R, --gdb-run automatically start running the daemon in gdb |
128 | for any daemon set to run under gdb | |
eeecce05 | 129 | -S, --schema=FILE use FILE as vswitch.ovsschema |
1b1d2e6d BP |
130 | |
131 | OVN options: | |
ff358c71 | 132 | -o, --ovn enable OVN |
e170fc09 | 133 | --no-ovn-rbac disable role-based access control for OVN |
1e8eeb66 | 134 | --n-northds=NUMBER run NUMBER copies of northd (default: 1) |
1b1d2e6d BP |
135 | --nbdb-model=standalone|backup|clustered northbound database model |
136 | --nbdb-servers=N number of servers in nbdb cluster (default: 3) | |
137 | --sbdb-model=standalone|backup|clustered southbound database model | |
138 | --sbdb-servers=N number of servers in sbdb cluster (default: 3) | |
eeecce05 BP |
139 | |
140 | Other options: | |
141 | -h, --help Print this usage message. | |
142 | EOF | |
143 | exit 0 | |
144 | ;; | |
145 | ||
146 | --b*=*) | |
147 | builddir=$optarg | |
148 | built=: | |
149 | ;; | |
150 | -b|--b*) | |
151 | prev=builddir | |
152 | built=: | |
153 | ;; | |
154 | --sr*=*) | |
155 | srcdir=$optarg | |
156 | built=false | |
157 | ;; | |
24d04cff | 158 | --dummy) |
159 | prev=dummy | |
160 | ;; | |
161 | --dummy=*) | |
162 | dummy=$optarg | |
163 | ;; | |
eeecce05 BP |
164 | -s|--sr*) |
165 | prev=srcdir | |
166 | built=false | |
167 | ;; | |
168 | -i|--installed) | |
169 | installed=: | |
170 | ;; | |
171 | --sc*=*) | |
172 | schema=$optarg | |
173 | installed=: | |
174 | ;; | |
175 | -S|--sc*) | |
176 | prev=schema | |
177 | installed=: | |
178 | ;; | |
8da7cd8c AZ |
179 | -g|--gdb-v*) |
180 | gdb_vswitchd=true | |
60ceeb6c AZ |
181 | gdb_vswitchd_ex=false |
182 | ;; | |
183 | -e|--gdb-ex-v*) | |
184 | gdb_vswitchd=true | |
185 | gdb_vswitchd_ex=true | |
8da7cd8c | 186 | ;; |
30a67866 | 187 | -d|--gdb-ovsdb) |
4b814d41 | 188 | gdb_ovsdb=true |
60ceeb6c AZ |
189 | gdb_ovsdb_ex=false |
190 | ;; | |
191 | -r|--gdb-ex-o*) | |
192 | gdb_ovsdb=true | |
193 | gdb_ovsdb_ex=true | |
4b814d41 | 194 | ;; |
91ae2065 RB |
195 | --gdb-ovn-northd) |
196 | gdb_ovn_northd=true | |
30a67866 | 197 | ;; |
717c7fc5 JP |
198 | --gdb-ovn-controller) |
199 | gdb_ovn_controller=true | |
200 | ;; | |
36561090 RB |
201 | --gdb-ovn-controller-vtep) |
202 | gdb_ovn_controller_vtep=true | |
203 | ;; | |
ff358c71 RB |
204 | -o|--ovn) |
205 | ovn=true | |
206 | ;; | |
e170fc09 LR |
207 | --no-ovn-rbac) |
208 | ovn_rbac=false | |
209 | ;; | |
1e8eeb66 BP |
210 | --n-northd*=*) |
211 | n_northds=$optarg | |
212 | ;; | |
213 | --n-northd*) | |
214 | prev=n_northds | |
215 | ;; | |
047458de BP |
216 | --n-controller*=*) |
217 | n_controllers=$optarg | |
218 | ;; | |
219 | --n-controller*) | |
220 | prev=n_controllers | |
221 | ;; | |
1b1d2e6d BP |
222 | --nbdb-s*=*) |
223 | nbdb_servers=$optarg | |
224 | nbdb_model=clustered | |
225 | ;; | |
226 | --nbdb-s*) | |
227 | prev=nbdb_servers | |
228 | nbdb_model=clustered | |
229 | ;; | |
230 | --nbdb-m*=*) | |
231 | nbdb_model=$optarg | |
232 | ;; | |
233 | --nbdb-m*) | |
234 | prev=nbdb_model | |
235 | ;; | |
236 | --sbdb-s*=*) | |
237 | sbdb_servers=$optarg | |
238 | sbdb_model=clustered | |
239 | ;; | |
240 | --sbdb-s*) | |
241 | prev=sbdb_servers | |
242 | sbdb_model=clustered | |
243 | ;; | |
244 | --sbdb-m*=*) | |
245 | sbdb_model=$optarg | |
246 | ;; | |
247 | --sbdb-m*) | |
248 | prev=sbdb_model | |
249 | ;; | |
2c6bcfa2 RB |
250 | -R|--gdb-run) |
251 | gdb_vswitchd_ex=true | |
252 | gdb_ovsdb_ex=true | |
253 | gdb_ovn_northd_ex=true | |
254 | gdb_ovn_controller_ex=true | |
36561090 | 255 | gdb_ovn_controller_vtep_ex=true |
2c6bcfa2 | 256 | ;; |
eeecce05 BP |
257 | -*) |
258 | echo "unrecognized option $option (use --help for help)" >&2 | |
259 | exit 1 | |
260 | ;; | |
261 | *) | |
262 | echo "$option: non-option arguments not supported (use --help for help)" >&2 | |
263 | exit 1 | |
264 | ;; | |
265 | esac | |
266 | shift | |
267 | done | |
268 | ||
269 | if $installed && $built; then | |
270 | echo "sorry, conflicting options (use --help for help)" >&2 | |
271 | exit 1 | |
272 | elif $installed || $built; then | |
273 | : | |
274 | elif test -e vswitchd/ovs-vswitchd; then | |
275 | built=: | |
276 | builddir=. | |
277 | elif (ovs-vswitchd --version) >/dev/null 2>&1; then | |
278 | installed=: | |
279 | else | |
280 | echo "can't find an OVS build or install (use --help for help)" >&2 | |
281 | exit 1 | |
282 | fi | |
283 | ||
284 | if $built; then | |
285 | if test ! -e "$builddir"/vswitchd/ovs-vswitchd; then | |
286 | echo "$builddir does not appear to be an OVS build directory" >&2 | |
287 | exit 1 | |
288 | fi | |
289 | builddir=`cd $builddir && pwd` | |
290 | ||
291 | # Find srcdir. | |
292 | case $srcdir in | |
293 | '') | |
294 | srcdir=$builddir | |
3c8a3b31 | 295 | if test ! -e "$srcdir"/README.rst; then |
eeecce05 BP |
296 | srcdir=`cd $builddir/.. && pwd` |
297 | fi | |
298 | ;; | |
299 | /*) ;; | |
300 | *) srcdir=`pwd`/$srcdir ;; | |
301 | esac | |
302 | schema=$srcdir/vswitchd/vswitch.ovsschema | |
303 | if test ! -e "$schema"; then | |
304 | echo >&2 'source directory not found, please use --srcdir' | |
305 | exit 1 | |
306 | fi | |
ff358c71 | 307 | if $ovn; then |
1369720c JP |
308 | ovnsb_schema=$srcdir/ovn/ovn-sb.ovsschema |
309 | if test ! -e "$ovnsb_schema"; then | |
ff358c71 RB |
310 | echo >&2 'source directory not found, please use --srcdir' |
311 | exit 1 | |
312 | fi | |
1369720c JP |
313 | ovnnb_schema=$srcdir/ovn/ovn-nb.ovsschema |
314 | if test ! -e "$ovnnb_schema"; then | |
ff358c71 RB |
315 | echo >&2 'source directory not found, please use --srcdir' |
316 | exit 1 | |
317 | fi | |
36561090 RB |
318 | vtep_schema=$srcdir/vtep/vtep.ovsschema |
319 | if test ! -e "$vtep_schema"; then | |
320 | echo >&2 'source directory not found, please use --srcdir' | |
321 | exit 1 | |
322 | fi | |
ff358c71 | 323 | fi |
eeecce05 BP |
324 | |
325 | # Put built tools early in $PATH. | |
326 | if test ! -e $builddir/vswitchd/ovs-vswitchd; then | |
327 | echo >&2 'build not found, please change set $builddir or change directory' | |
328 | exit 1 | |
329 | fi | |
8013510c | 330 | PATH=$builddir/ovsdb:$builddir/vswitchd:$builddir/utilities:$builddir/vtep:$PATH |
ff358c71 | 331 | if $ovn; then |
72eaa2ba | 332 | PATH=$builddir/ovn/controller:$builddir/ovn/controller-vtep:$builddir/ovn/northd:$builddir/ovn/utilities:$PATH |
ff358c71 | 333 | fi |
eeecce05 BP |
334 | export PATH |
335 | else | |
336 | case $schema in | |
337 | '') | |
338 | for schema in \ | |
339 | /usr/local/share/openvswitch/vswitch.ovsschema \ | |
340 | /usr/share/openvswitch/vswitch.ovsschema \ | |
341 | none; do | |
342 | if test -r $schema; then | |
343 | break | |
344 | fi | |
345 | done | |
346 | ;; | |
347 | /*) ;; | |
348 | *) schema=`pwd`/$schema ;; | |
349 | esac | |
350 | if test ! -r "$schema"; then | |
351 | echo "can't find vswitch.ovsschema, please specify --schema" >&2 | |
352 | exit 1 | |
353 | fi | |
ff358c71 RB |
354 | if $ovn; then |
355 | echo "running with ovn is only supported from the build dir." >&2 | |
356 | exit 1 | |
357 | fi | |
eeecce05 BP |
358 | fi |
359 | ||
360 | # Create sandbox. | |
361 | rm -rf sandbox | |
362 | mkdir sandbox | |
363 | sandbox=`cd sandbox && pwd` | |
364 | ||
365 | # Set up environment for OVS programs to sandbox themselves. | |
366 | OVS_RUNDIR=$sandbox; export OVS_RUNDIR | |
367 | OVS_LOGDIR=$sandbox; export OVS_LOGDIR | |
368 | OVS_DBDIR=$sandbox; export OVS_DBDIR | |
369 | OVS_SYSCONFDIR=$sandbox; export OVS_SYSCONFDIR | |
370 | ||
371 | if $built; then | |
372 | # Easy access to OVS manpages. | |
986311be | 373 | (cd "$builddir" && ${MAKE-make} install-man install-man-rst mandir="$sandbox"/man) |
eeecce05 BP |
374 | MANPATH=$sandbox/man:; export MANPATH |
375 | fi | |
376 | ||
377 | # Ensure cleanup. | |
378 | trap 'kill `cat "$sandbox"/*.pid`' 0 1 2 3 13 14 15 | |
379 | ||
380 | # Create database and start ovsdb-server. | |
381 | touch "$sandbox"/.conf.db.~lock~ | |
431ad535 | 382 | run ovsdb-tool create conf.db "$schema" |
ff358c71 RB |
383 | ovsdb_server_args= |
384 | if $ovn; then | |
ff358c71 | 385 | touch "$sandbox"/.ovnnb.db.~lock~ |
1369720c | 386 | run ovsdb-tool create ovnnb.db "$ovnnb_schema" |
36561090 | 387 | run ovsdb-tool create vtep.db "$vtep_schema" |
60bdd011 | 388 | ovsdb_server_args="vtep.db conf.db" |
60bdd011 | 389 | ovsdb_nb_server_args="ovnnb.db" |
0ced2a5c LR |
390 | |
391 | if [ "$HAVE_OPENSSL" = yes ]; then | |
392 | OVS_PKI="run ovs-pki --dir=$sandbox/pki --log=$sandbox/ovs-pki.log" | |
393 | $OVS_PKI -B 1024 init | |
394 | $OVS_PKI -B 1024 req+sign ovnsb switch | |
395 | $OVS_PKI -B 1024 req+sign ovnnb switch | |
5a0e4aec | 396 | for i in $(seq $n_controllers); do |
047458de | 397 | $OVS_PKI -B 1024 -u req+sign chassis-$i switch |
5a0e4aec | 398 | done |
0ced2a5c | 399 | fi |
ff358c71 | 400 | fi |
2128f9b4 | 401 | rungdb $gdb_ovsdb $gdb_ovsdb_ex ovsdb-server --detach --no-chdir --pidfile -vconsole:off --log-file -vsyslog:off \ |
c065e54d BP |
402 | --remote=punix:"$sandbox"/db.sock \ |
403 | --remote=db:Open_vSwitch,Open_vSwitch,manager_options \ | |
404 | $ovsdb_server_args | |
60bdd011 | 405 | if $ovn; then |
1b1d2e6d BP |
406 | ovn_start_db() { |
407 | local db=$1 model=$2 servers=$3 schema=$4 | |
408 | local DB=$(echo $db | tr a-z A-Z) | |
409 | local schema_name=$(ovsdb-tool schema-name $schema) | |
410 | ||
411 | case $model in | |
412 | standalone | backup) ;; | |
413 | clustered) | |
414 | case $servers in | |
415 | [1-9] | [1-9][0-9]) ;; | |
416 | *) echo "${db}db servers must be between 1 and 99" >&2 | |
417 | exit 1 | |
418 | ;; | |
419 | esac | |
420 | ;; | |
421 | *) | |
422 | echo "unknown ${db}db model \"$model\"" >&2 | |
423 | exit 1 | |
424 | ;; | |
425 | esac | |
426 | ||
427 | ovn_start_ovsdb_server() { | |
428 | local i=$1; shift | |
429 | rungdb $gdb_ovsdb $gdb_ovsdb_ex ovsdb-server --detach --no-chdir \ | |
430 | --pidfile=$db$i.pid -vconsole:off --log-file=$db$i.log \ | |
5a0e4aec | 431 | -vsyslog:off \ |
1b1d2e6d BP |
432 | --remote=db:$schema_name,${DB}_Global,connections \ |
433 | --private-key=db:$schema_name,SSL,private_key \ | |
434 | --certificate=db:$schema_name,SSL,certificate \ | |
435 | --ca-cert=db:$schema_name,SSL,ca_cert \ | |
436 | --ssl-protocols=db:$schema_name,SSL,ssl_protocols \ | |
437 | --ssl-ciphers=db:$schema_name,SSL,ssl_ciphers \ | |
438 | --unixctl=${db}$i --remote=punix:$db$i.ovsdb ${db}$i.db "$@" | |
439 | } | |
440 | ||
441 | case $model in | |
442 | standalone) | |
443 | run ovsdb-tool create ${db}1.db "$schema" | |
444 | ovn_start_ovsdb_server 1 | |
445 | remote=unix:${db}1.ovsdb | |
446 | ;; | |
447 | backup) | |
448 | for i in 1 2; do | |
449 | run ovsdb-tool create $db$i.db "$schema" | |
450 | done | |
78bc7b24 | 451 | ovn_start_ovsdb_server 1 |
1b1d2e6d BP |
452 | ovn_start_ovsdb_server 2 --sync-from=unix:${db}1.ovsdb |
453 | remote=unix:${db}1.ovsdb | |
454 | backup_note="$backup_note | |
455 | The backup server of OVN $DB can be accessed by: | |
456 | * ovn-${db}ctl --db=unix:`pwd`/sandbox/${db}2.ovsdb | |
457 | * ovs-appctl -t `pwd`/sandbox/${db}2 | |
458 | The backup database file is sandbox/${db}2.db | |
459 | " | |
460 | ;; | |
461 | clustered) | |
462 | for i in $(seq $servers); do | |
463 | if test $i = 1; then | |
464 | run ovsdb-tool create-cluster ${db}1.db "$schema" unix:${db}1.raft; | |
465 | else | |
466 | run ovsdb-tool join-cluster $db$i.db $schema_name unix:$db$i.raft unix:${db}1.raft | |
467 | fi | |
468 | ovn_start_ovsdb_server $i | |
469 | done | |
470 | remote=unix:${db}1.ovsdb | |
471 | for i in `seq 2 $n`; do | |
472 | remote=$remote,unix:$db$i.ovsdb | |
473 | done | |
474 | for i in $(seq $servers); do | |
475 | run ovsdb-client wait unix:$db$i.ovsdb $schema_name connected | |
476 | done | |
477 | ;; | |
478 | esac | |
479 | eval OVN_${DB}_DB=\$remote | |
480 | eval export OVN_${DB}_DB | |
481 | } | |
482 | ||
483 | backup_note= | |
484 | ovn_start_db nb "$nbdb_model" "$nbdb_servers" "$ovnnb_schema" | |
485 | ovn_start_db sb "$sbdb_model" "$sbdb_servers" "$ovnsb_schema" | |
60bdd011 | 486 | fi |
eeecce05 | 487 | |
e43a07ba AZ |
488 | #Add a small delay to allow ovsdb-server to launch. |
489 | sleep 0.1 | |
490 | ||
491 | #Wait for ovsdb-server to finish launching. | |
492 | if test ! -e "$sandbox"/db.sock; then | |
45a9c31d | 493 | printf "Waiting for ovsdb-server to start..." |
e43a07ba AZ |
494 | while test ! -e "$sandbox"/db.sock; do |
495 | sleep 1; | |
496 | done | |
497 | echo " Done" | |
498 | fi | |
499 | ||
6b2771c3 BP |
500 | # Initialize database. |
501 | run ovs-vsctl --no-wait -- init | |
502 | ||
eeecce05 | 503 | # Start ovs-vswitchd. |
2128f9b4 | 504 | rungdb $gdb_vswitchd $gdb_vswitchd_ex ovs-vswitchd --detach --no-chdir --pidfile -vconsole:off --log-file -vsyslog:off \ |
24d04cff | 505 | --enable-dummy=$dummy -vvconn -vnetdev_dummy |
eeecce05 | 506 | |
30a67866 | 507 | if $ovn; then |
0ced2a5c LR |
508 | ovn-nbctl init |
509 | ovn-sbctl init | |
510 | ||
e170fc09 | 511 | ovs-vsctl set open . external-ids:system-id=chassis-1 |
9e6ec60a | 512 | ovs-vsctl set open . external-ids:hostname=sandbox |
b705f9ea | 513 | ovs-vsctl set open . external-ids:ovn-encap-type=geneve |
717c7fc5 | 514 | ovs-vsctl set open . external-ids:ovn-encap-ip=127.0.0.1 |
717c7fc5 | 515 | |
0ced2a5c LR |
516 | if [ "$HAVE_OPENSSL" = yes ]; then |
517 | ovn-nbctl set-ssl $sandbox/ovnnb-privkey.pem $sandbox/ovnnb-cert.pem $sandbox/pki/switchca/cacert.pem | |
518 | ovn-nbctl set-connection pssl:6641 | |
519 | ovn-sbctl set-ssl $sandbox/ovnsb-privkey.pem $sandbox/ovnsb-cert.pem $sandbox/pki/switchca/cacert.pem | |
e170fc09 LR |
520 | if $ovn_rbac; then |
521 | ovn-sbctl set-connection role=ovn-controller pssl:6642 | |
522 | else | |
523 | ovn-sbctl set-connection pssl:6642 | |
524 | fi | |
0ced2a5c | 525 | ovs-vsctl set open . external-ids:ovn-remote=ssl:127.0.0.1:6642 |
e170fc09 | 526 | OVN_CTRLR_PKI="-p $sandbox/chassis-1-privkey.pem -c $sandbox/chassis-1-cert.pem -C $sandbox/pki/switchca/cacert.pem" |
0ced2a5c | 527 | else |
1b1d2e6d | 528 | ovs-vsctl set open . external-ids:ovn-remote=$OVN_SB_DB |
0ced2a5c LR |
529 | OVN_CTRLR_PKI="" |
530 | fi | |
1e8eeb66 BP |
531 | for i in $(seq $n_northds); do |
532 | rungdb $gdb_ovn_northd $gdb_ovn_northd_ex ovn-northd --detach \ | |
533 | --no-chdir --pidfile=ovn-northd$i.pid -vconsole:off \ | |
2128f9b4 | 534 | --log-file=ovn-northd$i.log -vsyslog:off \ |
1e8eeb66 BP |
535 | --ovnsb-db="$OVN_SB_DB" --ovnnb-db="$OVN_NB_DB" |
536 | done | |
047458de | 537 | for i in $(seq $n_controllers); do |
5a0e4aec | 538 | rungdb $gdb_ovn_controller $gdb_ovn_controller_ex ovn-controller \ |
2128f9b4 | 539 | $OVN_CTRLR_PKI --detach --no-chdir -vsyslog:off \ |
5a0e4aec | 540 | --pidfile=ovn-controller$i.pid -vconsole:off --log-file |
047458de | 541 | done |
60bdd011 RM |
542 | rungdb $gdb_ovn_controller_vtep $gdb_ovn_controller_vtep_ex \ |
543 | ovn-controller-vtep --detach --no-chdir --pidfile -vconsole:off \ | |
2128f9b4 | 544 | $OVN_CTRLR_PKI --log-file -vsyslog:off \ |
5a0e4aec | 545 | --ovnsb-db=unix:"$sandbox"/ovnsb_db.sock |
30a67866 RB |
546 | fi |
547 | ||
eeecce05 BP |
548 | cat <<EOF |
549 | ||
550 | ||
551 | ||
552 | ---------------------------------------------------------------------- | |
553 | You are running in a dummy Open vSwitch environment. You can use | |
554 | ovs-vsctl, ovs-ofctl, ovs-appctl, and other tools to work with the | |
79b4e6dc | 555 | dummy switch. |
eeecce05 | 556 | |
79b4e6dc RB |
557 | EOF |
558 | if $ovn; then cat << EOF | |
559 | This environment also has the OVN daemons and databases enabled. | |
560 | You can use ovn-nbctl and ovn-sbctl to interact with the OVN databases. | |
1b1d2e6d | 561 | $backup_note |
79b4e6dc RB |
562 | EOF |
563 | fi | |
564 | cat <<EOF | |
eeecce05 BP |
565 | Log files, pidfiles, and the configuration database are in the |
566 | "sandbox" subdirectory. | |
567 | ||
568 | Exit the shell to kill the running daemons. | |
569 | EOF | |
570 | ||
571 | status=0; $SHELL || status=$? | |
572 | ||
573 | cat <<EOF | |
574 | ---------------------------------------------------------------------- | |
575 | ||
576 | ||
577 | ||
578 | EOF | |
579 | ||
580 | exit $status |