def connectToRootNS(network, switch, ip, routes):
 root = Node('root', inNamespace=False)
 intf = network.addLink(root, switch).intf1
 root.setIP(ip, intf=intf)
 network.start()
 for route in routes:
  root.cmd(((('route add -net ' + route) + ' dev ') + str(intf)))

def connectToRootNS ( network , switch , ip , routes ) : root = Node ( 'root' , inNamespace = False ) intf = network . addLink ( root , switch ) . intf1 root . setIP ( ip , intf = intf ) network . start ( ) for route in routes : root . cmd ( ( ( ( 'route add -net ' + route ) + ' dev ' ) + str ( intf ) ) )
connect hosts to root namespace via switch .