more NAT cleanup of net and topo

This commit is contained in:
Brian O'Connor
2013-10-03 15:19:34 -07:00
parent 555d10dea7
commit a802d8b19a
2 changed files with 0 additions and 33 deletions
-21
View File
@@ -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 ):
-12
View File
@@ -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