aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/tools/test/topos/rftesttopo.py
blob: 9b9757851535017fac0fdda0e0d1984583e57abe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python

"""
"""
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.node import Node
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.util import dumpNodeConnections

class ReactiveForwardingTestTopo( Topo ):
    "Internet Topology Zoo Specimen."

    def __init__( self ):
        "Create a topology."

        # Initialize Topology
        Topo.__init__( self )

        # add nodes, switches first...
        s1 = self.addSwitch( 's1' )
        s2 = self.addSwitch( 's2' )
        s3 = self.addSwitch( 's3' )
        s4 = self.addSwitch( 's4' )
        s5 = self.addSwitch( 's5' )
        s6 = self.addSwitch( 's6' )
        s7 = self.addSwitch( 's7' )
        s8 = self.addSwitch( 's8' )
        s9 = self.addSwitch( 's9' )

        # ... and now hosts
        h1 = self.addHost( 'h1' )
        h2 = self.addHost( 'h2' )
        h3 = self.addHost( 'h3' )
        h4 = self.addHost( 'h4' )

        # add edges between switch and corresponding host
        self.addLink( s1 , h1 )
        self.addLink( s2 , h2 )
        self.addLink( s3 , h3 )
        self.addLink( s4 , h4 )

        # add edges between switches
        self.addLink( s1 , s5 )
        self.addLink( s2 , s5 )
        self.addLink( s2 , s8 )
        self.addLink( s3 , s4 )
        self.addLink( s3 , s7 )
        self.addLink( s4 , s5 )
        self.addLink( s6 , s8 )
        self.addLink( s6 , s7 )
        self.addLink( s5 , s9 )
        self.addLink( s6 , s9 )

topos = { 'att': ( lambda: ReactiveForwardingTestTopo() ) }