mirror of
https://github.com/Wojtek242/route0.git
synced 2024-10-29 21:40:50 +01:00
28 lines
600 B
Python
28 lines
600 B
Python
import os
|
|
|
|
from mininet.topo import Topo
|
|
|
|
|
|
class NetTopo(Topo):
|
|
"""The network topology.
|
|
"""
|
|
|
|
topo_dir = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
def __init__(self):
|
|
# Add default members to class.
|
|
super(NetTopo, self).__init__()
|
|
|
|
# Add routers
|
|
r_1 = self.addSwitch('R1')
|
|
r_2 = self.addSwitch('R2')
|
|
|
|
# Add hosts
|
|
h_1_1 = self.addSwitch('h1_1')
|
|
h_2_1 = self.addSwitch('h2_1')
|
|
|
|
# Setup links as shown in README.md
|
|
self.addLink(r_1, r_2)
|
|
self.addLink(r_1, h_1_1)
|
|
self.addLink(r_2, h_2_1)
|