Committed by
Gerrit Code Review
[ONOS-4159] PCE Web GUI implementation:PCE overlay app specific link details display
Change-Id: Id944a7ddfb7ec1c6c934520253b6eff716810f63
Showing
4 changed files
with
107 additions
and
34 deletions
... | @@ -431,7 +431,6 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { | ... | @@ -431,7 +431,6 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { |
431 | lspTypeVal = LspType.SR_WITHOUT_SIGNALLING; | 431 | lspTypeVal = LspType.SR_WITHOUT_SIGNALLING; |
432 | break; | 432 | break; |
433 | default: | 433 | default: |
434 | - log.error("Invalid LSP type"); | ||
435 | break; | 434 | break; |
436 | } | 435 | } |
437 | 436 | ||
... | @@ -539,7 +538,6 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { | ... | @@ -539,7 +538,6 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { |
539 | costTypeVal = CostConstraint.Type.TE_COST; | 538 | costTypeVal = CostConstraint.Type.TE_COST; |
540 | break; | 539 | break; |
541 | default: | 540 | default: |
542 | - log.error("Invalid cost type"); | ||
543 | break; | 541 | break; |
544 | } | 542 | } |
545 | 543 | ||
... | @@ -660,12 +658,17 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { | ... | @@ -660,12 +658,17 @@ public class PceWebTopovMessageHandler extends UiMessageHandler { |
660 | tunnelSet = tunnelService.queryTunnel(MPLS); | 658 | tunnelSet = tunnelService.queryTunnel(MPLS); |
661 | for (Tunnel tunnel : tunnelSet) { | 659 | for (Tunnel tunnel : tunnelSet) { |
662 | if (tunnel.path() == null) { | 660 | if (tunnel.path() == null) { |
663 | - log.info("path does not exist"); | 661 | + log.error("path does not exist"); |
664 | return; | 662 | return; |
665 | } | 663 | } |
666 | paths.add(tunnel.path()); | 664 | paths.add(tunnel.path()); |
667 | } | 665 | } |
668 | 666 | ||
667 | + if (tunnelSet.size() == 0) { | ||
668 | + log.warn("Tunnel does not exist"); | ||
669 | + return; | ||
670 | + } | ||
671 | + | ||
669 | ImmutableSet.Builder<Link> builder = ImmutableSet.builder(); | 672 | ImmutableSet.Builder<Link> builder = ImmutableSet.builder(); |
670 | allPathLinks = buildPaths(builder).build(); | 673 | allPathLinks = buildPaths(builder).build(); |
671 | hilightAndSendPaths(); | 674 | hilightAndSendPaths(); | ... | ... |
... | @@ -17,18 +17,28 @@ | ... | @@ -17,18 +17,28 @@ |
17 | package org.onosproject.pceweb; | 17 | package org.onosproject.pceweb; |
18 | 18 | ||
19 | 19 | ||
20 | +import java.util.HashMap; | ||
21 | +import java.util.Map; | ||
22 | +import java.util.Set; | ||
23 | + | ||
24 | +import org.onlab.util.Bandwidth; | ||
20 | import org.onosproject.net.AnnotationKeys; | 25 | import org.onosproject.net.AnnotationKeys; |
21 | import org.onosproject.net.Annotations; | 26 | import org.onosproject.net.Annotations; |
22 | import org.onosproject.net.Device; | 27 | import org.onosproject.net.Device; |
23 | import org.onosproject.net.DeviceId; | 28 | import org.onosproject.net.DeviceId; |
29 | +import org.onosproject.net.Link; | ||
24 | import org.onosproject.ui.UiTopoOverlay; | 30 | import org.onosproject.ui.UiTopoOverlay; |
25 | import org.onosproject.ui.topo.ButtonId; | 31 | import org.onosproject.ui.topo.ButtonId; |
26 | import org.onosproject.ui.topo.PropertyPanel; | 32 | import org.onosproject.ui.topo.PropertyPanel; |
27 | import org.onosproject.net.HostId; | 33 | import org.onosproject.net.HostId; |
28 | import org.onosproject.net.device.DeviceService; | 34 | import org.onosproject.net.device.DeviceService; |
35 | +import org.onosproject.net.link.LinkEvent; | ||
36 | +import org.onosproject.net.resource.ContinuousResource; | ||
37 | +import org.onosproject.net.resource.DiscreteResource; | ||
38 | +import org.onosproject.net.resource.Resource; | ||
39 | +import org.onosproject.net.resource.ResourceService; | ||
40 | +import org.onosproject.net.resource.Resources; | ||
29 | import org.onosproject.ui.topo.TopoConstants.CoreButtons; | 41 | import org.onosproject.ui.topo.TopoConstants.CoreButtons; |
30 | - | ||
31 | -import static org.onosproject.ui.topo.TopoConstants.Properties.*; | ||
32 | import org.onosproject.cli.AbstractShellCommand; | 42 | import org.onosproject.cli.AbstractShellCommand; |
33 | 43 | ||
34 | /** | 44 | /** |
... | @@ -42,7 +52,9 @@ public class PceWebTopovOverlay extends UiTopoOverlay { | ... | @@ -42,7 +52,9 @@ public class PceWebTopovOverlay extends UiTopoOverlay { |
42 | 52 | ||
43 | public static final String AS_NUMBER = "asNumber"; | 53 | public static final String AS_NUMBER = "asNumber"; |
44 | public static final String DOMAIN_IDENTIFIER = "domainIdentifier"; | 54 | public static final String DOMAIN_IDENTIFIER = "domainIdentifier"; |
45 | - public static final String ROUTING_UNIVERSE = "routingUniverse"; | 55 | + public static final String ABR_BIT = "abrBit"; |
56 | + public static final String ASBR_BIT = "externalBit"; | ||
57 | + public static final String TE_METRIC = "teCost"; | ||
46 | 58 | ||
47 | private static final ButtonId SRC_BUTTON = new ButtonId("src"); | 59 | private static final ButtonId SRC_BUTTON = new ButtonId("src"); |
48 | private static final ButtonId DST_BUTTON = new ButtonId("dst"); | 60 | private static final ButtonId DST_BUTTON = new ButtonId("dst"); |
... | @@ -77,34 +89,75 @@ public class PceWebTopovOverlay extends UiTopoOverlay { | ... | @@ -77,34 +89,75 @@ public class PceWebTopovOverlay extends UiTopoOverlay { |
77 | if (deviceService != null) { | 89 | if (deviceService != null) { |
78 | 90 | ||
79 | Device device = deviceService.getDevice(deviceId); | 91 | Device device = deviceService.getDevice(deviceId); |
80 | - Annotations annot = device.annotations(); | 92 | + Annotations annots = device.annotations(); |
81 | 93 | ||
82 | - String routerId = annot.value(AnnotationKeys.ROUTER_ID); | 94 | + String routerId = annots.value(AnnotationKeys.ROUTER_ID); |
83 | - String type = annot.value(AnnotationKeys.TYPE); | 95 | + String type = annots.value(AnnotationKeys.TYPE); |
84 | - String asNumber = annot.value(AS_NUMBER); | 96 | + String asNumber = annots.value(AS_NUMBER); |
85 | - String domain = annot.value(DOMAIN_IDENTIFIER); | 97 | + String domain = annots.value(DOMAIN_IDENTIFIER); |
86 | - String routingUnverse = annot.value(ROUTING_UNIVERSE); | 98 | + String abrStatus = annots.value(ABR_BIT); |
99 | + String asbrStatus = annots.value(ASBR_BIT); | ||
87 | 100 | ||
88 | if (type != null) { | 101 | if (type != null) { |
89 | pp.addProp("Type", type); | 102 | pp.addProp("Type", type); |
90 | } | 103 | } |
91 | - /* TBD: Router ID need to print | 104 | + |
92 | if (routerId != null) { | 105 | if (routerId != null) { |
93 | pp.addProp("Router-ID", routerId); | 106 | pp.addProp("Router-ID", routerId); |
94 | - } */ | ||
95 | - if (routingUnverse != null) { | ||
96 | - pp.addProp("Routing Universe", routingUnverse); | ||
97 | } | 107 | } |
108 | + | ||
98 | if (asNumber != null) { | 109 | if (asNumber != null) { |
99 | pp.addProp("AS Number", asNumber); | 110 | pp.addProp("AS Number", asNumber); |
100 | } | 111 | } |
112 | + | ||
101 | if (domain != null) { | 113 | if (domain != null) { |
102 | pp.addProp("Domain ID", domain); | 114 | pp.addProp("Domain ID", domain); |
103 | } | 115 | } |
116 | + | ||
117 | + if (abrStatus != null) { | ||
118 | + pp.addProp("ABR Role", abrStatus); | ||
119 | + } | ||
120 | + | ||
121 | + if (asbrStatus != null) { | ||
122 | + pp.addProp("ASBR Role", asbrStatus); | ||
123 | + } | ||
104 | } | 124 | } |
105 | } | 125 | } |
106 | 126 | ||
107 | @Override | 127 | @Override |
128 | + public Map<String, String> additionalLinkData(LinkEvent event) { | ||
129 | + Map<String, String> map = new HashMap<>(); | ||
130 | + Link link = event.subject(); | ||
131 | + | ||
132 | + map.put("Src port", link.src().port().toString()); | ||
133 | + map.put("Dst port", link.dst().port().toString()); | ||
134 | + map.put("Te metric", link.annotations().value(TE_METRIC)); | ||
135 | + | ||
136 | + ResourceService resService = AbstractShellCommand.get(ResourceService.class); | ||
137 | + DiscreteResource devResource = Resources.discrete(link.src().deviceId(), link.src().port()).resource(); | ||
138 | + if (resService == null) { | ||
139 | + log.warn("resource service does not exist "); | ||
140 | + return map; | ||
141 | + } | ||
142 | + | ||
143 | + if (devResource == null) { | ||
144 | + log.warn("Device resources does not exist "); | ||
145 | + return map; | ||
146 | + } | ||
147 | + Set<Resource> resources = resService.getAvailableResources(devResource.id(), Bandwidth.class); | ||
148 | + if (resources.isEmpty()) { | ||
149 | + log.warn("Bandwidth resources does not exist "); | ||
150 | + return map; | ||
151 | + } | ||
152 | + | ||
153 | + if (resources.iterator().next() instanceof ContinuousResource) { | ||
154 | + map.put("Bandwidth", ((ContinuousResource) resources.iterator().next()).toString()); | ||
155 | + } | ||
156 | + | ||
157 | + return map; | ||
158 | + } | ||
159 | + | ||
160 | + @Override | ||
108 | public void modifyHostDetails(PropertyPanel pp, HostId hostId) { | 161 | public void modifyHostDetails(PropertyPanel pp, HostId hostId) { |
109 | pp.addButton(SRC_BUTTON).addButton(DST_BUTTON); | 162 | pp.addButton(SRC_BUTTON).addButton(DST_BUTTON); |
110 | } | 163 | } | ... | ... |
... | @@ -96,9 +96,9 @@ | ... | @@ -96,9 +96,9 @@ |
96 | addAttribute('pce-cost-type-valname', 'pce-cost-type-te', 'TE', 'radio'); | 96 | addAttribute('pce-cost-type-valname', 'pce-cost-type-te', 'TE', 'radio'); |
97 | //Add the LSP type related inputs. | 97 | //Add the LSP type related inputs. |
98 | addAttribute('pce-lsp-type-name', 'pce-lsp-type', 'Lsp Type', 'checkbox'); | 98 | addAttribute('pce-lsp-type-name', 'pce-lsp-type', 'Lsp Type', 'checkbox'); |
99 | - addAttribute('pce-lsp-type-valname', 'pce-lsp-type-cr', 'WITH SIGNALLING', 'radio'); | 99 | + addAttribute('pce-lsp-type-valname', 'pce-lsp-type-cr', 'With signalling', 'radio'); |
100 | - addAttribute('pce-lsp-type-valname', 'pce-lsp-type-srbe', 'WITHOUT SR WITHOUT SIGNALLING', 'radio'); | 100 | + addAttribute('pce-lsp-type-valname', 'pce-lsp-type-srbe', 'Without SR without signalling', 'radio'); |
101 | - addAttribute('pce-lsp-type-valname', 'pce-lsp-type-srte', 'WITH SR WITHOUT SIGNALLING', 'radio'); | 101 | + addAttribute('pce-lsp-type-valname', 'pce-lsp-type-srte', 'With SR without signalling', 'radio'); |
102 | //Add the tunnel name | 102 | //Add the tunnel name |
103 | addAttribute('pce-tunnel-name', 'pce-tunnel-name-id', 'Tunnel Name', 'text'); | 103 | addAttribute('pce-tunnel-name', 'pce-tunnel-name-id', 'Tunnel Name', 'text'); |
104 | 104 | ||
... | @@ -182,12 +182,12 @@ | ... | @@ -182,12 +182,12 @@ |
182 | return content; | 182 | return content; |
183 | } | 183 | } |
184 | 184 | ||
185 | - function isChecked(viewId) { | 185 | + function isChecked(cboxId) { |
186 | - return d3.select('#' + viewId).property('checked'); | 186 | + return d3.select('#' + cboxId).property('checked'); |
187 | } | 187 | } |
188 | 188 | ||
189 | - function getCheckedValue(viewId) { | 189 | + function getCheckedValue(cboxId) { |
190 | - return d3.select('#' + viewId).property('value'); | 190 | + return d3.select('#' + cboxId).property('value'); |
191 | } | 191 | } |
192 | 192 | ||
193 | function showTunnelInformation(data) { | 193 | function showTunnelInformation(data) { |
... | @@ -198,25 +198,19 @@ | ... | @@ -198,25 +198,19 @@ |
198 | var tdString = '' ; | 198 | var tdString = '' ; |
199 | tunnelNameData.a.forEach( function (val, idx) { | 199 | tunnelNameData.a.forEach( function (val, idx) { |
200 | var tunnelName = isChecked('tunnel-id-'+idx); | 200 | var tunnelName = isChecked('tunnel-id-'+idx); |
201 | - if (tunnelName) | 201 | + if (tunnelName) { |
202 | - { | ||
203 | tdString = val; | 202 | tdString = val; |
204 | } | 203 | } |
205 | } ); | 204 | } ); |
206 | 205 | ||
207 | - if (tdString) { | 206 | + constraintsUpdateDialog(tdString); |
208 | - constraintsUpdateDialog(tdString); | ||
209 | - } else { | ||
210 | - $log.debug("No tunnel id is selected."); | ||
211 | - } | ||
212 | - | ||
213 | $log.debug('Dialog OK button clicked'); | 207 | $log.debug('Dialog OK button clicked'); |
214 | } | 208 | } |
215 | 209 | ||
216 | tds.openDialog() | 210 | tds.openDialog() |
217 | .setTitle('Available LSPs with selected device') | 211 | .setTitle('Available LSPs with selected device') |
218 | .addContent(createUserTextUpdate(data)) | 212 | .addContent(createUserTextUpdate(data)) |
219 | - .addOkChained(dOkUpdate, 'GOTO Selection of constraints') | 213 | + .addOkChained(dOkUpdate, 'OK') |
220 | .addCancel(dClose, 'Close') | 214 | .addCancel(dClose, 'Close') |
221 | .bindKeys(); | 215 | .bindKeys(); |
222 | } | 216 | } |
... | @@ -266,7 +260,7 @@ | ... | @@ -266,7 +260,7 @@ |
266 | .setTitle('Select constraints for update path') | 260 | .setTitle('Select constraints for update path') |
267 | .addContent(createUserTextUpdatePathEvent()) | 261 | .addContent(createUserTextUpdatePathEvent()) |
268 | .addCancel() | 262 | .addCancel() |
269 | - .addOk(dOkUpdateEvent, 'Update Path') // NOTE: NOT the "chained" version! | 263 | + .addOk(dOkUpdateEvent, 'OK') // NOTE: NOT the "chained" version! |
270 | .bindKeys(); | 264 | .bindKeys(); |
271 | 265 | ||
272 | } | 266 | } |
... | @@ -278,7 +272,7 @@ | ... | @@ -278,7 +272,7 @@ |
278 | tds.openDialog() | 272 | tds.openDialog() |
279 | .setTitle('Available Tunnels for remove') | 273 | .setTitle('Available Tunnels for remove') |
280 | .addContent(createUserTextRemove(data)) | 274 | .addContent(createUserTextRemove(data)) |
281 | - .addOk(dOkRemove, 'Remove') | 275 | + .addOk(dOkRemove, 'OK') |
282 | .addCancel(dClose, 'Close') | 276 | .addCancel(dClose, 'Close') |
283 | .bindKeys(); | 277 | .bindKeys(); |
284 | } | 278 | } | ... | ... |
... | @@ -168,6 +168,29 @@ | ... | @@ -168,6 +168,29 @@ |
168 | }, | 168 | }, |
169 | multi: function (selectOrder) { | 169 | multi: function (selectOrder) { |
170 | selectionCallback(selectOrder); | 170 | selectionCallback(selectOrder); |
171 | + }, | ||
172 | + modifylinkdata: function (data, extra) { | ||
173 | + $log.debug("Modify link data", data, extra); | ||
174 | + | ||
175 | + function sep() { | ||
176 | + data.propOrder.push('-'); | ||
177 | + } | ||
178 | + | ||
179 | + function add(key) { | ||
180 | + var val = extra[key]; | ||
181 | + if (val !== undefined) { | ||
182 | + data.propOrder.push(key); | ||
183 | + data.props[key] = val; | ||
184 | + } | ||
185 | + } | ||
186 | + | ||
187 | + sep(); | ||
188 | + add('Src port'); | ||
189 | + add('Dst port'); | ||
190 | + add('Te metric'); | ||
191 | + add('Bandwidth'); | ||
192 | + | ||
193 | + return data; | ||
171 | } | 194 | } |
172 | } | 195 | } |
173 | }; | 196 | }; | ... | ... |
-
Please register or login to post a comment