Fix convenience configuration methods.

This commit is contained in:
Bob Lantz
2012-03-20 16:23:17 -07:00
parent ea7c326017
commit b684ff7844
+4 -6
View File
@@ -374,13 +374,13 @@ class Node( object ):
# Convenience and configuration methods # Convenience and configuration methods
def setMAC( self, mac, intf=''): def setMAC( self, mac, intf=None ):
"""Set the MAC address for an interface. """Set the MAC address for an interface.
intf: intf or intf name intf: intf or intf name
mac: MAC address as string""" mac: MAC address as string"""
return self.intf( intf ).setMAC( mac ) return self.intf( intf ).setMAC( mac )
def setIP( self, ip, prefixLen=8, intf='' ): def setIP( self, ip, prefixLen=8, intf=None ):
"""Set the IP address for an interface. """Set the IP address for an interface.
intf: interface name intf: interface name
ip: IP address as a string ip: IP address as a string
@@ -392,13 +392,11 @@ class Node( object ):
def IP( self, intf=None ): def IP( self, intf=None ):
"Return IP address of a node or specific interface." "Return IP address of a node or specific interface."
i = self.intf( intf ) return self.intf( intf ).IP()
return self.intf( i ).IP() if i else None
def MAC( self, intf=None ): def MAC( self, intf=None ):
"Return MAC address of a node or specific interface." "Return MAC address of a node or specific interface."
i = self.intf( intf ) return self.intf( intf ).IP()
return self.intf( i ).MAC() if i else None
def intfIsUp( self, intf=None ): def intfIsUp( self, intf=None ):
"Check if an interface is up." "Check if an interface is up."