Skip to content
Snippets Groups Projects
Commit a802d8b1 authored by Brian O'Connor's avatar Brian O'Connor
Browse files

more NAT cleanup of net and topo

parent 555d10de
No related branches found
No related tags found
No related merge requests found
......@@ -181,10 +181,6 @@ def addHost( self, name, cls=None, **params ):
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 @@ def configHosts( self ):
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 @@ def build( self ):
self.startTerms()
if self.autoStaticArp:
self.staticArp()
# TODO: remove this
#self.configGateway()
self.built = True
def startTerms( self ):
......
......@@ -12,7 +12,6 @@
'''
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 @@ def addSwitch(self, name, **opts):
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment