[VOL-2442] Fix for Core panic
The logical device agent was receiving logical ports creation
while the logical device was not ready - it was waiting for
switch capability data from the OLT device. This was causing
a panic. The fix prevents logical port creation to be
trigerred when the logical device is not ready. Once the
logical device is ready it will go over the ports data from the
OLT device and automatically create the logical ports.
Change-Id: Iad62302eda80fa158e59852810ad272a8aeedb7b
diff --git a/rw_core/graph/device_graph.go b/rw_core/graph/device_graph.go
index 4c89134..02ad35d 100644
--- a/rw_core/graph/device_graph.go
+++ b/rw_core/graph/device_graph.go
@@ -121,7 +121,7 @@
//ComputeRoutes creates a device graph from the logical ports and then calculates all the routes
//between the logical ports. This will clear up the graph and routes if there were any.
func (dg *DeviceGraph) ComputeRoutes(lps []*voltha.LogicalPort) {
- if dg == nil {
+ if dg == nil || len(lps) == 0 {
return
}
dg.graphBuildLock.Lock()