Committed by
Gerrit Code Review
Adding enhancements to the GUI server-side.
Fixing a few intent-related glitches for the optical use-case. Fixing lat/lng information in the optical config. Change-Id: I6a1dd1ee69c2db2f0e351d191627bba468a3c49c
Showing
10 changed files
with
132 additions
and
48 deletions
... | @@ -15,8 +15,6 @@ | ... | @@ -15,8 +15,6 @@ |
15 | */ | 15 | */ |
16 | package org.onlab.onos.cli.net; | 16 | package org.onlab.onos.cli.net; |
17 | 17 | ||
18 | -import java.util.List; | ||
19 | - | ||
20 | import org.apache.karaf.shell.commands.Argument; | 18 | import org.apache.karaf.shell.commands.Argument; |
21 | import org.apache.karaf.shell.commands.Command; | 19 | import org.apache.karaf.shell.commands.Command; |
22 | import org.onlab.onos.net.HostId; | 20 | import org.onlab.onos.net.HostId; |
... | @@ -28,6 +26,8 @@ import org.onlab.onos.net.intent.Constraint; | ... | @@ -28,6 +26,8 @@ import org.onlab.onos.net.intent.Constraint; |
28 | import org.onlab.onos.net.intent.HostToHostIntent; | 26 | import org.onlab.onos.net.intent.HostToHostIntent; |
29 | import org.onlab.onos.net.intent.IntentService; | 27 | import org.onlab.onos.net.intent.IntentService; |
30 | 28 | ||
29 | +import java.util.List; | ||
30 | + | ||
31 | /** | 31 | /** |
32 | * Installs host-to-host connectivity intent. | 32 | * Installs host-to-host connectivity intent. |
33 | */ | 33 | */ | ... | ... |
... | @@ -20,11 +20,13 @@ import java.util.List; | ... | @@ -20,11 +20,13 @@ import java.util.List; |
20 | 20 | ||
21 | import org.apache.karaf.shell.commands.Option; | 21 | import org.apache.karaf.shell.commands.Option; |
22 | import org.onlab.onos.cli.AbstractShellCommand; | 22 | import org.onlab.onos.cli.AbstractShellCommand; |
23 | +import org.onlab.onos.net.Link; | ||
23 | import org.onlab.onos.net.flow.DefaultTrafficSelector; | 24 | import org.onlab.onos.net.flow.DefaultTrafficSelector; |
24 | import org.onlab.onos.net.flow.TrafficSelector; | 25 | import org.onlab.onos.net.flow.TrafficSelector; |
25 | import org.onlab.onos.net.intent.Constraint; | 26 | import org.onlab.onos.net.intent.Constraint; |
26 | import org.onlab.onos.net.intent.constraint.BandwidthConstraint; | 27 | import org.onlab.onos.net.intent.constraint.BandwidthConstraint; |
27 | import org.onlab.onos.net.intent.constraint.LambdaConstraint; | 28 | import org.onlab.onos.net.intent.constraint.LambdaConstraint; |
29 | +import org.onlab.onos.net.intent.constraint.LinkTypeConstraint; | ||
28 | import org.onlab.onos.net.resource.Bandwidth; | 30 | import org.onlab.onos.net.resource.Bandwidth; |
29 | import org.onlab.packet.Ethernet; | 31 | import org.onlab.packet.Ethernet; |
30 | import org.onlab.packet.IpPrefix; | 32 | import org.onlab.packet.IpPrefix; |
... | @@ -142,6 +144,7 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { | ... | @@ -142,6 +144,7 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand { |
142 | if (lambda) { | 144 | if (lambda) { |
143 | constraints.add(new LambdaConstraint(null)); | 145 | constraints.add(new LambdaConstraint(null)); |
144 | } | 146 | } |
147 | + constraints.add(new LinkTypeConstraint(lambda, Link.Type.OPTICAL)); | ||
145 | 148 | ||
146 | return constraints; | 149 | return constraints; |
147 | } | 150 | } | ... | ... |
... | @@ -16,12 +16,14 @@ | ... | @@ -16,12 +16,14 @@ |
16 | package org.onlab.onos.net.intent; | 16 | package org.onlab.onos.net.intent; |
17 | 17 | ||
18 | import com.google.common.base.MoreObjects; | 18 | import com.google.common.base.MoreObjects; |
19 | +import com.google.common.collect.ImmutableList; | ||
19 | import org.onlab.onos.core.ApplicationId; | 20 | import org.onlab.onos.core.ApplicationId; |
20 | import org.onlab.onos.net.HostId; | 21 | import org.onlab.onos.net.HostId; |
22 | +import org.onlab.onos.net.Link; | ||
21 | import org.onlab.onos.net.flow.TrafficSelector; | 23 | import org.onlab.onos.net.flow.TrafficSelector; |
22 | import org.onlab.onos.net.flow.TrafficTreatment; | 24 | import org.onlab.onos.net.flow.TrafficTreatment; |
25 | +import org.onlab.onos.net.intent.constraint.LinkTypeConstraint; | ||
23 | 26 | ||
24 | -import java.util.Collections; | ||
25 | import java.util.List; | 27 | import java.util.List; |
26 | 28 | ||
27 | import static com.google.common.base.Preconditions.checkNotNull; | 29 | import static com.google.common.base.Preconditions.checkNotNull; |
... | @@ -47,7 +49,8 @@ public final class HostToHostIntent extends ConnectivityIntent { | ... | @@ -47,7 +49,8 @@ public final class HostToHostIntent extends ConnectivityIntent { |
47 | public HostToHostIntent(ApplicationId appId, HostId one, HostId two, | 49 | public HostToHostIntent(ApplicationId appId, HostId one, HostId two, |
48 | TrafficSelector selector, | 50 | TrafficSelector selector, |
49 | TrafficTreatment treatment) { | 51 | TrafficTreatment treatment) { |
50 | - this(appId, one, two, selector, treatment, Collections.emptyList()); | 52 | + this(appId, one, two, selector, treatment, |
53 | + ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL))); | ||
51 | } | 54 | } |
52 | 55 | ||
53 | /** | 56 | /** | ... | ... |
... | @@ -3,32 +3,32 @@ | ... | @@ -3,32 +3,32 @@ |
3 | { | 3 | { |
4 | "uri": "of:0000ffffffffff01", "mac": "ffffffffffff01", "type": "ROADM", | 4 | "uri": "of:0000ffffffffff01", "mac": "ffffffffffff01", "type": "ROADM", |
5 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM1", | 5 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM1", |
6 | - "annotations": { "latitude": 37.6, "longitude": 122.3, "optical.regens": 0 }, | 6 | + "annotations": { "latitude": 37.6, "longitude": -122.3, "optical.regens": 0 }, |
7 | "ports": [ { "port": 10, "speed": 100000, "type": "FIBER" }, { "port": 20, "speed": 0, "type": "FIBER" } ] | 7 | "ports": [ { "port": 10, "speed": 100000, "type": "FIBER" }, { "port": 20, "speed": 0, "type": "FIBER" } ] |
8 | }, | 8 | }, |
9 | { | 9 | { |
10 | "uri": "of:0000ffffffffff02", "mac": "ffffffffffff02", "type": "ROADM", | 10 | "uri": "of:0000ffffffffff02", "mac": "ffffffffffff02", "type": "ROADM", |
11 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM2", | 11 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM2", |
12 | - "annotations": { "latitude": 37.3, "longitude": 121.9, "optical.regens": 0 }, | 12 | + "annotations": { "latitude": 37.3, "longitude": -121.9, "optical.regens": 0 }, |
13 | "ports": [ { "port": 11, "speed": 100000, "type": "FIBER" }, { "port": 21, "speed": 0, "type": "FIBER" } ] | 13 | "ports": [ { "port": 11, "speed": 100000, "type": "FIBER" }, { "port": 21, "speed": 0, "type": "FIBER" } ] |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | "uri": "of:0000ffffffffff03", "mac": "ffffffffffff03", "type": "ROADM", | 16 | "uri": "of:0000ffffffffff03", "mac": "ffffffffffff03", "type": "ROADM", |
17 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM3", | 17 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM3", |
18 | - "annotations": { "latitude": 33.9, "longitude": 118.4, "optical.regens": 2 }, | 18 | + "annotations": { "latitude": 33.9, "longitude": -118.4, "optical.regens": 2 }, |
19 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] | 19 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] |
20 | }, | 20 | }, |
21 | 21 | ||
22 | { | 22 | { |
23 | "uri": "of:0000ffffffff0001", "mac": "ffffffffff0001", "type": "SWITCH", | 23 | "uri": "of:0000ffffffff0001", "mac": "ffffffffff0001", "type": "SWITCH", |
24 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ROUTER1", | 24 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ROUTER1", |
25 | - "annotations": { "latitude": 37.6, "longitude": 122.3 }, | 25 | + "annotations": { "latitude": 37.6, "longitude": -122.3 }, |
26 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 26 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
27 | }, | 27 | }, |
28 | { | 28 | { |
29 | "uri": "of:0000ffffffff0002", "mac": "ffffffffff0002", "type": "SWITCH", | 29 | "uri": "of:0000ffffffff0002", "mac": "ffffffffff0002", "type": "SWITCH", |
30 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ROUTER2", | 30 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ROUTER2", |
31 | - "annotations": { "latitude": 37.3, "longitude": 121.9 }, | 31 | + "annotations": { "latitude": 37.3, "longitude": -121.9 }, |
32 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 32 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
33 | } | 33 | } |
34 | ], | 34 | ], | ... | ... |
... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
3 | { | 3 | { |
4 | "uri": "of:0000ffffffffff01", "mac": "ffffffffffff01", "type": "ROADM", | 4 | "uri": "of:0000ffffffffff01", "mac": "ffffffffffff01", "type": "ROADM", |
5 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "SFO-W10", | 5 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "SFO-W10", |
6 | - "annotations": { "latitude": 37.6, "longitude": 122.3, "optical.regens": 0 }, | 6 | + "annotations": { "latitude": 37.6, "longitude": -122.3, "optical.regens": 0 }, |
7 | "ports": [ { "port": 10, "speed": 100000, "type": "FIBER" }, | 7 | "ports": [ { "port": 10, "speed": 100000, "type": "FIBER" }, |
8 | { "port": 20, "speed": 0, "type": "FIBER" }, | 8 | { "port": 20, "speed": 0, "type": "FIBER" }, |
9 | { "port": 50, "speed":100000, "type": "FIBER" } ] | 9 | { "port": 50, "speed":100000, "type": "FIBER" } ] |
... | @@ -11,7 +11,7 @@ | ... | @@ -11,7 +11,7 @@ |
11 | { | 11 | { |
12 | "uri": "of:0000ffffffffff02", "mac": "ffffffffffff02", "type": "ROADM", | 12 | "uri": "of:0000ffffffffff02", "mac": "ffffffffffff02", "type": "ROADM", |
13 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "SJC-W10", | 13 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "SJC-W10", |
14 | - "annotations": { "latitude": 37.3, "longitude": 121.9, "optical.regens": 0 }, | 14 | + "annotations": { "latitude": 37.3, "longitude": -121.9, "optical.regens": 0 }, |
15 | "ports": [ { "port": 20, "speed": 100000, "type": "FIBER" }, | 15 | "ports": [ { "port": 20, "speed": 100000, "type": "FIBER" }, |
16 | { "port": 30, "speed": 0, "type": "FIBER" }, | 16 | { "port": 30, "speed": 0, "type": "FIBER" }, |
17 | { "port": 50, "speed": 0, "type": "FIBER" } ] | 17 | { "port": 50, "speed": 0, "type": "FIBER" } ] |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | { | 19 | { |
20 | "uri": "of:0000ffffffffff03", "mac": "ffffffffffff03", "type": "ROADM", | 20 | "uri": "of:0000ffffffffff03", "mac": "ffffffffffff03", "type": "ROADM", |
21 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "LAX-W10", | 21 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "LAX-W10", |
22 | - "annotations": { "latitude": 33.9, "longitude": 118.4, "optical.regens": 0 }, | 22 | + "annotations": { "latitude": 33.9, "longitude": -118.4, "optical.regens": 0 }, |
23 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, | 23 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, |
24 | { "port": 50, "speed": 0, "type": "FIBER" }, | 24 | { "port": 50, "speed": 0, "type": "FIBER" }, |
25 | { "port": 20, "speed": 0, "type": "FIBER" } ] | 25 | { "port": 20, "speed": 0, "type": "FIBER" } ] |
... | @@ -27,7 +27,7 @@ | ... | @@ -27,7 +27,7 @@ |
27 | { | 27 | { |
28 | "uri": "of:0000ffffffffff04", "mac": "ffffffffffff04", "type": "ROADM", | 28 | "uri": "of:0000ffffffffff04", "mac": "ffffffffffff04", "type": "ROADM", |
29 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "SDG-W10", | 29 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "SDG-W10", |
30 | - "annotations": { "latitude": 32.8, "longitude": 117.1, "optical.regens": 3 }, | 30 | + "annotations": { "latitude": 32.8, "longitude": -117.1, "optical.regens": 3 }, |
31 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, | 31 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, |
32 | { "port":50, "speed": 0, "type": "FIBER" }, | 32 | { "port":50, "speed": 0, "type": "FIBER" }, |
33 | { "port":20, "speed": 0, "type": "FIBER" }] | 33 | { "port":20, "speed": 0, "type": "FIBER" }] |
... | @@ -35,7 +35,7 @@ | ... | @@ -35,7 +35,7 @@ |
35 | { | 35 | { |
36 | "uri": "of:0000ffffffffff05", "mac": "ffffffffffff05", "type": "ROADM", | 36 | "uri": "of:0000ffffffffff05", "mac": "ffffffffffff05", "type": "ROADM", |
37 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "MSP-M10", | 37 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "MSP-M10", |
38 | - "annotations": { "latitude": 44.8, "longitude": 93.1, "optical.regens": 3 }, | 38 | + "annotations": { "latitude": 44.8, "longitude": -93.1, "optical.regens": 3 }, |
39 | "ports": [ { "port": 20, "speed": 0, "type": "FIBER" }, | 39 | "ports": [ { "port": 20, "speed": 0, "type": "FIBER" }, |
40 | { "port": 30, "speed": 0, "type": "FIBER" }, | 40 | { "port": 30, "speed": 0, "type": "FIBER" }, |
41 | { "port": 40, "speed": 0, "type": "FIBER" }, | 41 | { "port": 40, "speed": 0, "type": "FIBER" }, |
... | @@ -44,7 +44,7 @@ | ... | @@ -44,7 +44,7 @@ |
44 | { | 44 | { |
45 | "uri": "of:0000ffffffffff06", "mac": "ffffffffffff06", "type": "ROADM", | 45 | "uri": "of:0000ffffffffff06", "mac": "ffffffffffff06", "type": "ROADM", |
46 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "DFW-M10", | 46 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "DFW-M10", |
47 | - "annotations": { "latitude": 32.8, "longitude": 97.1, "optical.regens": 3 }, | 47 | + "annotations": { "latitude": 32.8, "longitude": -97.1, "optical.regens": 3 }, |
48 | "ports": [ { "port": 10, "speed": 0, "type": "FIBER" }, | 48 | "ports": [ { "port": 10, "speed": 0, "type": "FIBER" }, |
49 | { "port": 20, "speed": 0, "type": "FIBER" }, | 49 | { "port": 20, "speed": 0, "type": "FIBER" }, |
50 | { "port": 30, "speed": 0, "type": "FIBER" }, | 50 | { "port": 30, "speed": 0, "type": "FIBER" }, |
... | @@ -54,7 +54,7 @@ | ... | @@ -54,7 +54,7 @@ |
54 | { | 54 | { |
55 | "uri": "of:0000ffffffffff07", "mac": "ffffffffffff07", "type": "ROADM", | 55 | "uri": "of:0000ffffffffff07", "mac": "ffffffffffff07", "type": "ROADM", |
56 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "CHG-N10", | 56 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "CHG-N10", |
57 | - "annotations": { "latitude": 41.8, "longitude": 120.1, "optical.regens": 3 }, | 57 | + "annotations": { "latitude": 41.8, "longitude": -120.1, "optical.regens": 3 }, |
58 | "ports": [ { "port": 10, "speed": 0, "type": "FIBER" }, | 58 | "ports": [ { "port": 10, "speed": 0, "type": "FIBER" }, |
59 | { "port": 20, "speed": 0, "type": "FIBER" }, | 59 | { "port": 20, "speed": 0, "type": "FIBER" }, |
60 | { "port": 30, "speed": 0, "type": "FIBER" }, | 60 | { "port": 30, "speed": 0, "type": "FIBER" }, |
... | @@ -63,7 +63,7 @@ | ... | @@ -63,7 +63,7 @@ |
63 | { | 63 | { |
64 | "uri": "of:0000ffffffffff08", "mac": "ffffffffffff08", "type": "ROADM", | 64 | "uri": "of:0000ffffffffff08", "mac": "ffffffffffff08", "type": "ROADM", |
65 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "IAD-M10", | 65 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "IAD-M10", |
66 | - "annotations": { "latitude": 38.8, "longitude": 77.1, "optical.regens": 3 }, | 66 | + "annotations": { "latitude": 38.8, "longitude": -77.1, "optical.regens": 3 }, |
67 | "ports": [ { "port": 20, "speed": 0, "type": "FIBER" }, | 67 | "ports": [ { "port": 20, "speed": 0, "type": "FIBER" }, |
68 | { "port": 30, "speed": 0, "type": "FIBER" }, | 68 | { "port": 30, "speed": 0, "type": "FIBER" }, |
69 | { "port": 50, "speed": 0, "type": "FIBER" }] | 69 | { "port": 50, "speed": 0, "type": "FIBER" }] |
... | @@ -71,7 +71,7 @@ | ... | @@ -71,7 +71,7 @@ |
71 | { | 71 | { |
72 | "uri": "of:0000ffffffffff09", "mac": "ffffffffffff09", "type": "ROADM", | 72 | "uri": "of:0000ffffffffff09", "mac": "ffffffffffff09", "type": "ROADM", |
73 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "JFK-M10", | 73 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "JFK-M10", |
74 | - "annotations": { "latitude": 40.8, "longitude": 73.1, "optical.regens": 0 }, | 74 | + "annotations": { "latitude": 40.8, "longitude": -73.1, "optical.regens": 0 }, |
75 | "ports": [ { "port": 10, "speed": 0, "type": "FIBER" }, | 75 | "ports": [ { "port": 10, "speed": 0, "type": "FIBER" }, |
76 | { "port": 20, "speed": 0, "type": "FIBER" }, | 76 | { "port": 20, "speed": 0, "type": "FIBER" }, |
77 | { "port": 50, "speed": 0, "type": "FIBER" }] | 77 | { "port": 50, "speed": 0, "type": "FIBER" }] |
... | @@ -79,7 +79,7 @@ | ... | @@ -79,7 +79,7 @@ |
79 | { | 79 | { |
80 | "uri": "of:0000ffffffffff0A", "mac": "ffffffffffff0A", "type": "ROADM", | 80 | "uri": "of:0000ffffffffff0A", "mac": "ffffffffffff0A", "type": "ROADM", |
81 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ATL-S10", | 81 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ATL-S10", |
82 | - "annotations": { "latitude": 33.8, "longitude": 84.1, "optical.regens": 0 }, | 82 | + "annotations": { "latitude": 33.8, "longitude": -84.1, "optical.regens": 0 }, |
83 | "ports": [ { "port": 10, "speed": 0, "type": "FIBER" }, | 83 | "ports": [ { "port": 10, "speed": 0, "type": "FIBER" }, |
84 | { "port": 20, "speed": 0, "type": "FIBER" }, | 84 | { "port": 20, "speed": 0, "type": "FIBER" }, |
85 | { "port": 50, "speed": 0, "type": "FIBER" }] | 85 | { "port": 50, "speed": 0, "type": "FIBER" }] |
... | @@ -87,37 +87,37 @@ | ... | @@ -87,37 +87,37 @@ |
87 | { | 87 | { |
88 | "uri": "of:0000ffffffff0001", "mac": "ffffffffff0001", "type": "SWITCH", | 88 | "uri": "of:0000ffffffff0001", "mac": "ffffffffff0001", "type": "SWITCH", |
89 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "SFO-R10", | 89 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "SFO-R10", |
90 | - "annotations": { "latitude": 37.6, "longitude": 122.3 }, | 90 | + "annotations": { "latitude": 37.6, "longitude": -122.3 }, |
91 | "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" } ] |
92 | }, | 92 | }, |
93 | { | 93 | { |
94 | "uri": "of:0000ffffffff0002", "mac": "ffffffffff0003", "type": "SWITCH", | 94 | "uri": "of:0000ffffffff0002", "mac": "ffffffffff0003", "type": "SWITCH", |
95 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "LAX-R10", | 95 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "LAX-R10", |
96 | - "annotations": { "latitude": 33.9, "longitude": 118.4 }, | 96 | + "annotations": { "latitude": 33.9, "longitude": -118.4 }, |
97 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 97 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
98 | }, | 98 | }, |
99 | { | 99 | { |
100 | "uri": "of:0000ffffffff0003", "mac": "ffffffffff0004", "type": "SWITCH", | 100 | "uri": "of:0000ffffffff0003", "mac": "ffffffffff0004", "type": "SWITCH", |
101 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "SDG-R10", | 101 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "SDG-R10", |
102 | - "annotations": { "latitude": 32.8, "longitude": 117.1 }, | 102 | + "annotations": { "latitude": 32.8, "longitude": -117.1 }, |
103 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 103 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
104 | }, | 104 | }, |
105 | { | 105 | { |
106 | "uri": "of:0000ffffffff0004", "mac": "ffffffffff0007", "type": "SWITCH", | 106 | "uri": "of:0000ffffffff0004", "mac": "ffffffffff0007", "type": "SWITCH", |
107 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "CHG-R10", | 107 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "CHG-R10", |
108 | - "annotations": { "latitude": 41.8, "longitude": 120.1 }, | 108 | + "annotations": { "latitude": 41.8, "longitude": -120.1 }, |
109 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 109 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
110 | }, | 110 | }, |
111 | { | 111 | { |
112 | "uri": "of:0000ffffffff0005", "mac": "ffffffffff0009", "type": "SWITCH", | 112 | "uri": "of:0000ffffffff0005", "mac": "ffffffffff0009", "type": "SWITCH", |
113 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "JFK-R10", | 113 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "JFK-R10", |
114 | - "annotations": { "latitude": 40.8, "longitude": 73.1 }, | 114 | + "annotations": { "latitude": 40.8, "longitude": -73.1 }, |
115 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 115 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
116 | }, | 116 | }, |
117 | { | 117 | { |
118 | "uri": "of:0000ffffffff0006", "mac": "ffffffffff000A", "type": "SWITCH", | 118 | "uri": "of:0000ffffffff0006", "mac": "ffffffffff000A", "type": "SWITCH", |
119 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ATL-R10", | 119 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ATL-R10", |
120 | - "annotations": { "latitude": 33.8, "longitude": 84.1 }, | 120 | + "annotations": { "latitude": 33.8, "longitude": -84.1 }, |
121 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 121 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
122 | } | 122 | } |
123 | 123 | ... | ... |
... | @@ -3,37 +3,37 @@ | ... | @@ -3,37 +3,37 @@ |
3 | { | 3 | { |
4 | "uri": "of:0000ffffffffff01", "mac": "ffffffffffff01", "type": "ROADM", | 4 | "uri": "of:0000ffffffffff01", "mac": "ffffffffffff01", "type": "ROADM", |
5 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM1", | 5 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM1", |
6 | - "annotations": { "latitude": 37.6, "longitude": 122.3, "optical.regens": 0 }, | 6 | + "annotations": { "latitude": 37.6, "longitude": -122.3, "optical.regens": 0 }, |
7 | - "ports": [ { "port": 10, "speed": 100000, "type": "FIBER" }, { "port": 20, "speed": 0, "type": "FIBER" }, { "port": 22, "speed": 0, "type": "FIBER" }] | 7 | + "ports": [ { "port": 10, "speed": 100000, "type": "FIBER" }, { "port": 20, "speed": 0, "type": "FIBER" }, { "port": 22, "speed": 0, "type": "FIBER" } ] |
8 | }, | 8 | }, |
9 | { | 9 | { |
10 | "uri": "of:0000ffffffffff02", "mac": "ffffffffffff02", "type": "ROADM", | 10 | "uri": "of:0000ffffffffff02", "mac": "ffffffffffff02", "type": "ROADM", |
11 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM2", | 11 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM2", |
12 | - "annotations": { "latitude": 37.3, "longitude": 121.9, "optical.regens": 0 }, | 12 | + "annotations": { "latitude": 37.3, "longitude": -121.9, "optical.regens": 0 }, |
13 | - "ports": [ { "port": 11, "speed": 100000, "type": "FIBER" }, { "port": 21, "speed": 0, "type": "FIBER" }, { "port": 22, "speed": 0, "type": "FIBER" }] | 13 | + "ports": [ { "port": 11, "speed": 100000, "type": "FIBER" }, { "port": 21, "speed": 0, "type": "FIBER" }, { "port": 22, "speed": 0, "type": "FIBER" } ] |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | "uri": "of:0000ffffffffff03", "mac": "ffffffffffff03", "type": "ROADM", | 16 | "uri": "of:0000ffffffffff03", "mac": "ffffffffffff03", "type": "ROADM", |
17 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM3", | 17 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM3", |
18 | - "annotations": { "latitude": 33.9, "longitude": 118.4, "optical.regens": 2 }, | 18 | + "annotations": { "latitude": 33.9, "longitude": -118.4, "optical.regens": 2 }, |
19 | - "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" }] | 19 | + "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] |
20 | }, | 20 | }, |
21 | - { | 21 | + { |
22 | "uri": "of:0000ffffffffff04", "mac": "ffffffffffff04", "type":"ROADM", | 22 | "uri": "of:0000ffffffffff04", "mac": "ffffffffffff04", "type":"ROADM", |
23 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM4", | 23 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "ROADM4", |
24 | - "annotations": { "latitude": 39.9, "longitude": 119.4, "optical.regens": 2 }, | 24 | + "annotations": { "latitude": 39.9, "longitude": -119.4, "optical.regens": 2 }, |
25 | - "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" }] | 25 | + "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] |
26 | }, | 26 | }, |
27 | { | 27 | { |
28 | "uri": "of:0000ffffffff0001", "mac": "ffffffffff0001", "type": "SWITCH", | 28 | "uri": "of:0000ffffffff0001", "mac": "ffffffffff0001", "type": "SWITCH", |
29 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ROUTER1", | 29 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ROUTER1", |
30 | - "annotations": { "latitude": 37.6, "longitude": 122.3 }, | 30 | + "annotations": { "latitude": 37.6, "longitude": -122.3 }, |
31 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 31 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
32 | }, | 32 | }, |
33 | { | 33 | { |
34 | "uri": "of:0000ffffffff0002", "mac": "ffffffffff0002", "type": "SWITCH", | 34 | "uri": "of:0000ffffffff0002", "mac": "ffffffffff0002", "type": "SWITCH", |
35 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ROUTER2", | 35 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ROUTER2", |
36 | - "annotations": { "latitude": 37.3, "longitude": 121.9 }, | 36 | + "annotations": { "latitude": 37.3, "longitude": -121.9 }, |
37 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 37 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
38 | } | 38 | } |
39 | ], | 39 | ], |
... | @@ -49,3 +49,4 @@ | ... | @@ -49,3 +49,4 @@ |
49 | ] | 49 | ] |
50 | 50 | ||
51 | } | 51 | } |
52 | + | ... | ... |
... | @@ -21,6 +21,8 @@ import org.onlab.onos.net.device.DeviceProviderRegistry; | ... | @@ -21,6 +21,8 @@ import org.onlab.onos.net.device.DeviceProviderRegistry; |
21 | import org.onlab.onos.net.host.HostProviderRegistry; | 21 | import org.onlab.onos.net.host.HostProviderRegistry; |
22 | import org.onlab.onos.net.link.LinkProviderRegistry; | 22 | import org.onlab.onos.net.link.LinkProviderRegistry; |
23 | import org.onlab.rest.BaseResource; | 23 | import org.onlab.rest.BaseResource; |
24 | +import org.slf4j.Logger; | ||
25 | +import org.slf4j.LoggerFactory; | ||
24 | 26 | ||
25 | import javax.ws.rs.Consumes; | 27 | import javax.ws.rs.Consumes; |
26 | import javax.ws.rs.POST; | 28 | import javax.ws.rs.POST; |
... | @@ -31,6 +33,8 @@ import javax.ws.rs.core.Response; | ... | @@ -31,6 +33,8 @@ import javax.ws.rs.core.Response; |
31 | import java.io.IOException; | 33 | import java.io.IOException; |
32 | import java.io.InputStream; | 34 | import java.io.InputStream; |
33 | 35 | ||
36 | +import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; | ||
37 | + | ||
34 | /** | 38 | /** |
35 | * Resource that acts as an ancillary provider for uploading pre-configured | 39 | * Resource that acts as an ancillary provider for uploading pre-configured |
36 | * devices, ports and links. | 40 | * devices, ports and links. |
... | @@ -38,17 +42,24 @@ import java.io.InputStream; | ... | @@ -38,17 +42,24 @@ import java.io.InputStream; |
38 | @Path("config") | 42 | @Path("config") |
39 | public class ConfigResource extends BaseResource { | 43 | public class ConfigResource extends BaseResource { |
40 | 44 | ||
45 | + private static Logger log = LoggerFactory.getLogger(ConfigResource.class); | ||
46 | + | ||
41 | @POST | 47 | @POST |
42 | @Path("topology") | 48 | @Path("topology") |
43 | @Consumes(MediaType.APPLICATION_JSON) | 49 | @Consumes(MediaType.APPLICATION_JSON) |
44 | @Produces(MediaType.APPLICATION_JSON) | 50 | @Produces(MediaType.APPLICATION_JSON) |
45 | public Response topology(InputStream input) throws IOException { | 51 | public Response topology(InputStream input) throws IOException { |
46 | - ObjectMapper mapper = new ObjectMapper(); | 52 | + try { |
47 | - JsonNode cfg = mapper.readTree(input); | 53 | + ObjectMapper mapper = new ObjectMapper(); |
48 | - new ConfigProvider(cfg, get(DeviceProviderRegistry.class), | 54 | + JsonNode cfg = mapper.readTree(input); |
49 | - get(LinkProviderRegistry.class), | 55 | + new ConfigProvider(cfg, get(DeviceProviderRegistry.class), |
50 | - get(HostProviderRegistry.class)).parse(); | 56 | + get(LinkProviderRegistry.class), |
51 | - return Response.ok(mapper.createObjectNode().toString()).build(); | 57 | + get(HostProviderRegistry.class)).parse(); |
58 | + return Response.ok(mapper.createObjectNode().toString()).build(); | ||
59 | + } catch (Exception e) { | ||
60 | + log.error("Unable to parse topology configuration", e); | ||
61 | + return Response.status(INTERNAL_SERVER_ERROR).entity(e.toString()).build(); | ||
62 | + } | ||
52 | } | 63 | } |
53 | 64 | ||
54 | } | 65 | } | ... | ... |
... | @@ -40,7 +40,12 @@ import org.onlab.onos.net.device.DeviceEvent; | ... | @@ -40,7 +40,12 @@ import org.onlab.onos.net.device.DeviceEvent; |
40 | import org.onlab.onos.net.device.DeviceService; | 40 | import org.onlab.onos.net.device.DeviceService; |
41 | import org.onlab.onos.net.host.HostEvent; | 41 | import org.onlab.onos.net.host.HostEvent; |
42 | import org.onlab.onos.net.host.HostService; | 42 | import org.onlab.onos.net.host.HostService; |
43 | +import org.onlab.onos.net.intent.ConnectivityIntent; | ||
44 | +import org.onlab.onos.net.intent.Intent; | ||
43 | import org.onlab.onos.net.intent.IntentService; | 45 | import org.onlab.onos.net.intent.IntentService; |
46 | +import org.onlab.onos.net.intent.IntentState; | ||
47 | +import org.onlab.onos.net.intent.LinkCollectionIntent; | ||
48 | +import org.onlab.onos.net.intent.PathIntent; | ||
44 | import org.onlab.onos.net.link.LinkEvent; | 49 | import org.onlab.onos.net.link.LinkEvent; |
45 | import org.onlab.onos.net.link.LinkService; | 50 | import org.onlab.onos.net.link.LinkService; |
46 | import org.onlab.onos.net.provider.ProviderId; | 51 | import org.onlab.onos.net.provider.ProviderId; |
... | @@ -50,6 +55,7 @@ import org.slf4j.Logger; | ... | @@ -50,6 +55,7 @@ import org.slf4j.Logger; |
50 | import org.slf4j.LoggerFactory; | 55 | import org.slf4j.LoggerFactory; |
51 | 56 | ||
52 | import java.util.Iterator; | 57 | import java.util.Iterator; |
58 | +import java.util.List; | ||
53 | import java.util.Map; | 59 | import java.util.Map; |
54 | import java.util.Set; | 60 | import java.util.Set; |
55 | import java.util.concurrent.ConcurrentHashMap; | 61 | import java.util.concurrent.ConcurrentHashMap; |
... | @@ -350,7 +356,7 @@ public abstract class TopologyMessages { | ... | @@ -350,7 +356,7 @@ public abstract class TopologyMessages { |
350 | new Prop("Longitude", annot.value("longitude")))); | 356 | new Prop("Longitude", annot.value("longitude")))); |
351 | } | 357 | } |
352 | 358 | ||
353 | - // Produces a path message to the client. | 359 | + // Produces a path payload to the client. |
354 | protected ObjectNode pathMessage(Path path, String type) { | 360 | protected ObjectNode pathMessage(Path path, String type) { |
355 | ObjectNode payload = mapper.createObjectNode(); | 361 | ObjectNode payload = mapper.createObjectNode(); |
356 | ArrayNode links = mapper.createArrayNode(); | 362 | ArrayNode links = mapper.createArrayNode(); |
... | @@ -362,6 +368,50 @@ public abstract class TopologyMessages { | ... | @@ -362,6 +368,50 @@ public abstract class TopologyMessages { |
362 | return payload; | 368 | return payload; |
363 | } | 369 | } |
364 | 370 | ||
371 | + | ||
372 | + // Produces JSON message to trigger traffic visualization | ||
373 | + protected ObjectNode trafficMessage(Set<Intent> intents, long sid) { | ||
374 | + ObjectNode payload = mapper.createObjectNode(); | ||
375 | + ArrayNode paths = mapper.createArrayNode(); | ||
376 | + payload.set("paths", paths); | ||
377 | + | ||
378 | + for (Intent intent : intents) { | ||
379 | + List<Intent> installables = intentService.getInstallableIntents(intent.id()); | ||
380 | + IntentState state = intentService.getIntentState(intent.id()); | ||
381 | + String type = state == IntentState.FAILED ? "inactive" : "active"; | ||
382 | + for (Intent installable : installables) { | ||
383 | + if (installable instanceof ConnectivityIntent) { | ||
384 | + addPathTraffic(paths, type, (ConnectivityIntent) installable); | ||
385 | + } | ||
386 | + } | ||
387 | + } | ||
388 | + | ||
389 | + return envelope("showTraffic", sid, payload); | ||
390 | + } | ||
391 | + | ||
392 | + // Adds the link segments (path or tree) associated with the specified | ||
393 | + // connectivity intent | ||
394 | + protected void addPathTraffic(ArrayNode paths, String type, | ||
395 | + ConnectivityIntent installable) { | ||
396 | + ObjectNode pathNode = mapper.createObjectNode(); | ||
397 | + ArrayNode linksNode = mapper.createArrayNode(); | ||
398 | + | ||
399 | + Iterable<Link> links; | ||
400 | + if (installable instanceof PathIntent) { | ||
401 | + links = ((PathIntent) installable).path().links(); | ||
402 | + } else if (installable instanceof LinkCollectionIntent) { | ||
403 | + links = ((LinkCollectionIntent) installable).links(); | ||
404 | + } else { | ||
405 | + return; | ||
406 | + } | ||
407 | + | ||
408 | + for (Link link : links) { | ||
409 | + linksNode.add(compactLinkString(link)); | ||
410 | + } | ||
411 | + pathNode.put("type", type).set("links", linksNode); | ||
412 | + paths.add(pathNode); | ||
413 | + } | ||
414 | + | ||
365 | // Produces compact string representation of a link. | 415 | // Produces compact string representation of a link. |
366 | private static String compactLinkString(Link link) { | 416 | private static String compactLinkString(Link link) { |
367 | return String.format(COMPACT, link.src().elementId(), link.src().port(), | 417 | return String.format(COMPACT, link.src().elementId(), link.src().port(), | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -130,8 +130,8 @@ | ... | @@ -130,8 +130,8 @@ |
130 | U: unpin, | 130 | U: unpin, |
131 | 131 | ||
132 | W: requestTraffic, // bag of selections | 132 | W: requestTraffic, // bag of selections |
133 | - Z: requestPath, // host-to-host intent (and monitor) | 133 | + X: cancelTraffic, |
134 | - X: cancelMonitor | 134 | + Z: requestPath // host-to-host intent (and monitor) |
135 | }; | 135 | }; |
136 | 136 | ||
137 | // state variables | 137 | // state variables |
... | @@ -496,7 +496,23 @@ | ... | @@ -496,7 +496,23 @@ |
496 | } | 496 | } |
497 | 497 | ||
498 | function showTraffic(data) { | 498 | function showTraffic(data) { |
499 | - network.view.alert("showTraffic() -- TODO") | 499 | + fnTrace('showTraffic', data.payload.id); |
500 | + data.payload.paths.forEach(function () { | ||
501 | + var links = data.payload.links, | ||
502 | + s = [ data.event + "\n" + links.length ]; | ||
503 | + links.forEach(function (d, i) { | ||
504 | + s.push(d); | ||
505 | + }); | ||
506 | + network.view.alert(s.join('\n')); | ||
507 | + | ||
508 | + links.forEach(function (d, i) { | ||
509 | + var link = network.lookup[d]; | ||
510 | + if (link) { | ||
511 | + link.el.classed('showPath', true); | ||
512 | + } | ||
513 | + }); | ||
514 | + }); | ||
515 | + //network.view.alert("showTraffic() -- TODO") | ||
500 | } | 516 | } |
501 | 517 | ||
502 | // ............................... | 518 | // ............................... |
... | @@ -566,9 +582,9 @@ | ... | @@ -566,9 +582,9 @@ |
566 | } | 582 | } |
567 | } | 583 | } |
568 | 584 | ||
569 | - function cancelMonitor() { | 585 | + function cancelTraffic() { |
570 | // FIXME: from where do we get the intent id(s) to send to the server? | 586 | // FIXME: from where do we get the intent id(s) to send to the server? |
571 | - sendMessage('cancelMonitor', { | 587 | + sendMessage('cancelTraffic', { |
572 | ids: ["need_the_intent_id"] | 588 | ids: ["need_the_intent_id"] |
573 | }); | 589 | }); |
574 | } | 590 | } | ... | ... |
-
Please register or login to post a comment