diff --git a/src/main/java/net/floodlightcontroller/debugevent/CircularBuffer.java b/src/main/java/net/floodlightcontroller/debugevent/CircularBuffer.java index 0f6a3a209ab6612783a2217a9019074a90affd88..879ec71b489bda6d7f31734a124c631dcc7616b7 100644 --- a/src/main/java/net/floodlightcontroller/debugevent/CircularBuffer.java +++ b/src/main/java/net/floodlightcontroller/debugevent/CircularBuffer.java @@ -70,9 +70,12 @@ public class CircularBuffer<T> implements Iterable<T>{ } /** - * ArrayDeques are not threadsafe and thus must be externally synchronized. - * For concurrent iteration we call a copy constructor on the ArrayDeque and - * return the iterator of the newly created ArrayDeque. + * Returns an iterator over the elements in the circular buffer in proper sequence. + * The elements will be returned in order from oldest to most-recent. + * The returned Iterator is a "weakly consistent" iterator that will never + * throw ConcurrentModificationException, and guarantees to traverse elements + * as they existed upon construction of the iterator, and may (but is not + * guaranteed to) reflect any modifications subsequent to construction. */ @Override public Iterator<T> iterator() { @@ -82,4 +85,11 @@ public class CircularBuffer<T> implements Iterable<T>{ public int size() { return buffer.size(); } + + /** + * Atomically removes all elements in the circular buffer + */ + public void clear() { + buffer.clear(); + } } diff --git a/src/main/java/net/floodlightcontroller/debugevent/DebugEvent.java b/src/main/java/net/floodlightcontroller/debugevent/DebugEvent.java index 1a43b970c13c0e7e3e8feea2dadf9eaa0c652787..0201bd3c15199b36d6a677f72a148e1d4f81d682 100644 --- a/src/main/java/net/floodlightcontroller/debugevent/DebugEvent.java +++ b/src/main/java/net/floodlightcontroller/debugevent/DebugEvent.java @@ -39,15 +39,8 @@ public class DebugEvent implements IFloodlightModule, IDebugEventService { protected int eventIdCounter = 0; protected Object eventIdLock = new Object(); - /** - * A limit on the maximum number of event types that can be created - */ - protected static final int MAX_EVENTS = 2000; - private static final long MIN_FLUSH_DELAY = 100; //ms - private static final int PCT_LOCAL_CAP = 10; // % of global capacity - private static final int MIN_LOCAL_CAPACITY = 10; //elements /** @@ -62,8 +55,8 @@ public class DebugEvent implements IFloodlightModule, IDebugEventService { String eventDesc; String eventName; String moduleName; - String moduleEventName; boolean flushNow; + String moduleEventName; public EventInfo(int eventId, boolean enabled, int bufferCapacity, EventType etype, String formatStr, String eventDesc, @@ -76,8 +69,8 @@ public class DebugEvent implements IFloodlightModule, IDebugEventService { this.eventDesc = eventDesc; this.eventName = eventName; this.moduleName = moduleName; - this.moduleEventName = moduleName + "-" + eventName; this.flushNow = flushNow; + this.moduleEventName = moduleName + "/" + eventName; } public int getEventId() { return eventId; } @@ -89,7 +82,6 @@ public class DebugEvent implements IFloodlightModule, IDebugEventService { public String getEventName() { return eventName; } public String getModuleName() { return moduleName; } public String getModuleEventName() { return moduleEventName; } - } //****************** @@ -324,50 +316,107 @@ public class DebugEvent implements IFloodlightModule, IDebugEventService { } @Override - public boolean containsMEName(String moduleEventName) { - String[] temp = moduleEventName.split("-"); - if (temp.length != 2) return false; - if (!moduleEvents.containsKey(temp[0])) return false; - if (moduleEvents.get(temp[0]).containsKey(temp[1])) return true; + public boolean containsModuleEventName(String moduleName, String eventName) { + if (!moduleEvents.containsKey(moduleName)) return false; + if (moduleEvents.get(moduleName).containsKey(eventName)) return true; return false; } @Override - public boolean containsModName(String moduleName) { + public boolean containsModuleName(String moduleName) { return moduleEvents.containsKey(moduleName); } @Override public List<DebugEventInfo> getAllEventHistory() { - // TODO Auto-generated method stub - return null; + ArrayList<DebugEventInfo> moduleEventList = new ArrayList<DebugEventInfo>(); + for (Map<String, Integer> modev : moduleEvents.values()) { + for (int eventId : modev.values()) { + DebugEventHistory de = allEvents[eventId]; + if (de != null) { + ArrayList<String> ret = new ArrayList<String>(); + for (Event e : de.eventBuffer) { + ret.add(e.toString(de.einfo.formatStr, de.einfo.moduleEventName)); + } + moduleEventList.add(new DebugEventInfo(de.einfo, ret)); + } + } + } + return moduleEventList; } @Override public List<DebugEventInfo> getModuleEventHistory(String moduleName) { - // TODO Auto-generated method stub - return null; + if (!moduleEvents.containsKey(moduleName)) return null; + ArrayList<DebugEventInfo> moduleEventList = new ArrayList<DebugEventInfo>(); + for (int eventId : moduleEvents.get(moduleName).values()) { + DebugEventHistory de = allEvents[eventId]; + if (de != null) { + ArrayList<String> ret = new ArrayList<String>(); + for (Event e : de.eventBuffer) { + ret.add(e.toString(de.einfo.formatStr, de.einfo.moduleEventName)); + } + moduleEventList.add(new DebugEventInfo(de.einfo, ret)); + } + } + return moduleEventList; } @Override - public DebugEventInfo getSingleEventHistory(String moduleEventName) { - String[] temp = moduleEventName.split("-"); - if (temp.length != 2) return null; - if (!moduleEvents.containsKey(temp[0])) return null; - Integer eventId = moduleEvents.get(temp[0]).get(temp[1]); + public DebugEventInfo getSingleEventHistory(String moduleName, String eventName) { + if (!moduleEvents.containsKey(moduleName)) return null; + Integer eventId = moduleEvents.get(moduleName).get(eventName); if (eventId == null) return null; DebugEventHistory de = allEvents[eventId]; if (de != null) { ArrayList<String> ret = new ArrayList<String>(); for (Event e : de.eventBuffer) { ret.add(e.toString(de.einfo.formatStr, de.einfo.moduleEventName)); - //ret.add(e.toString()); } return new DebugEventInfo(de.einfo, ret); } return null; } + @Override + public void resetAllEvents() { + for (Map<String, Integer> eventMap : moduleEvents.values()) { + for (Integer evId : eventMap.values()) { + allEvents[evId].eventBuffer.clear(); + } + } + } + + @Override + public void resetAllModuleEvents(String moduleName) { + if (!moduleEvents.containsKey(moduleName)) return; + Map<String, Integer> modEvents = moduleEvents.get(moduleName); + for (Integer evId : modEvents.values()) { + allEvents[evId].eventBuffer.clear(); + } + } + + @Override + public void resetSingleEvent(String moduleName, String eventName) { + if (!moduleEvents.containsKey(moduleName)) return; + Integer eventId = moduleEvents.get(moduleName).get(eventName); + if (eventId == null) return; + DebugEventHistory de = allEvents[eventId]; + if (de != null) { + de.eventBuffer.clear(); + } + } + + @Override + public ArrayList<EventInfo> getEventList() { + ArrayList<EventInfo> eil = new ArrayList<EventInfo>(); + for (Map<String, Integer> eventMap : moduleEvents.values()) { + for (Integer evId : eventMap.values()) { + eil.add(allEvents[evId].einfo); + } + } + return eil; + } protected void printEvents() { for (int eventId : currentEvents) { diff --git a/src/main/java/net/floodlightcontroller/debugevent/IDebugEventService.java b/src/main/java/net/floodlightcontroller/debugevent/IDebugEventService.java index 72f1d4c9cb02e9e710d0058662beb438c025faed..c98d3dcb78b9f529c930e709b0a071ec7fdfefa5 100644 --- a/src/main/java/net/floodlightcontroller/debugevent/IDebugEventService.java +++ b/src/main/java/net/floodlightcontroller/debugevent/IDebugEventService.java @@ -17,6 +17,11 @@ public interface IDebugEventService extends IFloodlightService { LOG_ON_DEMAND } + /** + * A limit on the maximum number of event types that can be created + */ + public static final int MAX_EVENTS = 2000; + /** * Public class for information returned in response to rest API calls. */ @@ -54,7 +59,7 @@ public interface IDebugEventService extends IFloodlightService { * in the packet processing pipeline (eg. switch * connect/disconnect). * @param eventDescription A descriptive string describing event. - * @param et EventType for this event. + * @param eventType EventType for this event. * @param bufferCapacity Number of events to store for this event in a circular * buffer. Older events will be discarded once the * buffer is full. @@ -74,7 +79,7 @@ public interface IDebugEventService extends IFloodlightService { * @throws MaxEventsRegistered */ public int registerEvent(String moduleName, String eventName, boolean flushNow, - String eventDescription, EventType et, + String eventDescription, EventType eventType, int bufferCapacity, String formatStr, Object[] params) throws MaxEventsRegistered; @@ -106,37 +111,67 @@ public interface IDebugEventService extends IFloodlightService { public void flushEvents(); /** - * Determine if moduleEventName is a registered event. moduleEventName must - * be of the type {moduleName-eventName} eg. linkdiscovery-linkevent + * Determine if eventName is a registered event for a given moduleName */ - public boolean containsMEName(String moduleEventName); + public boolean containsModuleEventName(String moduleName, String eventName); /** - * Determine if any events have been registerd by a module of name moduleName + * Determine if any events have been registered for module of name moduleName */ - public boolean containsModName(String moduleName); + public boolean containsModuleName(String moduleName); /** + * Get event history for all events. This call can be expensive as it + * formats the event histories for all events. * - * @return + * @return a list of all event histories or an empty list if no events have + * been registered */ public List<DebugEventInfo> getAllEventHistory(); /** + * Get event history for all events registered for a given moduleName * - * @param moduleName - * @return + * @return a list of all event histories for all events registered for the + * the module or null if there are no events for this module */ public List<DebugEventInfo> getModuleEventHistory(String moduleName); /** - * Get event history for an event of name moduleEventName. moduleEventName - * must be of the type {moduleName-eventName} eg. linkdiscovery-linkevent + * Get event history for a single event * - * @param moduleEventName + * @param moduleName registered module name + * @param eventName registered event name for moduleName * @return DebugEventInfo for that event, or null if the moduleEventName * does not correspond to a registered event. */ - public DebugEventInfo getSingleEventHistory(String moduleEventName); + public DebugEventInfo getSingleEventHistory(String moduleName, String eventName); + + /** + * Wipe out all event history for all registered events + */ + public void resetAllEvents(); + + /** + * Wipe out all event history for all events registered for a specific module + * + * @param moduleName registered module name + */ + public void resetAllModuleEvents(String moduleName); + + /** + * Wipe out event history for a single event + * @param moduleName registered module name + * @param eventName registered event name for moduleName + */ + public void resetSingleEvent(String moduleName, String eventName); + + /** + * Retrieve information on all registered events + * + * @return the arraylist of event-info or an empty list if no events are registered + */ + public ArrayList<EventInfo> getEventList(); + } diff --git a/src/main/java/net/floodlightcontroller/debugevent/NullDebugEvent.java b/src/main/java/net/floodlightcontroller/debugevent/NullDebugEvent.java index d404d6a62b48925cb358b7d9ccc7888d3d79a320..6f49892c065cba8a95945cc5b973d98dafbe5404 100644 --- a/src/main/java/net/floodlightcontroller/debugevent/NullDebugEvent.java +++ b/src/main/java/net/floodlightcontroller/debugevent/NullDebugEvent.java @@ -10,6 +10,7 @@ import net.floodlightcontroller.core.module.FloodlightModuleContext; import net.floodlightcontroller.core.module.FloodlightModuleException; import net.floodlightcontroller.core.module.IFloodlightModule; import net.floodlightcontroller.core.module.IFloodlightService; +import net.floodlightcontroller.debugevent.DebugEvent.EventInfo; public class NullDebugEvent implements IFloodlightModule, IDebugEventService { @@ -70,13 +71,13 @@ public class NullDebugEvent implements IFloodlightModule, IDebugEventService { } @Override - public boolean containsMEName(String param) { + public boolean containsModuleEventName(String moduleName, String eventName) { // TODO Auto-generated method stub return false; } @Override - public boolean containsModName(String param) { + public boolean containsModuleName(String moduleName) { // TODO Auto-generated method stub return false; } @@ -94,7 +95,31 @@ public class NullDebugEvent implements IFloodlightModule, IDebugEventService { } @Override - public DebugEventInfo getSingleEventHistory(String param) { + public DebugEventInfo getSingleEventHistory(String moduleName, String eventName) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void resetAllEvents() { + // TODO Auto-generated method stub + + } + + @Override + public void resetAllModuleEvents(String moduleName) { + // TODO Auto-generated method stub + + } + + @Override + public void resetSingleEvent(String moduleName, String eventName) { + // TODO Auto-generated method stub + + } + + @Override + public ArrayList<EventInfo> getEventList() { // TODO Auto-generated method stub return null; } diff --git a/src/main/java/net/floodlightcontroller/debugevent/web/DebugEventResource.java b/src/main/java/net/floodlightcontroller/debugevent/web/DebugEventResource.java index 3fab95487bde0f436e0ff0b5b215bebacccd1f56..5c33ac74d1e7c002022f8d7e0981bfe59db7b272 100644 --- a/src/main/java/net/floodlightcontroller/debugevent/web/DebugEventResource.java +++ b/src/main/java/net/floodlightcontroller/debugevent/web/DebugEventResource.java @@ -5,24 +5,16 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - +import net.floodlightcontroller.debugevent.DebugEvent.EventInfo; import net.floodlightcontroller.debugevent.IDebugEventService.DebugEventInfo; import org.restlet.resource.Get; +import org.restlet.resource.Post; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - /** - * Return the debug event data for the get rest-api call - * - * URI must be in one of the following forms: - * "http://{controller-hostname}:8080/wm/debugevent/{param}/json - * - * where {param} must be one of (no quotes): - * "all" returns value/info on all active events. - * "{moduleName}" returns value/info on all active events for the specified module. - * "{moduleEventName}" returns value/info for specific event if it is active. + * Web interface for Debug Events * * @author Saurav */ @@ -34,17 +26,21 @@ public class DebugEventResource extends DebugEventResourceBase { * The output JSON model that contains the counter information */ public static class DebugEventInfoOutput { - public Map<String, DebugEventInfo> eventMap; - public String error; + public Map<String, DebugEventInfo> eventMap = null; + public List<EventInfo> eventList = null; + public String error = null; - DebugEventInfoOutput() { - eventMap = new HashMap<String, DebugEventInfo>(); - error = null; + DebugEventInfoOutput(boolean getList) { + if (!getList) { + eventMap = new HashMap<String, DebugEventInfo>(); + } } public Map<String, DebugEventInfo> getEventMap() { return eventMap; } - + public List<EventInfo> getEventList() { + return eventList; + } public String getError() { return error; } @@ -56,31 +52,155 @@ public class DebugEventResource extends DebugEventResourceBase { ERROR_BAD_MODULE_EVENT_NAME } + public static class DebugEventPost { + public Boolean reset; + + public Boolean getReset() { + return reset; + } + public void setReset(Boolean reset) { + this.reset = reset; + } + } + + public static class ResetOutput { + String error = null; + + public String getError() { + return error; + } + public void setError(String error) { + this.error = error; + } + } + + /** + * Reset events + * + * If using curl: + * curl -X POST -d {\"reset\":true} -H "Content-Type: application/json" URL + * where URL must be in one of the following forms for resetting registered events: + * "http://{controller-hostname}:8080/wm/debugevent/ + * "http://{controller-hostname}:8080/wm/debugevent/{param1} + * "http://{controller-hostname}:8080/wm/debugevent/{param1}/{param2} + * + * Not giving {param1} will reset all events + * {param1} can be 'all' or the name of a module. The former case will reset + * all events, while the latter will reset all events for the moduleName. + * {param2} must be an eventName for the given moduleName + */ + @Post + public ResetOutput postHandler(DebugEventPost postData) { + ResetOutput output = new ResetOutput(); + String param1 = (String)getRequestAttributes().get("param1"); + String param2 = (String)getRequestAttributes().get("param2"); + + if (postData.getReset() != null && postData.getReset()) { + Option choice = Option.ERROR_BAD_PARAM; + + if (param1 == null) { + param1 = "all"; + choice = Option.ALL; + } else if (param1.equals("all")) { + choice = Option.ALL; + } else if (param2 == null) { + boolean isRegistered = debugEvent.containsModuleName(param1); + if (isRegistered) { + choice = Option.ONE_MODULE; + } else { + choice = Option.ERROR_BAD_MODULE_NAME; + } + } else { + // differentiate between disabled and non-existing events + boolean isRegistered = debugEvent.containsModuleEventName(param1, param2); + if (isRegistered) { + choice = Option.ONE_MODULE_EVENT; + } else { + choice = Option.ERROR_BAD_MODULE_EVENT_NAME; + } + } + + switch (choice) { + case ALL: + debugEvent.resetAllEvents(); + break; + case ONE_MODULE: + debugEvent.resetAllModuleEvents(param1); + break; + case ONE_MODULE_EVENT: + debugEvent.resetSingleEvent(param1, param2); + break; + case ERROR_BAD_MODULE_NAME: + output.error = "Module name has no corresponding registered events"; + break; + case ERROR_BAD_MODULE_EVENT_NAME: + output.error = "Event not registered"; + break; + case ERROR_BAD_PARAM: + output.error = "Bad param"; + } + } + + return output; + + } + + /** + * Return the debug event data for the get rest-api call + * + * URL must be in one of the following forms for retrieving a list of all + * registered events: + * "http://{controller-hostname}:8080/wm/debugevent/ + * + * URL must be in one of the following forms for retrieving event data: + * "http://{controller-hostname}:8080/wm/debugevent/{param1} + * "http://{controller-hostname}:8080/wm/debugevent/{param1}/{param2} + * + * where {param1} must be one of (no quotes): + * null if nothing is given then by default the list + * of all events is returned, not their histories. + * "all" returns value/info on all active events. + * "{moduleName}" returns value/info on events for the specified module + * depending on the value of param2 + * and {param2} must be one of (no quotes): + * "{eventName}" returns value/info for specific event if it is active. + * + * {param2} is optional; in which case the event history for all the events registered + * for that moduleName will be returned. + * + */ @Get("json") public DebugEventInfoOutput handleEventInfoQuery() { - DebugEventInfoOutput output = new DebugEventInfoOutput(); Option choice = Option.ERROR_BAD_PARAM; + DebugEventInfoOutput output; - String param = (String)getRequestAttributes().get("param"); - if (param == null) { - param = "all"; - choice = Option.ALL; - } else if (param.equals("all")) { + String param1 = (String)getRequestAttributes().get("param1"); + String param2 = (String)getRequestAttributes().get("param2"); + + if (param1 == null && param2 == null) { + output = new DebugEventInfoOutput(true); + return listEvents(output); + } + output = new DebugEventInfoOutput(false); + + if (param1 == null && param2 != null) { + choice = Option.ERROR_BAD_PARAM; + } else if (param1.equals("all")) { choice = Option.ALL; - } else if (param.contains("-")) { - // differentiate between disabled and non-existing counters - boolean isRegistered = debugEvent.containsMEName(param); + } else if (param2 == null) { + boolean isRegistered = debugEvent.containsModuleName(param1); if (isRegistered) { - choice = Option.ONE_MODULE_EVENT; + choice = Option.ONE_MODULE; } else { - choice = Option.ERROR_BAD_MODULE_EVENT_NAME; + choice = Option.ERROR_BAD_MODULE_NAME; } } else { - boolean isRegistered = debugEvent.containsModName(param); + // differentiate between disabled and non-existing events + boolean isRegistered = debugEvent.containsModuleEventName(param1, param2); if (isRegistered) { - choice = Option.ONE_MODULE; + choice = Option.ONE_MODULE_EVENT; } else { - choice = Option.ERROR_BAD_MODULE_NAME; + choice = Option.ERROR_BAD_MODULE_EVENT_NAME; } } @@ -89,10 +209,11 @@ public class DebugEventResource extends DebugEventResourceBase { populateEvents(debugEvent.getAllEventHistory(), output); break; case ONE_MODULE: - populateEvents(debugEvent.getModuleEventHistory(param), output); + populateEvents(debugEvent.getModuleEventHistory(param1), output); break; case ONE_MODULE_EVENT: - populateSingleEvent(debugEvent.getSingleEventHistory(param), output); + populateSingleEvent(debugEvent.getSingleEventHistory(param1, param2), + output); break; case ERROR_BAD_MODULE_NAME: output.error = "Module name has no corresponding registered events"; @@ -107,6 +228,11 @@ public class DebugEventResource extends DebugEventResourceBase { return output; } + private DebugEventInfoOutput listEvents(DebugEventInfoOutput output) { + output.eventList = debugEvent.getEventList(); + return output; + } + private void populateSingleEvent(DebugEventInfo singleEventHistory, DebugEventInfoOutput output) { if (singleEventHistory != null) { diff --git a/src/main/java/net/floodlightcontroller/debugevent/web/DebugEventRoutable.java b/src/main/java/net/floodlightcontroller/debugevent/web/DebugEventRoutable.java index 88223af4e2a22ee335af4dd16d07598fa8b356b9..d4ee7c6fd1b21ccaf63ad588c16993fcb91f6ed0 100644 --- a/src/main/java/net/floodlightcontroller/debugevent/web/DebugEventRoutable.java +++ b/src/main/java/net/floodlightcontroller/debugevent/web/DebugEventRoutable.java @@ -11,7 +11,11 @@ public class DebugEventRoutable implements RestletRoutable { @Override public Restlet getRestlet(Context context) { Router router = new Router(context); - router.attach("/{param}", DebugEventResource.class); + router.attach("/{param1}/{param2}/", DebugEventResource.class); + router.attach("/{param1}/{param2}", DebugEventResource.class); + router.attach("/{param1}/", DebugEventResource.class); + router.attach("/{param1}", DebugEventResource.class); + router.attach("/", DebugEventResource.class); return router; } diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java b/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java index 8a8ee22a7d3644dac66bec464597bc0f0da1d8d1..a816d47ab11d9095d8356b48f79ae481e80f4684 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java @@ -17,20 +17,14 @@ package net.floodlightcontroller.linkdiscovery; import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType; -import org.openflow.protocol.OFPhysicalPort.OFPortState; - import com.fasterxml.jackson.annotation.JsonIgnore; public class LinkInfo { public LinkInfo(Long firstSeenTime, Long lastLldpReceivedTime, - Long lastBddpReceivedTime, - int srcPortState, - int dstPortState) { + Long lastBddpReceivedTime) { super(); - this.srcPortState = srcPortState; - this.dstPortState = dstPortState; this.firstSeenTime = firstSeenTime; this.lastLldpReceivedTime = lastLldpReceivedTime; this.lastBddpReceivedTime = lastBddpReceivedTime; @@ -41,15 +35,11 @@ public class LinkInfo { * Serialization/Deserialization */ public LinkInfo() { - this.srcPortState = null; - this.dstPortState = null; this.firstSeenTime = null; this.lastLldpReceivedTime = null; this.lastBddpReceivedTime = null; } - protected Integer srcPortState; - protected Integer dstPortState; protected Long firstSeenTime; protected Long lastLldpReceivedTime; /* Standard LLLDP received time */ protected Long lastBddpReceivedTime; /* Modified LLDP received time */ @@ -64,13 +54,6 @@ public class LinkInfo { * requires the new state to be written to storage. */ - - - public boolean linkStpBlocked() { - return ((srcPortState & OFPortState.OFPPS_STP_MASK.getValue()) == OFPortState.OFPPS_STP_BLOCK.getValue()) || - ((dstPortState & OFPortState.OFPPS_STP_MASK.getValue()) == OFPortState.OFPPS_STP_BLOCK.getValue()); - } - public Long getFirstSeenTime() { return firstSeenTime; } @@ -95,22 +78,6 @@ public class LinkInfo { this.lastBddpReceivedTime = multicastValidTime; } - public Integer getSrcPortState() { - return srcPortState; - } - - public void setSrcPortState(Integer srcPortState) { - this.srcPortState = srcPortState; - } - - public Integer getDstPortState() { - return dstPortState; - } - - public void setDstPortState(int dstPortState) { - this.dstPortState = dstPortState; - } - @JsonIgnore public LinkType getLinkType() { if (lastLldpReceivedTime != null) { @@ -131,8 +98,6 @@ public class LinkInfo { result = prime * result + ((firstSeenTime == null) ? 0 : firstSeenTime.hashCode()); result = prime * result + ((lastLldpReceivedTime == null) ? 0 : lastLldpReceivedTime.hashCode()); result = prime * result + ((lastBddpReceivedTime == null) ? 0 : lastBddpReceivedTime.hashCode()); - result = prime * result + ((srcPortState == null) ? 0 : srcPortState.hashCode()); - result = prime * result + ((dstPortState == null) ? 0 : dstPortState.hashCode()); return result; } @@ -167,18 +132,6 @@ public class LinkInfo { } else if (!lastBddpReceivedTime.equals(other.lastBddpReceivedTime)) return false; - if (srcPortState == null) { - if (other.srcPortState != null) - return false; - } else if (!srcPortState.equals(other.srcPortState)) - return false; - - if (dstPortState == null) { - if (other.dstPortState != null) - return false; - } else if (!dstPortState.equals(other.dstPortState)) - return false; - return true; } @@ -190,8 +143,6 @@ public class LinkInfo { public String toString() { return "LinkInfo [unicastValidTime=" + ((lastLldpReceivedTime == null) ? "null" : lastLldpReceivedTime) + ", multicastValidTime=" + ((lastBddpReceivedTime == null) ? "null" : lastBddpReceivedTime) - + ", srcPortState=" + ((srcPortState == null) ? "null" : srcPortState) - + ", dstPortState=" + ((dstPortState == null) ? "null" : srcPortState) + "]"; } } diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java index b8d3e143c31b8529134f63ee5575a1559113229f..63fea03499118609b6c87ec22c936c4ed48d06db 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java @@ -32,8 +32,6 @@ public class EventHistoryTopologyLink { // the front end (e.g. in cli in Python) public long srcSwDpid; public long dstSwDpid; - public int srcPortState; - public int dstPortState; public int srcSwport; public int dstSwport; public String linkType; @@ -49,14 +47,6 @@ public class EventHistoryTopologyLink { public long getDstSwDpid() { return dstSwDpid; } - @JsonProperty("SrcPortState") - public int getSrcPortState() { - return srcPortState; - } - @JsonProperty("DstPortState") - public int getDstPortState() { - return dstPortState; - } @JsonProperty("SrcPort") public int getSrcSwport() { return srcSwport; diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java index 28b55a235ff46bf73ec765346b35b715ae6f46ab..a825b1e7dda82ef38e43f380536e7d9cc92fe4b3 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java @@ -138,10 +138,8 @@ public class LinkDiscoveryManager implements IOFMessageListener, private static final String LINK_ID = "id"; private static final String LINK_SRC_SWITCH = "src_switch_id"; private static final String LINK_SRC_PORT = "src_port"; - private static final String LINK_SRC_PORT_STATE = "src_port_state"; private static final String LINK_DST_SWITCH = "dst_switch_id"; private static final String LINK_DST_PORT = "dst_port"; - private static final String LINK_DST_PORT_STATE = "dst_port_state"; private static final String LINK_VALID_TIME = "valid_time"; private static final String LINK_TYPE = "link_type"; private static final String SWITCH_CONFIG_TABLE_NAME = "controller_switchconfig"; @@ -699,13 +697,6 @@ public class LinkDiscoveryManager implements IOFMessageListener, return Command.STOP; } - OFPhysicalPort physicalPort = remoteSwitch.getPort(remotePort); - int srcPortState = (physicalPort != null) ? physicalPort.getState() - : 0; - physicalPort = iofSwitch.getPort(inPort); - int dstPortState = (physicalPort != null) ? physicalPort.getState() - : 0; - // Store the time of update to this link, and push it out to // routingEngine Link lt = new Link(remoteSwitch.getId(), remotePort, @@ -727,8 +718,7 @@ public class LinkDiscoveryManager implements IOFMessageListener, lastBddpTime = System.currentTimeMillis(); LinkInfo newLinkInfo = new LinkInfo(firstSeenTime, lastLldpTime, - lastBddpTime, srcPortState, - dstPortState); + lastBddpTime); addOrUpdateLink(lt, newLinkInfo); @@ -759,8 +749,7 @@ public class LinkDiscoveryManager implements IOFMessageListener, // srcPortState and dstPort state are reversed. LinkInfo reverseInfo = new LinkInfo(firstSeenTime, lastLldpTime, - lastBddpTime, dstPortState, - srcPortState); + lastBddpTime); addOrUpdateLink(reverseLink, reverseInfo); } @@ -1276,13 +1265,6 @@ public class LinkDiscoveryManager implements IOFMessageListener, linkChanged = true; } - // Only update the port states if they've changed - if (newInfo.getSrcPortState().intValue() != oldInfo.getSrcPortState() - .intValue() - || newInfo.getDstPortState().intValue() != oldInfo.getDstPortState() - .intValue()) - linkChanged = true; - return linkChanged; } @@ -1328,16 +1310,14 @@ public class LinkDiscoveryManager implements IOFMessageListener, log.info("Inter-switch link detected: {}", lt); } evHistTopoLink(lt.getSrc(), lt.getDst(), lt.getSrcPort(), - lt.getDstPort(), newInfo.getSrcPortState(), - newInfo.getDstPortState(), + lt.getDstPort(), linkType, EvAction.LINK_ADDED, "LLDP Recvd"); notifier.postNotification("Link added: " + lt.toString()); } else { linkChanged = updateLink(lt, oldInfo, newInfo); if (linkChanged) { - updateOperation = getUpdateOperation(newInfo.getSrcPortState(), - newInfo.getDstPortState()); + updateOperation = UpdateOperation.LINK_UPDATED; LinkType linkType = getLinkType(lt, newInfo); if (linkType == ILinkDiscovery.LinkType.DIRECT_LINK) { log.info("Inter-switch link updated: {}", lt); @@ -1345,8 +1325,6 @@ public class LinkDiscoveryManager implements IOFMessageListener, // Add to event history evHistTopoLink(lt.getSrc(), lt.getDst(), lt.getSrcPort(), lt.getDstPort(), - newInfo.getSrcPortState(), - newInfo.getDstPortState(), linkType, EvAction.LINK_PORT_STATE_UPDATED, "LLDP Recvd"); @@ -1458,8 +1436,7 @@ public class LinkDiscoveryManager implements IOFMessageListener, // Update Event History evHistTopoLink(lt.getSrc(), lt.getDst(), lt.getSrcPort(), - lt.getDstPort(), 0, - 0, // Port states + lt.getDstPort(), ILinkDiscovery.LinkType.INVALID_LINK, EvAction.LINK_DELETED, reason); @@ -1545,13 +1522,10 @@ public class LinkDiscoveryManager implements IOFMessageListener, && info.getMulticastValidTime() == null) { eraseList.add(entry.getKey()); } else if (linkChanged) { - UpdateOperation operation; - operation = getUpdateOperation(info.getSrcPortState(), - info.getDstPortState()); updates.add(new LDUpdate(lt.getSrc(), lt.getSrcPort(), lt.getDst(), lt.getDstPort(), getLinkType(lt, info), - operation)); + UpdateOperation.LINK_UPDATED)); } } @@ -1863,39 +1837,10 @@ public class LinkDiscoveryManager implements IOFMessageListener, else rowValues.put(LINK_TYPE, "invalid"); - if (linkInfo.linkStpBlocked()) { - if (log.isTraceEnabled()) { - log.trace("writeLink, link {}, info {}, srcPortState Blocked", - lt, linkInfo); - } - rowValues.put(LINK_SRC_PORT_STATE, - OFPhysicalPort.OFPortState.OFPPS_STP_BLOCK.getValue()); - } else { - if (log.isTraceEnabled()) { - log.trace("writeLink, link {}, info {}, srcPortState {}", - new Object[] { lt, linkInfo, - linkInfo.getSrcPortState() }); - } - rowValues.put(LINK_SRC_PORT_STATE, linkInfo.getSrcPortState()); - } String dstDpid = HexString.toHexString(lt.getDst()); rowValues.put(LINK_DST_SWITCH, dstDpid); rowValues.put(LINK_DST_PORT, lt.getDstPort()); - if (linkInfo.linkStpBlocked()) { - if (log.isTraceEnabled()) { - log.trace("writeLink, link {}, info {}, dstPortState Blocked", - lt, linkInfo); - } - rowValues.put(LINK_DST_PORT_STATE, - OFPhysicalPort.OFPortState.OFPPS_STP_BLOCK.getValue()); - } else { - if (log.isTraceEnabled()) { - log.trace("writeLink, link {}, info {}, dstPortState {}", - new Object[] { lt, linkInfo, - linkInfo.getDstPortState() }); - } - rowValues.put(LINK_DST_PORT_STATE, linkInfo.getDstPortState()); - } + storageSource.updateRowAsync(LINK_TABLE_NAME, rowValues); } @@ -2202,8 +2147,7 @@ public class LinkDiscoveryManager implements IOFMessageListener, public EventHistoryTopologyCluster evTopoCluster; private void evHistTopoLink(long srcDpid, long dstDpid, short srcPort, - short dstPort, int srcPortState, - int dstPortState, + short dstPort, ILinkDiscovery.LinkType linkType, EvAction actn, String reason) { if (evTopoLink == null) { @@ -2213,8 +2157,6 @@ public class LinkDiscoveryManager implements IOFMessageListener, evTopoLink.dstSwDpid = dstDpid; evTopoLink.srcSwport = srcPort & 0xffff; evTopoLink.dstSwport = dstPort & 0xffff; - evTopoLink.srcPortState = srcPortState; - evTopoLink.dstPortState = dstPortState; evTopoLink.reason = reason; switch (linkType) { case DIRECT_LINK: diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/DirectedLinksResource.java b/src/main/java/net/floodlightcontroller/linkdiscovery/web/DirectedLinksResource.java index fe38d76701d9afd9b3dbd1ae09702cbe8956ff5b..37dbd3953ee32287d8b1076e843faec154e1e15d 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/DirectedLinksResource.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/web/DirectedLinksResource.java @@ -46,10 +46,7 @@ public class DirectedLinksResource extends ServerResource { LinkType type = ld.getLinkType(link, info); if (type == LinkType.DIRECT_LINK || type == LinkType.TUNNEL) { LinkWithType lwt = new LinkWithType(link, - info.getSrcPortState(), - info.getDstPortState(), - type, - LinkDirection.UNIDIRECTIONAL); + type,LinkDirection.UNIDIRECTIONAL); returnLinkSet.add(lwt); } } diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/ExternalLinksResource.java b/src/main/java/net/floodlightcontroller/linkdiscovery/web/ExternalLinksResource.java index 69b39eeabe00ece4b95aff56abfaf1d500d8482f..c2aa9d4e47dbf8a7d52020380466c50c62bd9660 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/ExternalLinksResource.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/web/ExternalLinksResource.java @@ -61,8 +61,6 @@ public class ExternalLinksResource extends ServerResource { // It is sufficient to add only one side of it. if ((src < dst) || (src == dst && srcPort < dstPort)) { lwt = new LinkWithType(link, - info.getSrcPortState(), - info.getDstPortState(), type, LinkDirection.BIDIRECTIONAL); returnLinkSet.add(lwt); @@ -70,8 +68,6 @@ public class ExternalLinksResource extends ServerResource { } else { // This is a unidirectional link. lwt = new LinkWithType(link, - info.getSrcPortState(), - info.getDstPortState(), type, LinkDirection.UNIDIRECTIONAL); returnLinkSet.add(lwt); diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java b/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java index 8de425b168a166aa8d14435a27616b19d8f0ec55..d95235705d016ab44bc22bbacea79302198876a5 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java @@ -38,10 +38,8 @@ import net.floodlightcontroller.routing.Link; public class LinkWithType extends JsonSerializer<LinkWithType> { public long srcSwDpid; public short srcPort; - public int srcPortState; public long dstSwDpid; public short dstPort; - public int dstPortState; public LinkType type; public LinkDirection direction; @@ -49,16 +47,12 @@ public class LinkWithType extends JsonSerializer<LinkWithType> { public LinkWithType() {} public LinkWithType(Link link, - int srcPortState, - int dstPortState, LinkType type, LinkDirection direction) { this.srcSwDpid = link.getSrc(); this.srcPort = link.getSrcPort(); - this.srcPortState = srcPortState; this.dstSwDpid = link.getDst(); this.dstPort = link.getDstPort(); - this.dstPortState = dstPortState; this.type = type; this.direction = direction; } @@ -70,10 +64,8 @@ public class LinkWithType extends JsonSerializer<LinkWithType> { jgen.writeStartObject(); jgen.writeStringField("src-switch", HexString.toHexString(lwt.srcSwDpid)); jgen.writeNumberField("src-port", lwt.srcPort); - jgen.writeNumberField("src-port-state", lwt.srcPortState); jgen.writeStringField("dst-switch", HexString.toHexString(lwt.dstSwDpid)); jgen.writeNumberField("dst-port", lwt.dstPort); - jgen.writeNumberField("dst-port-state", lwt.dstPortState); jgen.writeStringField("type", lwt.type.toString()); jgen.writeStringField("direction", lwt.direction.toString()); jgen.writeEndObject(); diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java b/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java index c8edf433321642b6e9ce7f654ee71e0fc223adaf..0e488ddf2e13e97c5834f6380515f7008a240916 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java @@ -62,8 +62,6 @@ public class LinksResource extends ServerResource { // It is sufficient to add only one side of it. if ((src < dst) || (src == dst && srcPort < dstPort)) { lwt = new LinkWithType(link, - info.getSrcPortState(), - info.getDstPortState(), type, LinkDirection.BIDIRECTIONAL); returnLinkSet.add(lwt); @@ -71,8 +69,6 @@ public class LinksResource extends ServerResource { } else { // This is a unidirectional link. lwt = new LinkWithType(link, - info.getSrcPortState(), - info.getDstPortState(), type, LinkDirection.UNIDIRECTIONAL); returnLinkSet.add(lwt); diff --git a/src/test/java/net/floodlightcontroller/debugevent/DebugEventTest.java b/src/test/java/net/floodlightcontroller/debugevent/DebugEventTest.java index d5fbedb9550046a6efcb7b34d301120d387fc0f7..7d912077b3103756308f3915798eea49bb6de2d9 100644 --- a/src/test/java/net/floodlightcontroller/debugevent/DebugEventTest.java +++ b/src/test/java/net/floodlightcontroller/debugevent/DebugEventTest.java @@ -42,9 +42,9 @@ public class DebugEventTest extends FloodlightTestCase { get("switchevent").intValue()); assertEquals(eventId2, debugEvent.moduleEvents.get("dbgevtest"). get("pktinevent").intValue()); - assertEquals(true, debugEvent.containsModName("dbgevtest")); - assertEquals(true, debugEvent.containsMEName("dbgevtest-switchevent")); - assertEquals(true, debugEvent.containsMEName("dbgevtest-pktinevent")); + assertEquals(true, debugEvent.containsModuleName("dbgevtest")); + assertEquals(true, debugEvent.containsModuleEventName("dbgevtest","switchevent")); + assertEquals(true, debugEvent.containsModuleEventName("dbgevtest","pktinevent")); assertEquals(0, DebugEvent.allEvents[eventId1].eventBuffer.size()); assertEquals(0, DebugEvent.allEvents[eventId2].eventBuffer.size()); @@ -61,12 +61,12 @@ public class DebugEventTest extends FloodlightTestCase { assertEquals(1, DebugEvent.allEvents[eventId1].eventBuffer.size()); assertEquals(1, DebugEvent.allEvents[eventId2].eventBuffer.size()); - DebugEventInfo de = debugEvent.getSingleEventHistory("dbgevtest-switchevent"); + DebugEventInfo de = debugEvent.getSingleEventHistory("dbgevtest","switchevent"); assertEquals(1, de.events.size()); assertEquals(true, de.events.get(0) .contains("Sw=00:00:00:00:00:00:00:01, reason=connected")); - DebugEventInfo de2 = debugEvent.getSingleEventHistory("dbgevtest-pktinevent"); + DebugEventInfo de2 = debugEvent.getSingleEventHistory("dbgevtest","pktinevent"); assertEquals(1, de2.events.size()); assertEquals(true, de2.events.get(0) .contains("Sw=1, reason=switch sent pkt-in")); diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java index 6eecf116f8bd3eeafea6d58e80aeea9407b3b88e..4a8a9106edfb3fe75975a19f2832e9f6f5932550 100644 --- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java +++ b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java @@ -155,8 +155,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { Link lt = new Link(1L, 2, 2L, 1); LinkInfo info = new LinkInfo(System.currentTimeMillis(), - System.currentTimeMillis(), null, - 0, 0); + System.currentTimeMillis(), null); linkDiscovery.addOrUpdateLink(lt, info); @@ -179,8 +178,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { Link lt = new Link(1L, 2, 2L, 1); LinkInfo info = new LinkInfo(System.currentTimeMillis(), - System.currentTimeMillis(), null, - 0, 0); + System.currentTimeMillis(), null); linkDiscovery.addOrUpdateLink(lt, info); linkDiscovery.deleteLinks(Collections.singletonList(lt), "Test"); @@ -201,8 +199,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { NodePortTuple dstNpt = new NodePortTuple(2L, 3); LinkInfo info = new LinkInfo(System.currentTimeMillis(), - System.currentTimeMillis(), null, - 0, 0); + System.currentTimeMillis(), null); linkDiscovery.addOrUpdateLink(lt, info); // check invariants hold @@ -224,8 +221,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { NodePortTuple dstNpt = new NodePortTuple(2L, 3); LinkInfo info = new LinkInfo(System.currentTimeMillis(), - System.currentTimeMillis(), null, - 0, 0); + System.currentTimeMillis(), null); linkDiscovery.addOrUpdateLink(lt, info); linkDiscovery.deleteLinks(Collections.singletonList(lt), "Test to self"); @@ -245,8 +241,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { NodePortTuple srcNpt = new NodePortTuple(1L, 2); NodePortTuple dstNpt = new NodePortTuple(2L, 1); LinkInfo info = new LinkInfo(System.currentTimeMillis(), - System.currentTimeMillis(), null, - 0, 0); + System.currentTimeMillis(), null); linkDiscovery.addOrUpdateLink(lt, info); IOFSwitch sw1 = getMockFloodlightProvider().getSwitch(1L); @@ -270,8 +265,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { replay(sw1); Link lt = new Link(1L, 2, 1L, 3); LinkInfo info = new LinkInfo(System.currentTimeMillis(), - System.currentTimeMillis(), null, - 0, 0); + System.currentTimeMillis(), null); linkDiscovery.addOrUpdateLink(lt, info); // Mock up our expected behavior @@ -296,8 +290,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { LinkInfo info; info = new LinkInfo(System.currentTimeMillis() - 40000, - System.currentTimeMillis() - 40000, null, - 0, 0); + System.currentTimeMillis() - 40000, null); linkDiscovery.addOrUpdateLink(lt, info); // check invariants hold @@ -314,7 +307,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { info = new LinkInfo(System.currentTimeMillis(),/* firstseen */ null,/* unicast */ - System.currentTimeMillis(), 0, 0); + System.currentTimeMillis()); linkDiscovery.addOrUpdateLink(lt, info); assertTrue(linkDiscovery.links.get(lt).getUnicastValidTime() == null); assertTrue(linkDiscovery.links.get(lt).getMulticastValidTime() != null); @@ -326,7 +319,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { // with LT_OPENFLOW_LINK, the link property should be changed to LT_NON_OPENFLOW // by the addOrUpdateLink method. info = new LinkInfo(System.currentTimeMillis() - 40000, - System.currentTimeMillis() - 40000, null, 0, 0); + System.currentTimeMillis() - 40000, null); linkDiscovery.addOrUpdateLink(lt, info); // Expect to timeout the unicast Valid Time, but not the multicast Valid time @@ -337,14 +330,14 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { // Set the multicastValidTime to be old and see if that also times out. info = new LinkInfo(System.currentTimeMillis() - 40000, - null, System.currentTimeMillis() - 40000, 0, 0); + null, System.currentTimeMillis() - 40000); linkDiscovery.addOrUpdateLink(lt, info); linkDiscovery.timeoutLinks(); assertTrue(linkDiscovery.links.get(lt) == null); // Test again only with multicast LLDP info = new LinkInfo(System.currentTimeMillis() - 40000, - null, System.currentTimeMillis() - 40000, 0, 0); + null, System.currentTimeMillis() - 40000); linkDiscovery.addOrUpdateLink(lt, info); assertTrue(linkDiscovery.links.get(lt).getUnicastValidTime() == null); assertTrue(linkDiscovery.links.get(lt).getMulticastValidTime() != null); @@ -358,7 +351,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { srcNpt = new NodePortTuple(1L, 1); dstNpt = new NodePortTuple(1L, 2); info = new LinkInfo(System.currentTimeMillis() - 40000, - null, System.currentTimeMillis() - 40000, 0, 0); + null, System.currentTimeMillis() - 40000); linkDiscovery.addOrUpdateLink(lt, info); @@ -367,7 +360,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { srcNpt = new NodePortTuple(1L, 1); dstNpt = new NodePortTuple(1L, 3); info = new LinkInfo(System.currentTimeMillis() - 40000, - null, System.currentTimeMillis() - 40000, 0, 0); + null, System.currentTimeMillis() - 40000); linkDiscovery.addOrUpdateLink(lt, info); // Start clean and see if loops are also added. @@ -375,7 +368,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { srcNpt = new NodePortTuple(1L, 4); dstNpt = new NodePortTuple(1L, 5); info = new LinkInfo(System.currentTimeMillis() - 40000, - null, System.currentTimeMillis() - 40000, 0, 0); + null, System.currentTimeMillis() - 40000); linkDiscovery.addOrUpdateLink(lt, info); // Start clean and see if loops are also added. @@ -383,7 +376,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { srcNpt = new NodePortTuple(1L, 3); dstNpt = new NodePortTuple(1L, 5); info = new LinkInfo(System.currentTimeMillis() - 40000, - null, System.currentTimeMillis() - 40000, 0, 0); + null, System.currentTimeMillis() - 40000); linkDiscovery.addOrUpdateLink(lt, info); } @@ -397,8 +390,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { NodePortTuple srcNpt = new NodePortTuple(1L, 2); NodePortTuple dstNpt = new NodePortTuple(2L, 1); LinkInfo info = new LinkInfo(System.currentTimeMillis(), - System.currentTimeMillis(), null, - 0, 0); + System.currentTimeMillis(), null); linkDiscovery.addOrUpdateLink(lt, info); // check invariants hold