Add a one node topology

This commit is contained in:
Wojciech Kozlowski 2019-04-06 17:59:00 +02:00
parent e843347a36
commit 1c74dd16c9
10 changed files with 100 additions and 2 deletions

View File

@ -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,
}

View 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

View File

View 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

View 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
View 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)

View 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

View 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

View 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

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
import os
from mininet.topo import Topo