Add options for auto MAC and ARP setup.

Auto MAC setup sets each host MAC equal to its DPID, which simplifies
debugging.

Auto ARP setup removes the need for broadcast support for ARP, which
enables a smaller NOX controller.
This commit is contained in:
Brandon Heller
2010-01-03 09:16:14 -08:00
parent 433a7cc88c
commit 376bcba442
4 changed files with 88 additions and 11 deletions
+23 -1
View File
@@ -175,4 +175,26 @@ def createLink(node1, node2):
def fixLimits():
'''Fix ridiculously small resource limits.'''
setrlimit( RLIMIT_NPROC, (4096, 8192))
setrlimit( RLIMIT_NOFILE, (16384, 32768))
setrlimit( RLIMIT_NOFILE, (16384, 32768))
def macColonHex(mac):
'''Generate MAC colon-hex string from unsigned int.
@param mac MAC address as unsigned int
@return mac_str MAC colon-hex string
'''
mac_pieces = []
for i in range (5, -1, -1):
mac_pieces.append('%02x' % (((0xff << (i * 8)) & mac) >> (i * 8)))
mac_str = ':'.join(mac_pieces)
return mac_str
def ipStr(ip):
'''Generate IP address string
@return ip addr string
'''
hi = (ip & 0xff0000) >> 16
mid = (ip & 0xff00) >> 8
lo = ip & 0xff
return "10.%i.%i.%i" % (hi, mid, lo)