2019-04-06 15:35:34 +02:00
|
|
|
import os
|
|
|
|
|
2019-04-06 13:52:26 +02:00
|
|
|
from mininet.topo import Topo
|
|
|
|
|
|
|
|
|
|
|
|
class NetTopo(Topo):
|
|
|
|
"""The network topology.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
# Add default members to class.
|
|
|
|
super(NetTopo, self).__init__()
|
|
|
|
|
2019-04-06 14:57:58 +02:00
|
|
|
# Add routers
|
2019-04-06 13:52:26 +02:00
|
|
|
r_1 = self.addSwitch('R1')
|
|
|
|
r_2 = self.addSwitch('R2')
|
|
|
|
|
2019-04-06 14:57:58 +02:00
|
|
|
# Add hosts
|
|
|
|
h_1_1 = self.addSwitch('h1_1')
|
|
|
|
h_2_1 = self.addSwitch('h2_1')
|
|
|
|
|
|
|
|
# Setup links as shown in README.md
|
2019-04-06 13:52:26 +02:00
|
|
|
self.addLink(r_1, r_2)
|
2019-04-06 14:57:58 +02:00
|
|
|
self.addLink(r_1, h_1_1)
|
|
|
|
self.addLink(r_2, h_2_1)
|