Fixing optical link state issues; a few still remain.
Change-Id: I126f89384adbe5272bdaf4eb0e3b456984768a98
Showing
9 changed files
with
172 additions
and
54 deletions
| 1 | +/* | ||
| 2 | + * Copyright 2014 Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onlab.onos.optical; | ||
| 17 | + | ||
| 18 | +import org.apache.felix.scr.annotations.Activate; | ||
| 19 | +import org.apache.felix.scr.annotations.Component; | ||
| 20 | +import org.apache.felix.scr.annotations.Deactivate; | ||
| 21 | +import org.apache.felix.scr.annotations.Reference; | ||
| 22 | +import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
| 23 | +import org.onlab.onos.net.Device; | ||
| 24 | +import org.onlab.onos.net.Link; | ||
| 25 | +import org.onlab.onos.net.device.DeviceEvent; | ||
| 26 | +import org.onlab.onos.net.device.DeviceListener; | ||
| 27 | +import org.onlab.onos.net.device.DeviceService; | ||
| 28 | +import org.onlab.onos.net.link.DefaultLinkDescription; | ||
| 29 | +import org.onlab.onos.net.link.LinkDescription; | ||
| 30 | +import org.onlab.onos.net.link.LinkEvent; | ||
| 31 | +import org.onlab.onos.net.link.LinkListener; | ||
| 32 | +import org.onlab.onos.net.link.LinkProvider; | ||
| 33 | +import org.onlab.onos.net.link.LinkProviderRegistry; | ||
| 34 | +import org.onlab.onos.net.link.LinkProviderService; | ||
| 35 | +import org.onlab.onos.net.link.LinkService; | ||
| 36 | +import org.onlab.onos.net.provider.AbstractProvider; | ||
| 37 | +import org.onlab.onos.net.provider.ProviderId; | ||
| 38 | +import org.slf4j.Logger; | ||
| 39 | +import org.slf4j.LoggerFactory; | ||
| 40 | + | ||
| 41 | +import static org.onlab.onos.net.Link.Type.OPTICAL; | ||
| 42 | + | ||
| 43 | +/** | ||
| 44 | + * Ancillary provider to activate/deactivate optical links as their respective | ||
| 45 | + * devices go online or offline. | ||
| 46 | + */ | ||
| 47 | +@Component(immediate = true) | ||
| 48 | +public class OpticalLinkProvider extends AbstractProvider implements LinkProvider { | ||
| 49 | + | ||
| 50 | + private static final Logger log = LoggerFactory.getLogger(OpticalLinkProvider.class); | ||
| 51 | + | ||
| 52 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 53 | + protected LinkProviderRegistry registry; | ||
| 54 | + | ||
| 55 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 56 | + protected DeviceService deviceService; | ||
| 57 | + | ||
| 58 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
| 59 | + protected LinkService linkService; | ||
| 60 | + | ||
| 61 | + private LinkProviderService providerService; | ||
| 62 | + private DeviceListener deviceListener = new InternalDeviceListener(); | ||
| 63 | + private LinkListener linkListener = new InternalLinkListener(); | ||
| 64 | + | ||
| 65 | + public OpticalLinkProvider() { | ||
| 66 | + super(new ProviderId("optical", "org.onlab.onos.optical")); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Activate | ||
| 70 | + protected void activate() { | ||
| 71 | + deviceService.addListener(deviceListener); | ||
| 72 | + linkService.addListener(linkListener); | ||
| 73 | + providerService = registry.register(this); | ||
| 74 | + log.info("Started"); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Deactivate | ||
| 78 | + protected void deactivate() { | ||
| 79 | + deviceService.removeListener(deviceListener); | ||
| 80 | + linkService.removeListener(linkListener); | ||
| 81 | + registry.unregister(this); | ||
| 82 | + log.info("Stopped"); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + //Listens to device events and processes their links. | ||
| 86 | + private class InternalDeviceListener implements DeviceListener { | ||
| 87 | + @Override | ||
| 88 | + public void event(DeviceEvent event) { | ||
| 89 | + DeviceEvent.Type type = event.type(); | ||
| 90 | + Device device = event.subject(); | ||
| 91 | + if (type == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED || | ||
| 92 | + type == DeviceEvent.Type.DEVICE_ADDED || | ||
| 93 | + type == DeviceEvent.Type.DEVICE_UPDATED) { | ||
| 94 | + processLinks(device); | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + //Listens to link events and processes the link additions. | ||
| 100 | + private class InternalLinkListener implements LinkListener { | ||
| 101 | + @Override | ||
| 102 | + public void event(LinkEvent event) { | ||
| 103 | + if (event.type() == LinkEvent.Type.LINK_ADDED) { | ||
| 104 | + Link link = event.subject(); | ||
| 105 | + if (link.providerId().scheme().equals("cfg")) { | ||
| 106 | + processLink(event.subject()); | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + private void processLinks(Device device) { | ||
| 113 | + for (Link link : linkService.getDeviceLinks(device.id())) { | ||
| 114 | + if (link.isDurable() && link.type() == OPTICAL) { | ||
| 115 | + processLink(link); | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + private void processLink(Link link) { | ||
| 121 | + boolean active = deviceService.isAvailable(link.src().deviceId()) && | ||
| 122 | + deviceService.isAvailable(link.dst().deviceId()); | ||
| 123 | + LinkDescription desc = new DefaultLinkDescription(link.src(), link.dst(), OPTICAL); | ||
| 124 | + if (active) { | ||
| 125 | + providerService.linkDetected(desc); | ||
| 126 | + } else { | ||
| 127 | + providerService.linkVanished(desc); | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | +} |
| ... | @@ -15,20 +15,6 @@ | ... | @@ -15,20 +15,6 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onlab.onos.optical.cfg; | 16 | package org.onlab.onos.optical.cfg; |
| 17 | 17 | ||
| 18 | -import static org.onlab.onos.net.DeviceId.deviceId; | ||
| 19 | - | ||
| 20 | -import java.io.File; | ||
| 21 | -import java.io.IOException; | ||
| 22 | -import java.util.ArrayList; | ||
| 23 | -import java.util.Iterator; | ||
| 24 | -import java.util.List; | ||
| 25 | -import java.util.Map; | ||
| 26 | -import java.util.Set; | ||
| 27 | - | ||
| 28 | -import org.apache.felix.scr.annotations.Activate; | ||
| 29 | -import org.apache.felix.scr.annotations.Deactivate; | ||
| 30 | -import org.apache.felix.scr.annotations.Reference; | ||
| 31 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
| 32 | import org.codehaus.jackson.JsonNode; | 18 | import org.codehaus.jackson.JsonNode; |
| 33 | import org.codehaus.jackson.JsonParseException; | 19 | import org.codehaus.jackson.JsonParseException; |
| 34 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; | 20 | import org.codehaus.jackson.annotate.JsonIgnoreProperties; |
| ... | @@ -56,6 +42,16 @@ import org.onlab.packet.ChassisId; | ... | @@ -56,6 +42,16 @@ import org.onlab.packet.ChassisId; |
| 56 | import org.slf4j.Logger; | 42 | import org.slf4j.Logger; |
| 57 | import org.slf4j.LoggerFactory; | 43 | import org.slf4j.LoggerFactory; |
| 58 | 44 | ||
| 45 | +import java.io.File; | ||
| 46 | +import java.io.IOException; | ||
| 47 | +import java.util.ArrayList; | ||
| 48 | +import java.util.Iterator; | ||
| 49 | +import java.util.List; | ||
| 50 | +import java.util.Map; | ||
| 51 | +import java.util.Set; | ||
| 52 | + | ||
| 53 | +import static org.onlab.onos.net.DeviceId.deviceId; | ||
| 54 | + | ||
| 59 | /** | 55 | /** |
| 60 | * OpticalConfigProvider emulates the SB network provider for optical switches, | 56 | * OpticalConfigProvider emulates the SB network provider for optical switches, |
| 61 | * optical links and any other state that needs to be configured for correct network | 57 | * optical links and any other state that needs to be configured for correct network |
| ... | @@ -75,10 +71,10 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro | ... | @@ -75,10 +71,10 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro |
| 75 | "config/demo-3-roadm-2-ps.json"; | 71 | "config/demo-3-roadm-2-ps.json"; |
| 76 | private String configFileName = DEFAULT_CONFIG_FILE; | 72 | private String configFileName = DEFAULT_CONFIG_FILE; |
| 77 | 73 | ||
| 78 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 74 | +// @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 79 | protected LinkProviderRegistry linkProviderRegistry; | 75 | protected LinkProviderRegistry linkProviderRegistry; |
| 80 | 76 | ||
| 81 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 77 | +// @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 82 | protected DeviceProviderRegistry deviceProviderRegistry; | 78 | protected DeviceProviderRegistry deviceProviderRegistry; |
| 83 | 79 | ||
| 84 | private static final String OPTICAL_ANNOTATION = "optical."; | 80 | private static final String OPTICAL_ANNOTATION = "optical."; |
| ... | @@ -101,7 +97,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro | ... | @@ -101,7 +97,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro |
| 101 | ".opticalConfig")); | 97 | ".opticalConfig")); |
| 102 | } | 98 | } |
| 103 | 99 | ||
| 104 | - @Activate | 100 | +// @Activate |
| 105 | protected void activate() { | 101 | protected void activate() { |
| 106 | linkProviderService = linkProviderRegistry.register(this); | 102 | linkProviderService = linkProviderRegistry.register(this); |
| 107 | deviceProviderService = deviceProviderRegistry.register(this); | 103 | deviceProviderService = deviceProviderRegistry.register(this); |
| ... | @@ -113,7 +109,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro | ... | @@ -113,7 +109,7 @@ public class OpticalConfigProvider extends AbstractProvider implements DevicePro |
| 113 | publishOpticalConfig(); | 109 | publishOpticalConfig(); |
| 114 | } | 110 | } |
| 115 | 111 | ||
| 116 | - @Deactivate | 112 | +// @Deactivate |
| 117 | protected void deactivate() { | 113 | protected void deactivate() { |
| 118 | linkProviderRegistry.unregister(this); | 114 | linkProviderRegistry.unregister(this); |
| 119 | linkProviderService = null; | 115 | linkProviderService = null; | ... | ... |
| ... | @@ -30,12 +30,6 @@ public final class AnnotationKeys { | ... | @@ -30,12 +30,6 @@ public final class AnnotationKeys { |
| 30 | public static final String DURABLE = "durable"; | 30 | public static final String DURABLE = "durable"; |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | - * Annotation key for active/inactive links. Links are implicitly | ||
| 34 | - * considered active unless explicitly marked otherwise. | ||
| 35 | - */ | ||
| 36 | - public static final String INACTIVE = "inactive"; | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | * Annotation key for latency. | 33 | * Annotation key for latency. |
| 40 | */ | 34 | */ |
| 41 | public static final String LATENCY = "latency"; | 35 | public static final String LATENCY = "latency"; | ... | ... |
| ... | @@ -531,9 +531,7 @@ public class GossipLinkStore | ... | @@ -531,9 +531,7 @@ public class GossipLinkStore |
| 531 | } | 531 | } |
| 532 | 532 | ||
| 533 | boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true"); | 533 | boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true"); |
| 534 | - boolean isActive = !Objects.equals(annotations.value(AnnotationKeys.INACTIVE), "true"); | 534 | + return new DefaultLink(baseProviderId, src, dst, type, ACTIVE, isDurable, annotations); |
| 535 | - return new DefaultLink(baseProviderId, src, dst, type, | ||
| 536 | - isActive ? ACTIVE : INACTIVE, isDurable, annotations); | ||
| 537 | } | 535 | } |
| 538 | 536 | ||
| 539 | private Map<ProviderId, Timestamped<LinkDescription>> getOrCreateLinkDescriptions(LinkKey key) { | 537 | private Map<ProviderId, Timestamped<LinkDescription>> getOrCreateLinkDescriptions(LinkKey key) { | ... | ... |
| ... | @@ -314,9 +314,7 @@ public class SimpleLinkStore | ... | @@ -314,9 +314,7 @@ public class SimpleLinkStore |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true"); | 316 | boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true"); |
| 317 | - boolean isActive = !Objects.equals(annotations.value(AnnotationKeys.INACTIVE), "true"); | 317 | + return new DefaultLink(primary, src, dst, type, ACTIVE, isDurable, annotations); |
| 318 | - return new DefaultLink(primary, src, dst, type, | ||
| 319 | - isActive ? ACTIVE : INACTIVE, isDurable, annotations); | ||
| 320 | } | 318 | } |
| 321 | 319 | ||
| 322 | private Map<ProviderId, LinkDescription> getOrCreateLinkDescriptions(LinkKey key) { | 320 | private Map<ProviderId, LinkDescription> getOrCreateLinkDescriptions(LinkKey key) { | ... | ... |
| ... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
| 9 | { "alias": "s7", "uri": "of:0000000000000007", "mac": "000000000007", "annotations": { "name": "WASH", "latitude": 38.906696, "longitude": -77.035509 }, "type": "SWITCH" }, | 9 | { "alias": "s7", "uri": "of:0000000000000007", "mac": "000000000007", "annotations": { "name": "WASH", "latitude": 38.906696, "longitude": -77.035509 }, "type": "SWITCH" }, |
| 10 | { "alias": "s8", "uri": "of:0000000000000008", "mac": "000000000008", "annotations": { "name": "NSVL", "latitude": 36.166410, "longitude": -86.787305 }, "type": "SWITCH" }, | 10 | { "alias": "s8", "uri": "of:0000000000000008", "mac": "000000000008", "annotations": { "name": "NSVL", "latitude": 36.166410, "longitude": -86.787305 }, "type": "SWITCH" }, |
| 11 | { "alias": "s9", "uri": "of:0000000000000009", "mac": "000000000009", "annotations": { "name": "STLS", "latitude": 38.626418, "longitude": -90.198143 }, "type": "SWITCH" }, | 11 | { "alias": "s9", "uri": "of:0000000000000009", "mac": "000000000009", "annotations": { "name": "STLS", "latitude": 38.626418, "longitude": -90.198143 }, "type": "SWITCH" }, |
| 12 | - { "alias": "s10", "uri": "of:000000000000000a", "mac": "00000000000a", "annotations": { "name": "NWOR", "Xlatitude": 0.0, "Xlongitude": 0.00 }, "type": "SWITCH" }, | 12 | + { "alias": "s10", "uri": "of:000000000000000a", "mac": "00000000000a", "annotations": { "name": "NWOR", "latitude": 29.951475, "longitude": -90.078434 }, "type": "SWITCH" }, |
| 13 | { "alias": "s11", "uri": "of:000000000000000b", "mac": "00000000000b", "annotations": { "name": "HSTN", "latitude": 29.763249, "longitude": -95.368332 }, "type": "SWITCH" }, | 13 | { "alias": "s11", "uri": "of:000000000000000b", "mac": "00000000000b", "annotations": { "name": "HSTN", "latitude": 29.763249, "longitude": -95.368332 }, "type": "SWITCH" }, |
| 14 | { "alias": "s12", "uri": "of:000000000000000c", "mac": "00000000000c", "annotations": { "name": "SNAN", "latitude": 29.424331, "longitude": -98.491745 }, "type": "SWITCH" }, | 14 | { "alias": "s12", "uri": "of:000000000000000c", "mac": "00000000000c", "annotations": { "name": "SNAN", "latitude": 29.424331, "longitude": -98.491745 }, "type": "SWITCH" }, |
| 15 | { "alias": "s13", "uri": "of:000000000000000d", "mac": "00000000000d", "annotations": { "name": "DLLS", "latitude": 32.777665, "longitude": -96.802064 }, "type": "SWITCH" }, | 15 | { "alias": "s13", "uri": "of:000000000000000d", "mac": "00000000000d", "annotations": { "name": "DLLS", "latitude": 32.777665, "longitude": -96.802064 }, "type": "SWITCH" }, |
| ... | @@ -37,7 +37,7 @@ | ... | @@ -37,7 +37,7 @@ |
| 37 | { "alias": "h7", "mac": "00:00:00:00:00:07", "vlan": -1, "location": "of:0000000000000007/1", "ip": "10.0.0.7", "annotations": { "name": "WASH", "latitude": 40.906696, "longitude": -77.035509 } }, | 37 | { "alias": "h7", "mac": "00:00:00:00:00:07", "vlan": -1, "location": "of:0000000000000007/1", "ip": "10.0.0.7", "annotations": { "name": "WASH", "latitude": 40.906696, "longitude": -77.035509 } }, |
| 38 | { "alias": "h8", "mac": "00:00:00:00:00:08", "vlan": -1, "location": "of:0000000000000008/1", "ip": "10.0.0.8", "annotations": { "name": "NSVL", "latitude": 38.166410, "longitude": -86.787305 } }, | 38 | { "alias": "h8", "mac": "00:00:00:00:00:08", "vlan": -1, "location": "of:0000000000000008/1", "ip": "10.0.0.8", "annotations": { "name": "NSVL", "latitude": 38.166410, "longitude": -86.787305 } }, |
| 39 | { "alias": "h9", "mac": "00:00:00:00:00:09", "vlan": -1, "location": "of:0000000000000009/1", "ip": "10.0.0.9", "annotations": { "name": "STLS", "latitude": 40.626418, "longitude": -90.198143 } }, | 39 | { "alias": "h9", "mac": "00:00:00:00:00:09", "vlan": -1, "location": "of:0000000000000009/1", "ip": "10.0.0.9", "annotations": { "name": "STLS", "latitude": 40.626418, "longitude": -90.198143 } }, |
| 40 | - { "alias": "h10", "mac": "00:00:00:00:00:0a", "vlan": -1, "location": "of:000000000000000a/1", "ip": "10.0.0.10", "annotations": { "name": "NWOR", "Xlatitude": 0.0, "Xlongitude": 0.00 } }, | 40 | + { "alias": "h10", "mac": "00:00:00:00:00:0a", "vlan": -1, "location": "of:000000000000000a/1", "ip": "10.0.0.10", "annotations": { "name": "NWOR", "latitude": 31.951475, "longitude": -90.078434 } }, |
| 41 | { "alias": "h11", "mac": "00:00:00:00:00:0b", "vlan": -1, "location": "of:000000000000000b/1", "ip": "10.0.0.11", "annotations": { "name": "HSTN", "latitude": 31.763249, "longitude": -95.368332 } }, | 41 | { "alias": "h11", "mac": "00:00:00:00:00:0b", "vlan": -1, "location": "of:000000000000000b/1", "ip": "10.0.0.11", "annotations": { "name": "HSTN", "latitude": 31.763249, "longitude": -95.368332 } }, |
| 42 | { "alias": "h12", "mac": "00:00:00:00:00:0c", "vlan": -1, "location": "of:000000000000000c/1", "ip": "10.0.0.12", "annotations": { "name": "SNAN", "latitude": 31.424331, "longitude": -98.491745 } }, | 42 | { "alias": "h12", "mac": "00:00:00:00:00:0c", "vlan": -1, "location": "of:000000000000000c/1", "ip": "10.0.0.12", "annotations": { "name": "SNAN", "latitude": 31.424331, "longitude": -98.491745 } }, |
| 43 | { "alias": "h13", "mac": "00:00:00:00:00:0d", "vlan": -1, "location": "of:000000000000000d/1", "ip": "10.0.0.13", "annotations": { "name": "DLLS", "latitude": 34.777665, "longitude": -96.802064 } }, | 43 | { "alias": "h13", "mac": "00:00:00:00:00:0d", "vlan": -1, "location": "of:000000000000000d/1", "ip": "10.0.0.13", "annotations": { "name": "DLLS", "latitude": 34.777665, "longitude": -96.802064 } }, | ... | ... |
| ... | @@ -32,7 +32,7 @@ class AttMplsTopo( Topo ): | ... | @@ -32,7 +32,7 @@ class AttMplsTopo( Topo ): |
| 32 | WASH = self.addSwitch( 's7' ) // 38.906696, -77.035509 | 32 | WASH = self.addSwitch( 's7' ) // 38.906696, -77.035509 |
| 33 | NSVL = self.addSwitch( 's8' ) // 36.166410, -86.787305 | 33 | NSVL = self.addSwitch( 's8' ) // 36.166410, -86.787305 |
| 34 | STLS = self.addSwitch( 's9' ) // 38.626418, -90.198143 | 34 | STLS = self.addSwitch( 's9' ) // 38.626418, -90.198143 |
| 35 | - NWOR = self.addSwitch( 's10' ) // | 35 | + NWOR = self.addSwitch( 's10' ) // 29.951475, -90.078434 |
| 36 | HSTN = self.addSwitch( 's11' ) // 29.763249, -95.368332 | 36 | HSTN = self.addSwitch( 's11' ) // 29.763249, -95.368332 |
| 37 | SNAN = self.addSwitch( 's12' ) // 29.424331, -98.491745 | 37 | SNAN = self.addSwitch( 's12' ) // 29.424331, -98.491745 |
| 38 | DLLS = self.addSwitch( 's13' ) // 32.777665, -96.802064 | 38 | DLLS = self.addSwitch( 's13' ) // 32.777665, -96.802064 | ... | ... |
| ... | @@ -124,26 +124,26 @@ | ... | @@ -124,26 +124,26 @@ |
| 124 | ], | 124 | ], |
| 125 | 125 | ||
| 126 | "links" : [ | 126 | "links" : [ |
| 127 | - { "src": "of:0000ffffffffff01/50", "dst": "of:0000ffffffffff02/30","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 48, "durable": "true", "inactive": "true" } }, | 127 | + { "src": "of:0000ffffffffff01/50", "dst": "of:0000ffffffffff02/30","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 48, "durable": "true" } }, |
| 128 | - { "src": "of:0000ffffffffff02/50", "dst": "of:0000ffffffffff03/30","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 493, "durable": "true", "inactive": "true" } }, | 128 | + { "src": "of:0000ffffffffff02/50", "dst": "of:0000ffffffffff03/30","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 493, "durable": "true" } }, |
| 129 | - { "src": "of:0000ffffffffff03/50", "dst": "of:0000ffffffffff04/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 171, "durable": "true", "inactive": "true" } }, | 129 | + { "src": "of:0000ffffffffff03/50", "dst": "of:0000ffffffffff04/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 171, "durable": "true" } }, |
| 130 | - { "src": "of:0000ffffffffff01/20", "dst": "of:0000ffffffffff05/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2555, "durable": "true", "inactive": "true" } }, | 130 | + { "src": "of:0000ffffffffff01/20", "dst": "of:0000ffffffffff05/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2555, "durable": "true" } }, |
| 131 | - { "src": "of:0000ffffffffff02/20", "dst": "of:0000ffffffffff05/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2539, "durable": "true", "inactive": "true" } }, | 131 | + { "src": "of:0000ffffffffff02/20", "dst": "of:0000ffffffffff05/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2539, "durable": "true" } }, |
| 132 | - { "src": "of:0000ffffffffff03/20", "dst": "of:0000ffffffffff06/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1979, "durable": "true", "inactive": "true" } }, | 132 | + { "src": "of:0000ffffffffff03/20", "dst": "of:0000ffffffffff06/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1979, "durable": "true" } }, |
| 133 | - { "src": "of:0000ffffffffff04/20", "dst": "of:0000ffffffffff06/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1867, "durable": "true", "inactive": "true" } }, | 133 | + { "src": "of:0000ffffffffff04/20", "dst": "of:0000ffffffffff06/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1867, "durable": "true" } }, |
| 134 | - { "src": "of:0000ffffffffff05/30", "dst": "of:0000ffffffffff06/40","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1378, "durable": "true", "inactive": "true" } }, | 134 | + { "src": "of:0000ffffffffff05/30", "dst": "of:0000ffffffffff06/40","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1378, "durable": "true" } }, |
| 135 | - { "src": "of:0000ffffffffff05/40", "dst": "of:0000ffffffffff07/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2200, "durable": "true", "inactive": "true" } }, | 135 | + { "src": "of:0000ffffffffff05/40", "dst": "of:0000ffffffffff07/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2200, "durable": "true" } }, |
| 136 | - { "src": "of:0000ffffffffff06/30", "dst": "of:0000ffffffffff08/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1918, "durable": "true", "inactive": "true" } }, | 136 | + { "src": "of:0000ffffffffff06/30", "dst": "of:0000ffffffffff08/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1918, "durable": "true" } }, |
| 137 | - { "src": "of:0000ffffffffff07/20", "dst": "of:0000ffffffffff08/30", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 3625, "durable": "true", "inactive": "true" } }, | 137 | + { "src": "of:0000ffffffffff07/20", "dst": "of:0000ffffffffff08/30", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 3625, "durable": "true" } }, |
| 138 | - { "src": "of:0000ffffffffff07/30", "dst": "of:0000ffffffffff09/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 3880, "durable": "true", "inactive": "true" } }, | 138 | + { "src": "of:0000ffffffffff07/30", "dst": "of:0000ffffffffff09/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 3880, "durable": "true" } }, |
| 139 | - { "src": "of:0000ffffffffff08/20", "dst": "of:0000ffffffffff0A/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 838, "durable": "true", "inactive": "true" } }, | 139 | + { "src": "of:0000ffffffffff08/20", "dst": "of:0000ffffffffff0A/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 838, "durable": "true" } }, |
| 140 | - { "src": "of:0000ffffffffff09/20", "dst": "of:0000ffffffffff0A/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1245, "durable": "true", "inactive": "true" } }, | 140 | + { "src": "of:0000ffffffffff09/20", "dst": "of:0000ffffffffff0A/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1245, "durable": "true" } }, |
| 141 | 141 | ||
| 142 | - { "src": "of:0000ffffffff0001/2", "dst": "of:0000ffffffffff01/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } }, | 142 | + { "src": "of:0000ffffffff0001/2", "dst": "of:0000ffffffffff01/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, |
| 143 | - { "src": "of:0000ffffffff0002/2", "dst": "of:0000ffffffffff04/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } }, | 143 | + { "src": "of:0000ffffffff0002/2", "dst": "of:0000ffffffffff04/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, |
| 144 | - { "src": "of:0000ffffffff0003/2", "dst": "of:0000ffffffffff06/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } }, | 144 | + { "src": "of:0000ffffffff0003/2", "dst": "of:0000ffffffffff06/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, |
| 145 | - { "src": "of:0000ffffffff0004/2", "dst": "of:0000ffffffffff07/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } }, | 145 | + { "src": "of:0000ffffffff0004/2", "dst": "of:0000ffffffffff07/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, |
| 146 | - { "src": "of:0000ffffffff0005/2", "dst": "of:0000ffffffffff09/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } }, | 146 | + { "src": "of:0000ffffffff0005/2", "dst": "of:0000ffffffffff09/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }, |
| 147 | - { "src": "of:0000ffffffff0006/2", "dst": "of:0000ffffffffff0A/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } } | 147 | + { "src": "of:0000ffffffff0006/2", "dst": "of:0000ffffffffff0A/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } } |
| 148 | ] | 148 | ] |
| 149 | } | 149 | } | ... | ... |
| ... | @@ -825,7 +825,7 @@ | ... | @@ -825,7 +825,7 @@ |
| 825 | // merge in remaining data | 825 | // merge in remaining data |
| 826 | $.extend(lnk, link, { | 826 | $.extend(lnk, link, { |
| 827 | class: 'link', | 827 | class: 'link', |
| 828 | - svgClass: (type ? 'link ' + type : 'link') + ' ' + (link.online ? 'active' : 'inactive') | 828 | + svgClass: (type ? 'link ' + type : 'link') |
| 829 | }); | 829 | }); |
| 830 | return lnk; | 830 | return lnk; |
| 831 | } | 831 | } |
| ... | @@ -863,6 +863,7 @@ | ... | @@ -863,6 +863,7 @@ |
| 863 | stroke: config.topo.linkInColor, | 863 | stroke: config.topo.linkInColor, |
| 864 | 'stroke-width': config.topo.linkInWidth | 864 | 'stroke-width': config.topo.linkInWidth |
| 865 | }) | 865 | }) |
| 866 | + .classed('inactive', function(d) { return !d.online; }) | ||
| 866 | .transition().duration(1000) | 867 | .transition().duration(1000) |
| 867 | .attr({ | 868 | .attr({ |
| 868 | 'stroke-width': function (d) { return linkScale(d.linkWidth); }, | 869 | 'stroke-width': function (d) { return linkScale(d.linkWidth); }, |
| ... | @@ -1076,6 +1077,7 @@ | ... | @@ -1076,6 +1077,7 @@ |
| 1076 | 1077 | ||
| 1077 | function updateLinkState(linkData) { | 1078 | function updateLinkState(linkData) { |
| 1078 | updateLinkWidth(linkData); | 1079 | updateLinkWidth(linkData); |
| 1080 | + linkData.el.classed('inactive', !linkData.online); | ||
| 1079 | // TODO: review what else might need to be updated | 1081 | // TODO: review what else might need to be updated |
| 1080 | // update label, if showing | 1082 | // update label, if showing |
| 1081 | } | 1083 | } | ... | ... |
-
Please register or login to post a comment