Add an empty topology at initialization so we can never have a null topology
Change-Id: I07921583e107895aeeb627f7d61920fed800e77c
Showing
1 changed file
with
8 additions
and
1 deletions
| ... | @@ -17,6 +17,7 @@ package org.onlab.onos.store.topology.impl; | ... | @@ -17,6 +17,7 @@ package org.onlab.onos.store.topology.impl; |
| 17 | 17 | ||
| 18 | import static org.slf4j.LoggerFactory.getLogger; | 18 | import static org.slf4j.LoggerFactory.getLogger; |
| 19 | 19 | ||
| 20 | +import java.util.Collections; | ||
| 20 | import java.util.List; | 21 | import java.util.List; |
| 21 | import java.util.Set; | 22 | import java.util.Set; |
| 22 | 23 | ||
| ... | @@ -26,11 +27,13 @@ import org.apache.felix.scr.annotations.Deactivate; | ... | @@ -26,11 +27,13 @@ import org.apache.felix.scr.annotations.Deactivate; |
| 26 | import org.apache.felix.scr.annotations.Service; | 27 | import org.apache.felix.scr.annotations.Service; |
| 27 | import org.onlab.onos.event.Event; | 28 | import org.onlab.onos.event.Event; |
| 28 | import org.onlab.onos.net.ConnectPoint; | 29 | import org.onlab.onos.net.ConnectPoint; |
| 30 | +import org.onlab.onos.net.Device; | ||
| 29 | import org.onlab.onos.net.DeviceId; | 31 | import org.onlab.onos.net.DeviceId; |
| 30 | import org.onlab.onos.net.Link; | 32 | import org.onlab.onos.net.Link; |
| 31 | import org.onlab.onos.net.Path; | 33 | import org.onlab.onos.net.Path; |
| 32 | import org.onlab.onos.net.provider.ProviderId; | 34 | import org.onlab.onos.net.provider.ProviderId; |
| 33 | import org.onlab.onos.net.topology.ClusterId; | 35 | import org.onlab.onos.net.topology.ClusterId; |
| 36 | +import org.onlab.onos.net.topology.DefaultGraphDescription; | ||
| 34 | import org.onlab.onos.net.topology.GraphDescription; | 37 | import org.onlab.onos.net.topology.GraphDescription; |
| 35 | import org.onlab.onos.net.topology.LinkWeight; | 38 | import org.onlab.onos.net.topology.LinkWeight; |
| 36 | import org.onlab.onos.net.topology.Topology; | 39 | import org.onlab.onos.net.topology.Topology; |
| ... | @@ -55,7 +58,11 @@ implements TopologyStore { | ... | @@ -55,7 +58,11 @@ implements TopologyStore { |
| 55 | 58 | ||
| 56 | private final Logger log = getLogger(getClass()); | 59 | private final Logger log = getLogger(getClass()); |
| 57 | 60 | ||
| 58 | - private volatile DefaultTopology current; | 61 | + private volatile DefaultTopology current = |
| 62 | + new DefaultTopology(ProviderId.NONE, | ||
| 63 | + new DefaultGraphDescription(0L, | ||
| 64 | + Collections.<Device>emptyList(), | ||
| 65 | + Collections.<Link>emptyList())); | ||
| 59 | 66 | ||
| 60 | @Activate | 67 | @Activate |
| 61 | public void activate() { | 68 | public void activate() { | ... | ... |
-
Please register or login to post a comment