From ccd3276dcf10139eb6a7a92a54b8c14b761396e0 Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Wed, 5 Nov 2014 18:43:58 -0800
Subject: [PATCH] Raise exception if DefaultController cannot find a controller

---
 mininet/node.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mininet/node.py b/mininet/node.py
index 73602b18..1f850620 100644
--- a/mininet/node.py
+++ b/mininet/node.py
@@ -1436,4 +1436,8 @@ def findController( controllers=DefaultControllers ):
 
 def DefaultController( name, controllers=DefaultControllers, **kwargs ):
     "Find a controller that is available and instantiate it"
-    return findController( controllers )( name, **kwargs )
+    controller = findController( controllers )
+    if not controller:
+        raise Exception( 'Could not find a default OpenFlow controller' )
+    return controller( name, **kwargs )
+
-- 
GitLab