Committed by
Gerrit Code Review
Merge "added optical-2.py added oe-nonlinear-topo10"
Showing
3 changed files
with
67 additions
and
11 deletions
tools/test/bin/old.json
0 → 100644
This diff is collapsed. Click to expand it.
... | @@ -31,12 +31,6 @@ | ... | @@ -31,12 +31,6 @@ |
31 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] | 31 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] |
32 | }, | 32 | }, |
33 | { | 33 | { |
34 | - "uri": "of:0000ffffffffff06", "mac": "ffffffffffff06", "type": "ROADM", | ||
35 | - "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "DFW-M10", | ||
36 | - "annotations": { "latitude": 32.8, "longitude": 97.1, "optical.regens": 3 }, | ||
37 | - "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] | ||
38 | - }, | ||
39 | - { | ||
40 | "uri": "of:0000ffffffffff07", "mac": "ffffffffffff07", "type": "ROADM", | 34 | "uri": "of:0000ffffffffff07", "mac": "ffffffffffff07", "type": "ROADM", |
41 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "CHG-N10", | 35 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "CHG-N10", |
42 | "annotations": { "latitude": 41.8, "longitude": 120.1, "optical.regens": 3 }, | 36 | "annotations": { "latitude": 41.8, "longitude": 120.1, "optical.regens": 3 }, |
... | @@ -67,31 +61,31 @@ | ... | @@ -67,31 +61,31 @@ |
67 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 61 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
68 | }, | 62 | }, |
69 | { | 63 | { |
70 | - "uri": "of:0000ffffffff0003", "mac": "ffffffffff0003", "type": "SWITCH", | 64 | + "uri": "of:0000ffffffff0002", "mac": "ffffffffff0003", "type": "SWITCH", |
71 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "LAX-R10", | 65 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "LAX-R10", |
72 | "annotations": { "latitude": 33.9, "longitude": 118.4 }, | 66 | "annotations": { "latitude": 33.9, "longitude": 118.4 }, |
73 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 67 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
74 | }, | 68 | }, |
75 | { | 69 | { |
76 | - "uri": "of:0000ffffffff0004", "mac": "ffffffffff0004", "type": "SWITCH", | 70 | + "uri": "of:0000ffffffff0003", "mac": "ffffffffff0004", "type": "SWITCH", |
77 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "SDG-R10", | 71 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "SDG-R10", |
78 | "annotations": { "latitude": 32.8, "longitude": 117.1 }, | 72 | "annotations": { "latitude": 32.8, "longitude": 117.1 }, |
79 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 73 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
80 | }, | 74 | }, |
81 | { | 75 | { |
82 | - "uri": "of:0000ffffffff0007", "mac": "ffffffffff0007", "type": "SWITCH", | 76 | + "uri": "of:0000ffffffff0004", "mac": "ffffffffff0007", "type": "SWITCH", |
83 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "CHG-R10", | 77 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "CHG-R10", |
84 | "annotations": { "latitude": 41.8, "longitude": 120.1 }, | 78 | "annotations": { "latitude": 41.8, "longitude": 120.1 }, |
85 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 79 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
86 | }, | 80 | }, |
87 | { | 81 | { |
88 | - "uri": "of:0000ffffffff0009", "mac": "ffffffffff0009", "type": "SWITCH", | 82 | + "uri": "of:0000ffffffff0005", "mac": "ffffffffff0009", "type": "SWITCH", |
89 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "JFK-R10", | 83 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "JFK-R10", |
90 | "annotations": { "latitude": 40.8, "longitude": 73.1 }, | 84 | "annotations": { "latitude": 40.8, "longitude": 73.1 }, |
91 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 85 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
92 | }, | 86 | }, |
93 | { | 87 | { |
94 | - "uri": "of:0000ffffffff000A", "mac": "ffffffffff000A", "type": "SWITCH", | 88 | + "uri": "of:0000ffffffff0006", "mac": "ffffffffff000A", "type": "SWITCH", |
95 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ATL-R10", | 89 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ATL-R10", |
96 | "annotations": { "latitude": 33.8, "longitude": 84.1 }, | 90 | "annotations": { "latitude": 33.8, "longitude": 84.1 }, |
97 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 91 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | ... | ... |
tools/test/topos/optical-2.py
0 → 100755
1 | +#!/usr/bin/env python | ||
2 | + | ||
3 | +''' file: custom/optical.py ''' | ||
4 | +from mininet.node import RemoteController | ||
5 | +from mininet.topo import Topo | ||
6 | +from mininet.net import Mininet | ||
7 | +from mininet.cli import CLI | ||
8 | +from mininet.log import setLogLevel, info | ||
9 | +from mininet.util import irange | ||
10 | + | ||
11 | +switches = [] | ||
12 | + | ||
13 | +class OpticalTopo( Topo ): | ||
14 | + | ||
15 | + def build( self, n=6, tapStart=29 ): | ||
16 | + global switches | ||
17 | + # Add hosts and switches | ||
18 | + hosts = [] | ||
19 | + switches = [] | ||
20 | + for i in irange( 1, n ): | ||
21 | + h = self.addHost( 'h%d' % i ) | ||
22 | + s = self.addSwitch( 's%d' % i, dpid='0000ffffffff%04d' % i ) | ||
23 | + self.addLink( h, s ) | ||
24 | + hosts.append( h ) | ||
25 | + switches.append( s ) | ||
26 | + | ||
27 | + # Add optical tap interfaces | ||
28 | + tapNum = tapStart | ||
29 | + #for sw in switches: | ||
30 | + # self.addLink( sw, sw, intfName1='%s-eth0' % sw, intfName2='tap%d' % tapNum ) | ||
31 | + #Add tap interface up | ||
32 | + #sudo ip link set dev tap25 up | ||
33 | + # tapNum += 1 | ||
34 | + | ||
35 | +# if you use, sudo mn --custom custom/optical.py, then register the topo: | ||
36 | +#sudo mn --custom ~/mininet/custom/optical-2.py --topo optical,6 --controller=remote | ||
37 | +#sudo ./mininet/custom/optical-2.py | ||
38 | +topos = { 'optical': OpticalTopo } | ||
39 | + | ||
40 | +def installStaticFlows( net ): | ||
41 | + for swName in [ 's1', 's2', 's3', 's4', 's5', 's6' ]: | ||
42 | + info( 'Adding flows to %s...' % swName ) | ||
43 | + sw = net[ swName ] | ||
44 | + sw.dpctl( 'add-flow', 'in_port=1,actions=output=2' ) | ||
45 | + sw.dpctl( 'add-flow', 'in_port=2,actions=output=1' ) | ||
46 | + info( sw.dpctl( 'dump-flows' ) ) | ||
47 | + | ||
48 | +def run(): | ||
49 | + net = Mininet( topo=OpticalTopo(), controller=RemoteController ) | ||
50 | + net.start() | ||
51 | + #installStaticFlows( net ) | ||
52 | + tapStart = 29 | ||
53 | + for sw in switches: | ||
54 | + net.get(sw).attach( 'tap%d' %tapStart ) | ||
55 | + tapStart += 1 | ||
56 | + CLI( net ) | ||
57 | + net.stop() | ||
58 | + | ||
59 | +# if the script is run directly (sudo custom/optical.py): | ||
60 | +if __name__ == '__main__': | ||
61 | + setLogLevel( 'info' ) | ||
62 | + run() |
-
Please register or login to post a comment