"""Custom topology: dual

Two directly connected switches plus 3 hosts for each switch:

   {h1,h2,h3} --- switch --- switch --- {h4,h5,h6}
"""

from mininet.topo import Topo

class DualTopo(Topo):
    "Simple topology example with two switches."

    def __init__(self):
        "Create custom topo."

        # Initialize topology
        Topo.__init__(self)

        # Add hosts and switches
        h1 = self.addHost('h1')
        h2 = self.addHost('h2')
        h3 = self.addHost('h3')
        leftSwitch = self.addSwitch('s1')
        rightSwitch = self.addSwitch('s2')
        h4 = self.addHost('h4')
        h5 = self.addHost('h5')
        h6 = self.addHost('h6')

        # Add links
        self.addLink(h1, leftSwitch)
        self.addLink(h2, leftSwitch)
        self.addLink(h3, leftSwitch)
        self.addLink(leftSwitch, rightSwitch)
        self.addLink(rightSwitch, h4)
        self.addLink(rightSwitch, h5)
        self.addLink(rightSwitch, h6)


topos = { 'dual': (lambda: DualTopo()) }
