Build BMv2 with debugger in onos-setup-p4-dev

Tested on Ubuntu 14.04, not 16.04.

Also, bumped version of PI and BMv2.

Change-Id: I00319f12f077608a66c7e07fd59a7f1ca835c391
diff --git a/tools/dev/bin/onos-setup-p4-dev b/tools/dev/bin/onos-setup-p4-dev
index 63ac02a..dd8dd3e 100755
--- a/tools/dev/bin/onos-setup-p4-dev
+++ b/tools/dev/bin/onos-setup-p4-dev
@@ -15,8 +15,8 @@
 set -e
 
 BUILD_DIR=~/p4tools
-BMV2_COMMIT="654e9c3794273b481284d8bafecfc74c7ffd643d"
-PI_COMMIT="8051d54c9c3415ca800db232a226189fd17ad60a"
+BMV2_COMMIT="a9b9fb3e30585bf880b252a3e00338ebca67b572"
+PI_COMMIT="b8d937fa72650eb6ec57d2e5755e0c9103fa995f"
 P4C_COMMIT="adce375fd961a9e467c7e77ad1bef647ef28e5e8"
 P4C_BM_COMMIT="8f4abeaa6f8374aaf95ea2aacfc2b750069391b5"
 PROTOBUF_COMMIT="tags/v3.0.2"
@@ -163,9 +163,18 @@
     git fetch
     git checkout ${BMV2_COMMIT}
 
+    # From bmv2's install_deps.sh
+    tmpdir=`mktemp -d -p .`
+    cd ${tmpdir}
+    bash ../travis/install-thrift.sh
+    bash ../travis/install-nanomsg.sh
+    sudo ldconfig
+    bash ../travis/install-nnpy.sh
+    cd ..
+    sudo rm -rf $tmpdir
+
     ./autogen.sh
-    # TODO: to build with debugger, we need to install nanomsg first (see bmv2's install_deps.sh)
-    ./configure --without-thrift --without-nanomsg --with-pi
+    ./configure --enable-debugger --with-pi
     make -j${NUM_CORES}
     sudo make install
     sudo ldconfig
diff --git a/tools/dev/mininet/bmv2.py b/tools/dev/mininet/bmv2.py
index 6b31d05..60ad28c 100644
--- a/tools/dev/mininet/bmv2.py
+++ b/tools/dev/mininet/bmv2.py
@@ -23,9 +23,10 @@
     instanceCount = 0
 
     def __init__(self, name, json=None, debugger=False, loglevel="warn", elogger=False,
-                 persistent=False, grpcPort=None, netcfg=True, **kwargs):
+                 persistent=False, grpcPort=None, thriftPort=None, netcfg=True, **kwargs):
         Switch.__init__(self, name, **kwargs)
         self.grpcPort = ONOSBmv2Switch.pickUnusedPort() if not grpcPort else grpcPort
+        self.thriftPort = ONOSBmv2Switch.pickUnusedPort() if not thriftPort else thriftPort
         if self.dpid:
             self.deviceId = int(self.dpid, 0 if 'x' in self.dpid else 16)
         else:
@@ -120,6 +121,7 @@
             args.append('--debugger')
         args.append('--log-console')
         args.append('-L%s' % self.loglevel)
+        args.append('--thrift-port %d' % self.thriftPort)
         if not self.json:
             args.append('--no-p4')
         else: