From a802d8b19a5e03f45d733b242ccbc475010471a3 Mon Sep 17 00:00:00 2001 From: Brian O'Connor Date: Thu, 3 Oct 2013 15:19:34 -0700 Subject: [PATCH] more NAT cleanup of net and topo --- mininet/net.py | 21 --------------------- mininet/topo.py | 12 ------------ 2 files changed, 33 deletions(-) diff --git a/mininet/net.py b/mininet/net.py index 64174fc..f2f49b3 100755 --- a/mininet/net.py +++ b/mininet/net.py @@ -181,10 +181,6 @@ class Mininet( object ): self.nextCore = ( self.nextCore + 1 ) % self.numCores self.nextIP += 1 defaults.update( params ) - # TODO: clean this up - if params.get( 'isNAT', False ): - print "***** &&&&&& !!!! nat nat nat" - cls = NAT if not cls: cls = self.host h = cls( name, **defaults ) @@ -319,21 +315,6 @@ class Mininet( object ): host.cmd( 'ifconfig lo up' ) info( '\n' ) - ''' TODO: remove this! - def configGateway( self ): - """Add gateway routes to all hosts if the networks has a gateway.""" - if self.gateway: - gatewayIP = self.gateway.defaultIntf().IP() - for host in self.hosts: - if host.inNamespace and self.gateway: - host.cmd( 'ip route flush root 0/0' ) - host.cmd( 'route add -net', self.ipBase, 'dev', host.defaultIntf() ) - host.cmd( 'route add default gw', gatewayIP ) - else: - # Don't mess with hosts in the root namespace - pass - ''' - def buildFromTopo( self, topo=None ): """Build mininet from a topology object At the end of this function, everything should be connected @@ -392,8 +373,6 @@ class Mininet( object ): self.startTerms() if self.autoStaticArp: self.staticArp() - # TODO: remove this - #self.configGateway() self.built = True def startTerms( self ): diff --git a/mininet/topo.py b/mininet/topo.py index 4ae447c..2ab455c 100644 --- a/mininet/topo.py +++ b/mininet/topo.py @@ -12,7 +12,6 @@ setup for testing, and can even be emulated with the Mininet package. ''' from mininet.util import irange, natural, naturalSeq -from mininet.node import NAT class MultiGraph( object ): "Utility class to track nodes and edges - replaces networkx.Graph" @@ -90,17 +89,6 @@ class Topo(object): result = self.addNode(name, isSwitch=True, **opts) return result - def addNAT(self, name='nat', connect=True, inNamespace=False, **opts): - """Convenience method: Add NAT to graph. - name: NAT name - connect: True will automatically connect to the first switch""" - #nat = self.addNode(name, isNAT=True, inNamespace=False) - nat = self.addNode(name, cls=NAT, inNamespace=inNamespace, hosts=self.hosts(), **opts) - if connect: - # connect the NAT to the first switch - self.addLink(name, self.switches()[ 0 ]) - return nat - def addLink(self, node1, node2, port1=None, port2=None, **opts): """node1, node2: nodes to link together