blob: ba69f7712b425f39c379c0700f29550fe9af2ef5 [file] [log] [blame]
Carmelo Casconef11513d2018-01-16 00:31:14 -08001#!/usr/bin/env bash
2
Carmelo Casconef11513d2018-01-16 00:31:14 -08003bm-cli () {
4 if [ -z "$1" ]; then
Carmelo Casconec2821332018-05-14 18:15:33 -07005 echo "No argument supplied. Usage: bm-cli <MININET SWITCH NAME>"
Carmelo Casconef11513d2018-01-16 00:31:14 -08006 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 Cascone65aa8292018-11-08 11:54:33 -080010 bm_CLI --thrift-port ${tport} --pre SimplePreLAG ${@:2}
Carmelo Casconef11513d2018-01-16 00:31:14 -080011}
12
13bm-dbg () {
14 if [ -z "$1" ]; then
Carmelo Casconec2821332018-05-14 18:15:33 -070015 echo "No argument supplied. Usage: bm-dbg <MININET SWITCH NAME>"
Carmelo Casconef11513d2018-01-16 00:31:14 -080016 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 Casconec2821332018-05-14 18:15:33 -070020 sudo bm_p4dbg --thrift-port ${tport} --socket ipc:///tmp/bmv2-$1-debug.ipc ${@:2}
Carmelo Casconef11513d2018-01-16 00:31:14 -080021}
22
23bm-nmsg () {
24 if [ -z "$1" ]; then
Carmelo Casconec2821332018-05-14 18:15:33 -070025 echo "No argument supplied. Usage: bm-nmsg <MININET SWITCH NAME>"
Carmelo Casconef11513d2018-01-16 00:31:14 -080026 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 Cascone57defd32018-05-11 14:34:01 -070030 sudo bm_nanomsg_events --thrift-port ${tport} ${@:2}
Carmelo Casconef11513d2018-01-16 00:31:14 -080031}
32
33bm-log () {
34 if [ -z "$1" ]; then
Carmelo Casconec2821332018-05-14 18:15:33 -070035 echo "No argument supplied. Usage: bm-log <MININET SWITCH NAME>"
Carmelo Casconef11513d2018-01-16 00:31:14 -080036 return
37 fi
38 echo "Showing log for BMv2 instance $1..."
39 echo "---"
40 tail -f /tmp/bmv2-$1-log
41}