Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit 6d3fd86

Browse files
author
Joshua Reich
committed
cliques and cycles must have at least 3 switches
1 parent f00f2e2 commit 6d3fd86

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mininet/extra-topos.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class CycleTopo(ChainTopo):
6060
def connect_switches(self,switch_inds):
6161

6262
# Topology trivial if less than 2 switches
63-
if len(switch_inds) < 2:
64-
return
63+
if len(switch_inds) < 3:
64+
raise Exception("Cycles must have at least three switches (use 'linear,2' for n=2, 'single' for n=1)")
6565

6666
# Connect Switches in cycle topology
6767
for s in switch_inds:
@@ -72,8 +72,8 @@ class CliqueTopo(ChainTopo):
7272

7373
def connect_switches(self,switch_inds):
7474
# Topology trivial if less than 2 switches
75-
if len(switch_inds) < 2:
76-
return
75+
if len(switch_inds) < 3:
76+
raise Exception("Cliques must have at least three switches (use 'linear,2' for n=2, 'single' for n=1)")
7777

7878
# Connect Switches in clique topology
7979
for s1 in switch_inds:

0 commit comments

Comments
 (0)