All done! GUI + working version. Some few adjustments on the code to be done.
diff --git a/mininet/conf_parser.py b/mininet/conf_parser.py
index 07eb8c9..ae514f3 100644
--- a/mininet/conf_parser.py
+++ b/mininet/conf_parser.py
@@ -30,18 +30,18 @@
hosts = []
- items = config.items('nodes')
+ items = config.items('hosts')
- #makes a first-pass read to nodes section to find empty nodes sections
+ #makes a first-pass read to hosts section to find empty host sections
for item in items:
name = item[0]
rest = item[1].split()
if len(rest) == 0:
- config.set('nodes', name, '_')
+ config.set('hosts', name, '_')
#updates 'items' list
- items = config.items('nodes')
+ items = config.items('hosts')
- #makes a second-pass read to nodes section to properly add hosts
+ #makes a second-pass read to hosts section to properly add hosts
for item in items:
name = item[0]
@@ -90,14 +90,22 @@
uri_list=[]
cpu = None
cores = None
+ cache = None
- for uri in uris:
- if re.match("cpu",uri):
- cpu = float(uri.split('=')[1])
- elif re.match("cores",uri):
- cores = uri.split('=')[1]
- else:
- uri_list.append((uri.split(',')[0],uri.split(',')[1]))
+ if '_' in uris:
+ pass
+ else:
+ for uri in uris:
+ if re.match("cpu",uri):
+ cpu = float(uri.split('=')[1])
+ elif re.match("cores",uri):
+ cores = uri.split('=')[1]
+ elif re.match("cache",uri):
+ cache = uri.split('=')[1]
+ elif re.match("mem",uri):
+ mem = uri.split('=')[1]
+ else:
+ uri_list.append((uri.split(',')[0],uri.split(',')[1]))
routers.append(confCCNHost(name=name , uri_tuples=uri_list, cpu=cpu, cores=cores))
@@ -143,6 +151,3 @@
return links
-
-
-
diff --git a/mininet/net.py b/mininet/net.py
index 1255e12..2d6bca6 100644
--- a/mininet/net.py
+++ b/mininet/net.py
@@ -99,6 +99,7 @@
from mininet.util import quietRun, fixLimits, numCores, ensureRoot
from mininet.util import macColonHex, ipStr, ipParse, netParse, ipAdd, nextCCNnet
from mininet.term import cleanUpScreens, makeTerms
+import pdb
# Mininet version: should be consistent with README and LICENSE
VERSION = "2.0.0"
@@ -176,18 +177,20 @@
params: parameters for host
returns: added host"""
# Default IP and MAC addresses
-
- defaults = { 'ip': ipAdd( self.nextIP,
- ipBaseNum=self.ipBaseNum,
- prefixLen=self.prefixLen ) +
- '/%s' % self.prefixLen }
- if self.autoSetMacs:
- defaults[ 'mac'] = macColonHex( self.nextIP )
- if self.autoPinCpus:
- defaults[ 'cores' ] = self.nextCore
- self.nextCore = ( self.nextCore + 1 ) % self.numCores
- self.nextIP += 1
+ #pdb.set_trace()
+ #defaults = { 'ip': ipAdd( self.nextIP,
+ #ipBaseNum=self.ipBaseNum,
+ #prefixLen=self.prefixLen ) +
+ #'/%s' % self.prefixLen }
+ #if self.autoSetMacs:
+ #defaults[ 'mac'] = macColonHex( self.nextIP )
+ #if self.autoPinCpus:
+ #defaults[ 'cores' ] = self.nextCore
+ #self.nextCore = ( self.nextCore + 1 ) % self.numCores
+ #self.nextIP += 1
+ defaults = {}
defaults.update( params )
+
if not cls:
cls = self.host
h = cls( name, **defaults )
@@ -286,17 +289,18 @@
info( '*** Creating network\n' )
- if not self.controllers:
+ #if not self.controllers:
# Add a default controller
- info( '*** Adding controller\n' )
- classes = self.controller
- if type( classes ) is not list:
- classes = [ classes ]
- for i, cls in enumerate( classes ):
- self.addController( 'c%d' % i, cls )
+ #info( '*** Adding controller\n' )
+ #classes = self.controller
+ #if type( classes ) is not list:
+ # classes = [ classes ]
+ #for i, cls in enumerate( classes ):
+ # self.addController( 'c%d' % i, cls )
info( '*** Adding hosts:\n' )
for hostName in topo.hosts():
+ #pdb.set_trace()
self.addHost( hostName, **topo.nodeInfo( hostName ) )
info( hostName + ' ' )
@@ -328,6 +332,7 @@
def build( self ):
"Build mininet."
+
if self.topo:
self.buildFromTopo( self.topo )
if ( self.inNamespace ):
diff --git a/mininet/node.py b/mininet/node.py
index 281839a..8749987 100644
--- a/mininet/node.py
+++ b/mininet/node.py
@@ -55,6 +55,7 @@
numCores, retry, mountCgroups, run )
from mininet.moduledeps import moduleDeps, pathCheck, OVS_KMOD, OF_KMOD, TUN
from mininet.link import Link, Intf, TCIntf
+import pdb
class Node( object ):
"""A virtual network node is simply a shell in a network namespace.
@@ -728,6 +729,7 @@
self.cmd("export CCND_DEBUG=6")
self.cmd("export CCND_LOG=./log.{0}".format(self.name))
+ #pdb.set_trace()
# print self.params['cache']
if self.params['cache'] != None:
self.cmd("export CCND_CAP={0}".format(self.params['cache']))
diff --git a/mininet/topo.py b/mininet/topo.py
index fff9604..bd4afb5 100644
--- a/mininet/topo.py
+++ b/mininet/topo.py
@@ -17,11 +17,12 @@
from networkx import Graph
from mininet.util import irange, natural, naturalSeq
+import pdb
class Topo(object):
"Data center network representation for structured multi-trees."
- def __init__(self, hopts=None, sopts=None, lopts=None):
+ def __init__(self, hopts=None, sopts=None, lopts=None, ropts=None):
"""Topo object:
hinfo: default host options
sopts: default switch options
@@ -30,6 +31,7 @@
self.node_info = {}
self.link_info = {} # (src, dst) tuples hash to EdgeInfo objects
self.hopts = {} if hopts is None else hopts
+ self.ropts = {} if ropts is None else ropts
self.sopts = {} if sopts is None else sopts
self.lopts = {} if lopts is None else lopts
self.ports = {} # ports[src][dst] is port on src that connects to dst
@@ -48,8 +50,12 @@
name: host name
opts: host options
returns: host name"""
- if not opts and self.hopts:
+ #pdb.set_trace()
+ if not opts:
+ if self.hopts:
opts = self.hopts
+ elif self.ropts:
+ opts = self.ropts
return self.addNode(name, **opts)
def addSwitch(self, name, **opts):
@@ -102,6 +108,7 @@
def isSwitch(self, n):
'''Returns true if node is a switch.'''
+ #pdb.set_trace()
info = self.node_info[n]
return info and info.get('isSwitch', False)