Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 3 | bm-cli () { |
| 4 | if [ -z "$1" ]; then |
Carmelo Cascone | c282133 | 2018-05-14 18:15:33 -0700 | [diff] [blame] | 5 | echo "No argument supplied. Usage: bm-cli <MININET SWITCH NAME>" |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 6 | return |
| 7 | fi |
| 8 | tport=$(head -n 1 /tmp/bmv2-$1-thrift-port) |
| 9 | echo "Starting CLI for BMv2 instance $1 (Thrift port $tport)..." |
Carmelo Cascone | 65aa829 | 2018-11-08 11:54:33 -0800 | [diff] [blame] | 10 | bm_CLI --thrift-port ${tport} --pre SimplePreLAG ${@:2} |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | bm-dbg () { |
| 14 | if [ -z "$1" ]; then |
Carmelo Cascone | c282133 | 2018-05-14 18:15:33 -0700 | [diff] [blame] | 15 | echo "No argument supplied. Usage: bm-dbg <MININET SWITCH NAME>" |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 16 | return |
| 17 | fi |
| 18 | tport=$(head -n 1 /tmp/bmv2-$1-thrift-port) |
| 19 | echo "Starting debugger for BMv2 instance $1 (Thrift port $tport)..." |
Carmelo Cascone | c282133 | 2018-05-14 18:15:33 -0700 | [diff] [blame] | 20 | sudo bm_p4dbg --thrift-port ${tport} --socket ipc:///tmp/bmv2-$1-debug.ipc ${@:2} |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | bm-nmsg () { |
| 24 | if [ -z "$1" ]; then |
Carmelo Cascone | c282133 | 2018-05-14 18:15:33 -0700 | [diff] [blame] | 25 | echo "No argument supplied. Usage: bm-nmsg <MININET SWITCH NAME>" |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 26 | return |
| 27 | fi |
| 28 | tport=$(head -n 1 /tmp/bmv2-$1-thrift-port) |
| 29 | echo "Starting nanomsg event listener for BMv2 instance $1 (Thrift port $tport)..." |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 30 | sudo bm_nanomsg_events --thrift-port ${tport} ${@:2} |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | bm-log () { |
| 34 | if [ -z "$1" ]; then |
Carmelo Cascone | c282133 | 2018-05-14 18:15:33 -0700 | [diff] [blame] | 35 | echo "No argument supplied. Usage: bm-log <MININET SWITCH NAME>" |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 36 | return |
| 37 | fi |
| 38 | echo "Showing log for BMv2 instance $1..." |
| 39 | echo "---" |
| 40 | tail -f /tmp/bmv2-$1-log |
| 41 | } |