Fixing auto-layout to properly classify disjoint/orphaned devices.
Change-Id: Ic1d7e2828c71f944799d7f495a48ddd687e186d0
diff --git a/apps/layout/src/main/java/org/onosproject/layout/AccessNetworkLayout.java b/apps/layout/src/main/java/org/onosproject/layout/AccessNetworkLayout.java
index 105840e..75fb3d5 100644
--- a/apps/layout/src/main/java/org/onosproject/layout/AccessNetworkLayout.java
+++ b/apps/layout/src/main/java/org/onosproject/layout/AccessNetworkLayout.java
@@ -60,8 +60,10 @@
if (!super.classify(device)) {
String role;
- // Does the device have any hosts attached? If not, it's a spine
- if (hostService.getConnectedHosts(device.id()).isEmpty()) {
+ // Does the device have any links and any hosts attached?
+ // If it has links, but no hosts, it's a spine
+ if (!linkService.getDeviceLinks(device.id()).isEmpty() &&
+ hostService.getConnectedHosts(device.id()).isEmpty()) {
// Does the device have any aggregate links to other devices?
Multiset<DeviceId> destinations = HashMultiset.create();
linkService.getDeviceEgressLinks(device.id()).stream()