Add warning in defaultIntf() if host has no interfaces.

Possibly this should be in intf() instead, as intf() is assumed
to always succeed.
This commit is contained in:
Bob Lantz
2012-03-20 15:46:54 -07:00
parent 8bebd37759
commit efc991547e
+5 -2
View File
@@ -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."