blob: fdb8340bacba3060d147f083c39502d7c47e3b29 [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 Cascone57defd32018-05-11 14:34:01 -070010 sudo bm_CLI --thrift-port ${tport} ${@: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}