mirror of
https://github.com/Wojtek242/route0.git
synced 2024-11-21 23:05:24 +01:00
Add a one node topology
This commit is contained in:
parent
e843347a36
commit
1c74dd16c9
@ -7,6 +7,7 @@ from mininet.net import Mininet
|
||||
from mininet.cli import CLI
|
||||
|
||||
from router import Router
|
||||
from topology.one_node.topo import NetTopo as OneNode
|
||||
from topology.two_nodes.topo import NetTopo as TwoNodes
|
||||
from scenario import Basic, Plain
|
||||
|
||||
@ -64,6 +65,7 @@ def run(topo, scenario):
|
||||
|
||||
if __name__ == "__main__":
|
||||
topology = {
|
||||
"one_node": OneNode,
|
||||
"two_nodes": TwoNodes,
|
||||
}
|
||||
|
||||
|
29
topology/one_node/README.md
Normal file
29
topology/one_node/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
# One node topology
|
||||
|
||||
```
|
||||
------
|
||||
| |
|
||||
h1_1 ---|1 R1 2|--- h2_1
|
||||
| |
|
||||
------
|
||||
```
|
||||
|
||||
## R1
|
||||
|
||||
Interface | Name | Address/Subnet
|
||||
----------|---------|---------------
|
||||
0 | lo | 10.0.0.1/32
|
||||
1 | R1-eth1 | 10.1.0.254/24
|
||||
2 | R1-eth2 | 10.2.0.254/24
|
||||
|
||||
## h1_1
|
||||
|
||||
Interface | Name | Address/Subnet
|
||||
----------|-----------|---------------
|
||||
1 | h1_1-eth1 | 10.1.0.1/24
|
||||
|
||||
## h2_1
|
||||
|
||||
Interface | Name | Address/Subnet
|
||||
----------|-----------|---------------
|
||||
1 | h2_1-eth1 | 10.2.0.1/24
|
0
topology/one_node/__init__.py
Normal file
0
topology/one_node/__init__.py
Normal file
7
topology/one_node/staticd/h1_1.conf
Normal file
7
topology/one_node/staticd/h1_1.conf
Normal file
@ -0,0 +1,7 @@
|
||||
! -*- staticd -*-
|
||||
|
||||
hostname h1_1
|
||||
|
||||
ip route 0.0.0.0/0 10.1.0.254
|
||||
|
||||
log file /tmp/h1_1-staticd.log debugging
|
7
topology/one_node/staticd/h2_1.conf
Normal file
7
topology/one_node/staticd/h2_1.conf
Normal file
@ -0,0 +1,7 @@
|
||||
! -*- staticd -*-
|
||||
|
||||
hostname h2_1
|
||||
|
||||
ip route 0.0.0.0/0 10.2.0.254
|
||||
|
||||
log file /tmp/h2_1-staticd.log debugging
|
25
topology/one_node/topo.py
Normal file
25
topology/one_node/topo.py
Normal file
@ -0,0 +1,25 @@
|
||||
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')
|
||||
|
||||
# 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, h_1_1)
|
||||
self.addLink(r_1, h_2_1)
|
14
topology/one_node/zebra/R1.conf
Normal file
14
topology/one_node/zebra/R1.conf
Normal file
@ -0,0 +1,14 @@
|
||||
! -*- zebra -*-
|
||||
|
||||
hostname R1
|
||||
|
||||
interface lo
|
||||
ip address 10.0.0.1/32
|
||||
|
||||
interface R1-eth1
|
||||
ip address 10.1.0.254/24
|
||||
|
||||
interface R1-eth2
|
||||
ip address 10.2.0.254/24
|
||||
|
||||
log file /tmp/R1-zebra.log debugging
|
8
topology/one_node/zebra/h1_1.conf
Normal file
8
topology/one_node/zebra/h1_1.conf
Normal file
@ -0,0 +1,8 @@
|
||||
! -*- zebra -*-
|
||||
|
||||
hostname h1_1
|
||||
|
||||
interface h1_1-eth1
|
||||
ip address 10.1.0.1/24
|
||||
|
||||
log file /tmp/h1_1-zebra.log debugging
|
8
topology/one_node/zebra/h2_1.conf
Normal file
8
topology/one_node/zebra/h2_1.conf
Normal file
@ -0,0 +1,8 @@
|
||||
! -*- zebra -*-
|
||||
|
||||
hostname h2_1
|
||||
|
||||
interface h2_1-eth1
|
||||
ip address 10.2.0.1/24
|
||||
|
||||
log file /tmp/h2_1-zebra.log debugging
|
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
|
||||
from mininet.topo import Topo
|
||||
|
Loading…
Reference in New Issue
Block a user