I've written the following Mininet topology for k-ary fat-trees.
from mininet.topo import Topo
class FatTreeTopo(Topo):
def build(self, k=4):
# k is the parameter that determines the size of the Fat-Tree
# spine switches
spine_switches = [self.addSwitch(f"spn{i}") for i in range((k//2)**2)]
# |pods| = k
# fabric switches
fab_switches = [self.addSwitch(f"fab{i}") for i in range(k**2//2)]
# tor switches
tor_switches = [self.addSwitch(f"tor{i}") for i in range(k**2//2)]
# servers
servers = [self.addHost(f"srv{i}") for i in range(k**3//4)]
# Connect core switches to aggregation switches
for c in range((k//2)**2):
for pod in range(k):
f = pod * (k//2) + c//(k//2)
self.addLink(spine_switches[c], fab_switches[f])
# Connect fabric switches to tor switches
for f in range((k**2)//2):
si = f//(k//2) * (k//2)
for t in range(si, si + k//2):
self.addLink(fab_switches[f], tor_switches[t])
# Connect tor switches to servers
for t in range((k**2)//2):
si = t * (k//2)
for s in range(si, si + k//2):
self.addLink(tor_switches[t], servers[s])
When I run this code for k=4 none of my hosts (named srv#) can ping each other (tested by running pingall). For example srv0 ping srv1 returns the 'Destination Host Unreachable' message, however both the hosts are connected to the tor0 switch and can ping the switch, so I'm unsure why the switch does not forward messages between them.
The same code does work for k=2 and k=3, and I can successfully send messages between hosts.