Fixed createLink args and cleaned up slightly.

This commit is contained in:
Bob Lantz
2010-03-09 21:47:02 -08:00
parent 73a323f2a2
commit 1a9d2eac29
+2 -4
View File
@@ -37,12 +37,10 @@ def connectToRootNS( network, switch, ip, prefixLen, routes ):
routes: host networks to route to"""
# Create a node in root namespace and link to switch 0
root = Node( 'root', inNamespace=False )
port = max( switch.ports.values() ) + 1
createLink( root, 0, switch, port )
root.setIP( root.intfs[ 0 ], ip, prefixLen )
intf = createLink( root, switch )[ 0 ]
root.setIP( intf, ip, prefixLen )
# Start network that now includes link to root namespace
network.start()
intf = root.intfs[ 0 ]
# Add routes from root ns to hosts
for route in routes:
root.cmd( 'route add -net ' + route + ' dev ' + intf )