From acffc30c3e06ffbd7a7a2128b8869c1fe1296e6f Mon Sep 17 00:00:00 2001 From: Katrina LaCurts Date: Tue, 1 Oct 2013 16:57:58 -0400 Subject: [PATCH] Custom topology for demo-ing Signed-off-by: Katrina LaCurts --- scripts/affinity-topo.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 scripts/affinity-topo.py diff --git a/scripts/affinity-topo.py b/scripts/affinity-topo.py new file mode 100644 index 0000000..77699a3 --- /dev/null +++ b/scripts/affinity-topo.py @@ -0,0 +1,37 @@ +#!/usr/bin/python + +from mininet.topo import Topo +from mininet.net import Mininet +from mininet.link import TCLink + +# To use this topology, run: +# > sudo mn --custom affinity-topo.py --topo affinity --link tc +# Using spaces rather than '=' is very important, as is having the --link flag + +class CustomTopo(Topo): + + def __init__(self, **opts): + Topo.__init__(self, **opts) + + # Three switches + s1 = self.addSwitch('s1') + s2 = self.addSwitch('s2') + s3 = self.addSwitch('s3') + + # Connect switches into tree + self.addLink(s2, s1) + self.addLink(s3, s1) + + # Four hosts + h1 = self.addHost('h1') + h2 = self.addHost('h2') + h3 = self.addHost('h3') + h4 = self.addHost('h4') + + # Connect hosts to switches + self.addLink(h1, s2, bw=10) # These two links get limited + self.addLink(h2, s2, bw=10) + self.addLink(h3, s3) + self.addLink(h4, s3) + +topos = { 'affinity' : (lambda: CustomTopo()) } -- 2.36.6