From efc991547ee0a283425373aa4dcf6c68ba3d5717 Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Tue, 20 Mar 2012 15:46:54 -0700 Subject: [PATCH] Add warning in defaultIntf() if host has no interfaces. Possibly this should be in intf() instead, as intf() is assumed to always succeed. --- mininet/node.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mininet/node.py b/mininet/node.py index ad73ef5..9c9dbef 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -310,16 +310,19 @@ class Node( object ): ports = self.intfs.keys() if ports: return self.intfs[ min( ports ) ] + else: + warn( '*** defaultIntf: warning:', self.name, + 'has no interfaces\n' ) def intf( self, intf='' ): - """Return our interface object with given name,x + """Return our interface object with given name, or default intf if name is empty""" if not intf: return self.defaultIntf() elif type( intf) is str: return self.nameToIntf[ intf ] else: - return intf + return None def connectionsTo( self, node): "Return [ intf1, intf2... ] for all intfs that connect self to node."