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

Commit 09eeb8d

Browse files
committed
Added the noIP option to extra-topologies
By default it's false, mainly used for the dhcp module
1 parent 34ff855 commit 09eeb8d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mininet/extra-topos.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class ChainTopo(Topo):
55

6-
def __init__(self, numSwitches, numClients, numServers=0):
6+
def __init__(self, numSwitches, numClients, numServers=0, noIP=False):
77

88
# Add default members to class.
99
super(ChainTopo, self ).__init__()
@@ -15,16 +15,19 @@ def __init__(self, numSwitches, numClients, numServers=0):
1515
client_ids = ['h'+str(i) for i in range(1,numClients+1)]
1616
server_ids = ['hs'+str(i) for i in range(1,numServers+1)]
1717

18-
self.add_hosts(client_ids + server_ids)
18+
self.add_hosts(client_ids + server_ids,noIP)
1919
self.connect_hosts(switch_inds,client_ids,server_ids)
2020

2121
def add_switches(self,switch_inds):
2222
for i in switch_inds:
2323
self.addSwitch('s'+str(i))
2424

25-
def add_hosts(self,host_ids):
25+
def add_hosts(self,host_ids,noIP):
2626
for i in host_ids:
27-
self.addHost(i)
27+
if not noIP:
28+
self.addHost(i)
29+
else:
30+
self.addHost(i,ip=None)
2831

2932
def connect_switches(self,switch_ids):
3033

0 commit comments

Comments
 (0)