more NAT cleanup of net and topo
This commit is contained in:
@@ -181,10 +181,6 @@ class Mininet( object ):
|
|||||||
self.nextCore = ( self.nextCore + 1 ) % self.numCores
|
self.nextCore = ( self.nextCore + 1 ) % self.numCores
|
||||||
self.nextIP += 1
|
self.nextIP += 1
|
||||||
defaults.update( params )
|
defaults.update( params )
|
||||||
# TODO: clean this up
|
|
||||||
if params.get( 'isNAT', False ):
|
|
||||||
print "***** &&&&&& !!!! nat nat nat"
|
|
||||||
cls = NAT
|
|
||||||
if not cls:
|
if not cls:
|
||||||
cls = self.host
|
cls = self.host
|
||||||
h = cls( name, **defaults )
|
h = cls( name, **defaults )
|
||||||
@@ -319,21 +315,6 @@ class Mininet( object ):
|
|||||||
host.cmd( 'ifconfig lo up' )
|
host.cmd( 'ifconfig lo up' )
|
||||||
info( '\n' )
|
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 ):
|
def buildFromTopo( self, topo=None ):
|
||||||
"""Build mininet from a topology object
|
"""Build mininet from a topology object
|
||||||
At the end of this function, everything should be connected
|
At the end of this function, everything should be connected
|
||||||
@@ -392,8 +373,6 @@ class Mininet( object ):
|
|||||||
self.startTerms()
|
self.startTerms()
|
||||||
if self.autoStaticArp:
|
if self.autoStaticArp:
|
||||||
self.staticArp()
|
self.staticArp()
|
||||||
# TODO: remove this
|
|
||||||
#self.configGateway()
|
|
||||||
self.built = True
|
self.built = True
|
||||||
|
|
||||||
def startTerms( self ):
|
def startTerms( self ):
|
||||||
|
|||||||
@@ -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.util import irange, natural, naturalSeq
|
||||||
from mininet.node import NAT
|
|
||||||
|
|
||||||
class MultiGraph( object ):
|
class MultiGraph( object ):
|
||||||
"Utility class to track nodes and edges - replaces networkx.Graph"
|
"Utility class to track nodes and edges - replaces networkx.Graph"
|
||||||
@@ -90,17 +89,6 @@ class Topo(object):
|
|||||||
result = self.addNode(name, isSwitch=True, **opts)
|
result = self.addNode(name, isSwitch=True, **opts)
|
||||||
return result
|
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,
|
def addLink(self, node1, node2, port1=None, port2=None,
|
||||||
**opts):
|
**opts):
|
||||||
"""node1, node2: nodes to link together
|
"""node1, node2: nodes to link together
|
||||||
|
|||||||
Reference in New Issue
Block a user