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:
+5
-2
@@ -310,16 +310,19 @@ class Node( object ):
|
|||||||
ports = self.intfs.keys()
|
ports = self.intfs.keys()
|
||||||
if ports:
|
if ports:
|
||||||
return self.intfs[ min( ports ) ]
|
return self.intfs[ min( ports ) ]
|
||||||
|
else:
|
||||||
|
warn( '*** defaultIntf: warning:', self.name,
|
||||||
|
'has no interfaces\n' )
|
||||||
|
|
||||||
def intf( self, intf='' ):
|
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"""
|
or default intf if name is empty"""
|
||||||
if not intf:
|
if not intf:
|
||||||
return self.defaultIntf()
|
return self.defaultIntf()
|
||||||
elif type( intf) is str:
|
elif type( intf) is str:
|
||||||
return self.nameToIntf[ intf ]
|
return self.nameToIntf[ intf ]
|
||||||
else:
|
else:
|
||||||
return intf
|
return None
|
||||||
|
|
||||||
def connectionsTo( self, node):
|
def connectionsTo( self, node):
|
||||||
"Return [ intf1, intf2... ] for all intfs that connect self to node."
|
"Return [ intf1, intf2... ] for all intfs that connect self to node."
|
||||||
|
|||||||
Reference in New Issue
Block a user