Skip to content
Snippets Groups Projects
Commit 27919663 authored by abat's avatar abat
Browse files

Merge into master from pull request #295:

Clear out oldAPs whenever updateAttachmentPoint() is called as it is triggered due to topologyChange and device reclassification. (https://github.com/floodlight/floodlight/pull/295)
parents f2e3c40e 3ae546df
No related branches found
No related tags found
No related merge requests found
...@@ -291,7 +291,6 @@ entity.getLastSeenTimestamp().getTime()); ...@@ -291,7 +291,6 @@ entity.getLastSeenTimestamp().getTime());
*/ */
protected boolean updateAttachmentPoint() { protected boolean updateAttachmentPoint() {
boolean moved = false; boolean moved = false;
boolean oldFlag = false;
List<AttachmentPoint> oldAPList = new ArrayList<AttachmentPoint>(); List<AttachmentPoint> oldAPList = new ArrayList<AttachmentPoint>();
if (oldAPs != null) oldAPList.addAll(oldAPs); if (oldAPs != null) oldAPList.addAll(oldAPs);
...@@ -300,15 +299,9 @@ entity.getLastSeenTimestamp().getTime()); ...@@ -300,15 +299,9 @@ entity.getLastSeenTimestamp().getTime());
if (attachmentPoints != null) apList.addAll(attachmentPoints); if (attachmentPoints != null) apList.addAll(attachmentPoints);
Map<Long, AttachmentPoint> newMap = getAPMap(apList); Map<Long, AttachmentPoint> newMap = getAPMap(apList);
if (newMap == null) { if (newMap == null || newMap.size() != apList.size()) {
moved = true; moved = true;
} else if (newMap.size() != apList.size()) {
apList.removeAll(newMap.values());
oldAPList.addAll(apList);
moved = true;
oldFlag = true;
} }
oldFlag = oldFlag || removeExpiredAttachmentPoints(oldAPList);
// Prepare the new attachment point list. // Prepare the new attachment point list.
if (moved) { if (moved) {
...@@ -318,10 +311,8 @@ entity.getLastSeenTimestamp().getTime()); ...@@ -318,10 +311,8 @@ entity.getLastSeenTimestamp().getTime());
this.attachmentPoints = newAPList; this.attachmentPoints = newAPList;
} }
// update the oldAPs if needed. // Set the oldAPs to null.
if (oldFlag) { this.oldAPs = null;
this.oldAPs = oldAPList;
}
return moved; return moved;
} }
...@@ -525,10 +516,15 @@ entity.getLastSeenTimestamp().getTime()); ...@@ -525,10 +516,15 @@ entity.getLastSeenTimestamp().getTime());
if (!includeError) if (!includeError)
return sp.toArray(new SwitchPort[sp.size()]); return sp.toArray(new SwitchPort[sp.size()]);
List<AttachmentPoint> oldAPList; List<AttachmentPoint> oldAPList;
oldAPList = new ArrayList<AttachmentPoint>(); oldAPList = new ArrayList<AttachmentPoint>();
if (oldAPs != null) oldAPList.addAll(oldAPs); if (oldAPs != null) oldAPList.addAll(oldAPs);
if (removeExpiredAttachmentPoints(oldAPList))
this.oldAPs = oldAPList;
List<AttachmentPoint> dupList; List<AttachmentPoint> dupList;
dupList = this.getDuplicateAttachmentPoints(oldAPList, apMap); dupList = this.getDuplicateAttachmentPoints(oldAPList, apMap);
if (dupList != null) { if (dupList != null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment