Fixing optical link state issues; a few still remain.

Change-Id: I126f89384adbe5272bdaf4eb0e3b456984768a98
diff --git a/apps/optical/src/main/java/org/onlab/onos/optical/OpticalLinkProvider.java b/apps/optical/src/main/java/org/onlab/onos/optical/OpticalLinkProvider.java
new file mode 100644
index 0000000..0f5236d
--- /dev/null
+++ b/apps/optical/src/main/java/org/onlab/onos/optical/OpticalLinkProvider.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2014 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onlab.onos.optical;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.onos.net.Device;
+import org.onlab.onos.net.Link;
+import org.onlab.onos.net.device.DeviceEvent;
+import org.onlab.onos.net.device.DeviceListener;
+import org.onlab.onos.net.device.DeviceService;
+import org.onlab.onos.net.link.DefaultLinkDescription;
+import org.onlab.onos.net.link.LinkDescription;
+import org.onlab.onos.net.link.LinkEvent;
+import org.onlab.onos.net.link.LinkListener;
+import org.onlab.onos.net.link.LinkProvider;
+import org.onlab.onos.net.link.LinkProviderRegistry;
+import org.onlab.onos.net.link.LinkProviderService;
+import org.onlab.onos.net.link.LinkService;
+import org.onlab.onos.net.provider.AbstractProvider;
+import org.onlab.onos.net.provider.ProviderId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.onlab.onos.net.Link.Type.OPTICAL;
+
+/**
+ * Ancillary provider to activate/deactivate optical links as their respective
+ * devices go online or offline.
+ */
+@Component(immediate = true)
+public class OpticalLinkProvider extends AbstractProvider implements LinkProvider {
+
+    private static final Logger log = LoggerFactory.getLogger(OpticalLinkProvider.class);
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkProviderRegistry registry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected DeviceService deviceService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected LinkService linkService;
+
+    private LinkProviderService providerService;
+    private DeviceListener deviceListener = new InternalDeviceListener();
+    private LinkListener linkListener = new InternalLinkListener();
+
+    public OpticalLinkProvider() {
+        super(new ProviderId("optical", "org.onlab.onos.optical"));
+    }
+
+    @Activate
+    protected void activate() {
+        deviceService.addListener(deviceListener);
+        linkService.addListener(linkListener);
+        providerService = registry.register(this);
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        deviceService.removeListener(deviceListener);
+        linkService.removeListener(linkListener);
+        registry.unregister(this);
+        log.info("Stopped");
+    }
+
+    //Listens to device events and processes their links.
+    private class InternalDeviceListener implements DeviceListener {
+        @Override
+        public void event(DeviceEvent event) {
+            DeviceEvent.Type type = event.type();
+            Device device = event.subject();
+            if (type == DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED ||
+                    type == DeviceEvent.Type.DEVICE_ADDED ||
+                    type == DeviceEvent.Type.DEVICE_UPDATED) {
+                processLinks(device);
+            }
+        }
+    }
+
+    //Listens to link events and processes the link additions.
+    private class InternalLinkListener implements LinkListener {
+        @Override
+        public void event(LinkEvent event) {
+            if (event.type() == LinkEvent.Type.LINK_ADDED) {
+                Link link = event.subject();
+                if (link.providerId().scheme().equals("cfg")) {
+                    processLink(event.subject());
+                }
+            }
+        }
+    }
+
+    private void processLinks(Device device) {
+        for (Link link : linkService.getDeviceLinks(device.id())) {
+            if (link.isDurable() && link.type() == OPTICAL) {
+                processLink(link);
+            }
+        }
+    }
+
+    private void processLink(Link link) {
+        boolean active = deviceService.isAvailable(link.src().deviceId()) &&
+                deviceService.isAvailable(link.dst().deviceId());
+        LinkDescription desc = new DefaultLinkDescription(link.src(), link.dst(), OPTICAL);
+        if (active) {
+            providerService.linkDetected(desc);
+        } else {
+            providerService.linkVanished(desc);
+        }
+    }
+}
diff --git a/apps/optical/src/main/java/org/onlab/onos/optical/cfg/OpticalConfigProvider.java b/apps/optical/src/main/java/org/onlab/onos/optical/cfg/OpticalConfigProvider.java
index c73f9be..fd9def1 100644
--- a/apps/optical/src/main/java/org/onlab/onos/optical/cfg/OpticalConfigProvider.java
+++ b/apps/optical/src/main/java/org/onlab/onos/optical/cfg/OpticalConfigProvider.java
@@ -15,20 +15,6 @@
  */
 package org.onlab.onos.optical.cfg;
 
-import static org.onlab.onos.net.DeviceId.deviceId;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.codehaus.jackson.JsonNode;
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.annotate.JsonIgnoreProperties;
@@ -56,6 +42,16 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.onlab.onos.net.DeviceId.deviceId;
+
 /**
  * OpticalConfigProvider emulates the SB network provider for optical switches,
  * optical links and any other state that needs to be configured for correct network
@@ -75,10 +71,10 @@
             "config/demo-3-roadm-2-ps.json";
     private String configFileName = DEFAULT_CONFIG_FILE;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+//    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected LinkProviderRegistry linkProviderRegistry;
 
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+//    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected DeviceProviderRegistry deviceProviderRegistry;
 
     private static final String OPTICAL_ANNOTATION = "optical.";
@@ -101,7 +97,7 @@
                 ".opticalConfig"));
     }
 
-    @Activate
+//    @Activate
     protected void activate() {
         linkProviderService = linkProviderRegistry.register(this);
         deviceProviderService = deviceProviderRegistry.register(this);
@@ -113,7 +109,7 @@
         publishOpticalConfig();
     }
 
-    @Deactivate
+//    @Deactivate
     protected void deactivate() {
         linkProviderRegistry.unregister(this);
         linkProviderService = null;
diff --git a/core/api/src/main/java/org/onlab/onos/net/AnnotationKeys.java b/core/api/src/main/java/org/onlab/onos/net/AnnotationKeys.java
index de18fc0..94c4a5f 100644
--- a/core/api/src/main/java/org/onlab/onos/net/AnnotationKeys.java
+++ b/core/api/src/main/java/org/onlab/onos/net/AnnotationKeys.java
@@ -30,12 +30,6 @@
     public static final String DURABLE = "durable";
 
     /**
-     * Annotation key for active/inactive links. Links are implicitly
-     * considered active unless explicitly marked otherwise.
-     */
-    public static final String INACTIVE = "inactive";
-
-    /**
      * Annotation key for latency.
      */
     public static final String LATENCY = "latency";
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/link/impl/GossipLinkStore.java b/core/store/dist/src/main/java/org/onlab/onos/store/link/impl/GossipLinkStore.java
index d496ebe1..d4b0916 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/link/impl/GossipLinkStore.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/link/impl/GossipLinkStore.java
@@ -531,9 +531,7 @@
         }
 
         boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true");
-        boolean isActive = !Objects.equals(annotations.value(AnnotationKeys.INACTIVE), "true");
-        return new DefaultLink(baseProviderId, src, dst, type,
-                               isActive ? ACTIVE : INACTIVE, isDurable, annotations);
+        return new DefaultLink(baseProviderId, src, dst, type, ACTIVE, isDurable, annotations);
     }
 
     private Map<ProviderId, Timestamped<LinkDescription>> getOrCreateLinkDescriptions(LinkKey key) {
diff --git a/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleLinkStore.java b/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleLinkStore.java
index a383167..5dec00c 100644
--- a/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleLinkStore.java
+++ b/core/store/trivial/src/main/java/org/onlab/onos/store/trivial/impl/SimpleLinkStore.java
@@ -314,9 +314,7 @@
         }
 
         boolean isDurable = Objects.equals(annotations.value(AnnotationKeys.DURABLE), "true");
-        boolean isActive = !Objects.equals(annotations.value(AnnotationKeys.INACTIVE), "true");
-        return new DefaultLink(primary, src, dst, type,
-                               isActive ? ACTIVE : INACTIVE, isDurable, annotations);
+        return new DefaultLink(primary, src, dst, type, ACTIVE, isDurable, annotations);
     }
 
     private Map<ProviderId, LinkDescription> getOrCreateLinkDescriptions(LinkKey key) {
diff --git a/tools/test/topos/att-mpls.json b/tools/test/topos/att-mpls.json
index 8bae0e2..39cf751 100644
--- a/tools/test/topos/att-mpls.json
+++ b/tools/test/topos/att-mpls.json
@@ -9,7 +9,7 @@
     { "alias":  "s7", "uri": "of:0000000000000007", "mac": "000000000007", "annotations": { "name": "WASH", "latitude": 38.906696, "longitude": -77.035509  }, "type": "SWITCH" },
     { "alias":  "s8", "uri": "of:0000000000000008", "mac": "000000000008", "annotations": { "name": "NSVL", "latitude": 36.166410, "longitude": -86.787305  }, "type": "SWITCH" },
     { "alias":  "s9", "uri": "of:0000000000000009", "mac": "000000000009", "annotations": { "name": "STLS", "latitude": 38.626418, "longitude": -90.198143  }, "type": "SWITCH" },
-    { "alias": "s10", "uri": "of:000000000000000a", "mac": "00000000000a", "annotations": { "name": "NWOR", "Xlatitude": 0.0,      "Xlongitude": 0.00       }, "type": "SWITCH" },
+    { "alias": "s10", "uri": "of:000000000000000a", "mac": "00000000000a", "annotations": { "name": "NWOR", "latitude": 29.951475, "longitude": -90.078434  }, "type": "SWITCH" },
     { "alias": "s11", "uri": "of:000000000000000b", "mac": "00000000000b", "annotations": { "name": "HSTN", "latitude": 29.763249, "longitude": -95.368332  }, "type": "SWITCH" },
     { "alias": "s12", "uri": "of:000000000000000c", "mac": "00000000000c", "annotations": { "name": "SNAN", "latitude": 29.424331, "longitude": -98.491745  }, "type": "SWITCH" },
     { "alias": "s13", "uri": "of:000000000000000d", "mac": "00000000000d", "annotations": { "name": "DLLS", "latitude": 32.777665, "longitude": -96.802064  }, "type": "SWITCH" },
@@ -37,7 +37,7 @@
     { "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  } },
     { "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  } },
     { "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  } },
-    { "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       } },
+    { "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  } },
     { "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  } },
     { "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  } },
     { "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  } },
diff --git a/tools/test/topos/att-mpls.py b/tools/test/topos/att-mpls.py
index 3620620..ed77941 100644
--- a/tools/test/topos/att-mpls.py
+++ b/tools/test/topos/att-mpls.py
@@ -32,7 +32,7 @@
         WASH = self.addSwitch( 's7' )  // 38.906696, -77.035509
         NSVL = self.addSwitch( 's8' )  // 36.166410, -86.787305
         STLS = self.addSwitch( 's9' )  // 38.626418, -90.198143
-        NWOR = self.addSwitch( 's10' ) //
+        NWOR = self.addSwitch( 's10' ) // 29.951475, -90.078434
         HSTN = self.addSwitch( 's11' ) // 29.763249, -95.368332
         SNAN = self.addSwitch( 's12' ) // 29.424331, -98.491745
         DLLS = self.addSwitch( 's13' ) // 32.777665, -96.802064
diff --git a/tools/test/topos/oe-nonlinear-10.json b/tools/test/topos/oe-nonlinear-10.json
index 11a8784..9bf291e 100644
--- a/tools/test/topos/oe-nonlinear-10.json
+++ b/tools/test/topos/oe-nonlinear-10.json
@@ -124,26 +124,26 @@
     ],
 
     "links" : [
-        { "src": "of:0000ffffffffff01/50", "dst": "of:0000ffffffffff02/30","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 48, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff02/50", "dst": "of:0000ffffffffff03/30","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 493, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff03/50", "dst": "of:0000ffffffffff04/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 171, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff01/20", "dst": "of:0000ffffffffff05/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2555, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff02/20", "dst": "of:0000ffffffffff05/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2539, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff03/20", "dst": "of:0000ffffffffff06/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1979, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff04/20", "dst": "of:0000ffffffffff06/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1867, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff05/30", "dst": "of:0000ffffffffff06/40","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1378, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff05/40", "dst": "of:0000ffffffffff07/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2200, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff06/30", "dst": "of:0000ffffffffff08/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1918, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff07/20", "dst": "of:0000ffffffffff08/30", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 3625, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff07/30", "dst": "of:0000ffffffffff09/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 3880, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff08/20", "dst": "of:0000ffffffffff0A/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 838, "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffffff09/20", "dst": "of:0000ffffffffff0A/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1245, "durable": "true", "inactive": "true" } },
+        { "src": "of:0000ffffffffff01/50", "dst": "of:0000ffffffffff02/30","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 48, "durable": "true" } },
+        { "src": "of:0000ffffffffff02/50", "dst": "of:0000ffffffffff03/30","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 493, "durable": "true" } },
+        { "src": "of:0000ffffffffff03/50", "dst": "of:0000ffffffffff04/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 171, "durable": "true" } },
+        { "src": "of:0000ffffffffff01/20", "dst": "of:0000ffffffffff05/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2555, "durable": "true" } },
+        { "src": "of:0000ffffffffff02/20", "dst": "of:0000ffffffffff05/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2539, "durable": "true" } },
+        { "src": "of:0000ffffffffff03/20", "dst": "of:0000ffffffffff06/50","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1979, "durable": "true" } },
+        { "src": "of:0000ffffffffff04/20", "dst": "of:0000ffffffffff06/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1867, "durable": "true" } },
+        { "src": "of:0000ffffffffff05/30", "dst": "of:0000ffffffffff06/40","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1378, "durable": "true" } },
+        { "src": "of:0000ffffffffff05/40", "dst": "of:0000ffffffffff07/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 2200, "durable": "true" } },
+        { "src": "of:0000ffffffffff06/30", "dst": "of:0000ffffffffff08/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1918, "durable": "true" } },
+        { "src": "of:0000ffffffffff07/20", "dst": "of:0000ffffffffff08/30", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 3625, "durable": "true" } },
+        { "src": "of:0000ffffffffff07/30", "dst": "of:0000ffffffffff09/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 3880, "durable": "true" } },
+        { "src": "of:0000ffffffffff08/20", "dst": "of:0000ffffffffff0A/50", "type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 838, "durable": "true" } },
+        { "src": "of:0000ffffffffff09/20", "dst": "of:0000ffffffffff0A/20","type": "OPTICAL", "annotations": { "optical.waves": 80, "optical.type": "WDM", "optical.kms": 1245, "durable": "true" } },
 
-        { "src": "of:0000ffffffff0001/2", "dst": "of:0000ffffffffff01/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffff0002/2", "dst": "of:0000ffffffffff04/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffff0003/2", "dst": "of:0000ffffffffff06/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffff0004/2", "dst": "of:0000ffffffffff07/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffff0005/2", "dst": "of:0000ffffffffff09/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } },
-        { "src": "of:0000ffffffff0006/2", "dst": "of:0000ffffffffff0A/10",  "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true", "inactive": "true" } }
+        { "src": "of:0000ffffffff0001/2", "dst": "of:0000ffffffffff01/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } },
+        { "src": "of:0000ffffffff0002/2", "dst": "of:0000ffffffffff04/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } },
+        { "src": "of:0000ffffffff0003/2", "dst": "of:0000ffffffffff06/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } },
+        { "src": "of:0000ffffffff0004/2", "dst": "of:0000ffffffffff07/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } },
+        { "src": "of:0000ffffffff0005/2", "dst": "of:0000ffffffffff09/10", "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } },
+        { "src": "of:0000ffffffff0006/2", "dst": "of:0000ffffffffff0A/10",  "type": "OPTICAL", "annotations": { "bandwidth": 100000, "optical.type": "cross-connect", "durable": "true" } }
     ]
 }
diff --git a/web/gui/src/main/webapp/topo2.js b/web/gui/src/main/webapp/topo2.js
index f2afe5f..37e098e 100644
--- a/web/gui/src/main/webapp/topo2.js
+++ b/web/gui/src/main/webapp/topo2.js
@@ -825,7 +825,7 @@
         // merge in remaining data
         $.extend(lnk, link, {
             class: 'link',
-            svgClass: (type ? 'link ' + type : 'link') + ' ' + (link.online ? 'active' : 'inactive')
+            svgClass: (type ? 'link ' + type : 'link')
         });
         return lnk;
     }
@@ -863,6 +863,7 @@
                 stroke: config.topo.linkInColor,
                 'stroke-width': config.topo.linkInWidth
             })
+            .classed('inactive', function(d) { return !d.online; })
             .transition().duration(1000)
             .attr({
                 'stroke-width': function (d) { return linkScale(d.linkWidth); },
@@ -1076,6 +1077,7 @@
 
     function updateLinkState(linkData) {
         updateLinkWidth(linkData);
+        linkData.el.classed('inactive', !linkData.online);
         // TODO: review what else might need to be updated
         //  update label, if showing
     }