added some documentation

This commit is contained in:
cody burkard
2014-08-01 11:27:25 -07:00
parent f0fd84770a
commit 42cdda38bb
4 changed files with 14 additions and 24 deletions
+8 -3
View File
@@ -42,6 +42,9 @@ class Intf( object ):
self.link = link
self.mac = mac
self.ip, self.prefixLen = None, None
# if interface is lo, we know the ip is 127.0.0.1.
# This saves an ifconfig command per node
if self.name == 'lo':
self.ip = '127.0.0.1'
# Add to node (and move ourselves if necessary )
@@ -94,10 +97,12 @@ class Intf( object ):
self.mac = macs[ 0 ] if macs else None
return self.mac
# Instead of updating ip and mac separately,
# use one ifconfig call to do it simultaneously.
# This saves an ifconfig command, which improves performance.
def updateAddr( self ):
"""Return IP address and MAC address based on ifconfig.
instead of updating ip and mac separately,
use one ifconfig call to do it simultaneously"""
"Return IP address and MAC address based on ifconfig."
ifconfig = self.ifconfig()
ips = self._ipMatchRegex.findall( ifconfig )
macs = self._macMatchRegex.findall( ifconfig )