diff --git a/src/main/java/net/floodlightcontroller/core/IHAListener.java b/src/main/java/net/floodlightcontroller/core/IHAListener.java index 23d42644b78d1c2e1cc5a6cd1d4ef022418d4e80..d8f1e536b08cdf4f85b0bb9fcaecb8be7a8ce5a4 100644 --- a/src/main/java/net/floodlightcontroller/core/IHAListener.java +++ b/src/main/java/net/floodlightcontroller/core/IHAListener.java @@ -24,23 +24,22 @@ public interface IHAListener { /** * Gets called when the controller changes role (i.e. Master -> Slave). * Note that oldRole CAN be null. - * @param oldRole The controller's old role * @param newRole The controller's new role */ - public void roleChanged(Role oldRole, Role newRole); - + public void roleChanged(Role newRole); + /** - * Gets called when the IP addresses of the controller nodes in the + * Gets called when the IP addresses of the controller nodes in the * controller cluster change. All parameters map controller ID to * the controller's IP. - * + * * @param curControllerNodeIPs The current mapping of controller IDs to IP * @param addedControllerNodeIPs These IPs were added since the last update * @param removedControllerNodeIPs These IPs were removed since the last update */ public void controllerNodeIPsChanged( - Map<String, String> curControllerNodeIPs, - Map<String, String> addedControllerNodeIPs, - Map<String, String> removedControllerNodeIPs - ); + Map<String, String> curControllerNodeIPs, + Map<String, String> addedControllerNodeIPs, + Map<String, String> removedControllerNodeIPs + ); } diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java index bdd36ca4e730465f5cb7d4efbd69d7a3f1093387..420f357e2ae6370bb85109e523194eb0a8ec6f70 100644 --- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java +++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java @@ -530,7 +530,7 @@ public class Controller implements IFloodlightProviderService, } if (haListeners != null) { for (IHAListener listener : haListeners) { - listener.roleChanged(null, newRole); + listener.roleChanged(newRole); } } if (newRole != Role.SLAVE) { diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java index 8861f33214e5c55f086c2074d367ac0e9ced4969..50bc5fa46ee8dc84cba9d94296b32dbc90f54c0f 100755 --- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java +++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java @@ -777,7 +777,7 @@ IFlowReconcileListener, IInfoProvider, IHAListener { // *************** @Override - public void roleChanged(Role oldRole, Role newRole) { + public void roleChanged(Role newRole) { switch(newRole) { case SLAVE: logger.debug("Resetting device state because of role change"); diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java index c930182262360cc6072d2289da5843ee0db39c5e..626804847d9d2bc97d508cb5583ca5e5df8a4617 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java @@ -2395,7 +2395,7 @@ public class LinkDiscoveryManager implements IOFMessageListener, //*************** @Override - public void roleChanged(Role oldRole, Role newRole) { + public void roleChanged(Role newRole) { switch (newRole) { case MASTER: if (log.isTraceEnabled()) { diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java index 0e04420ee446421dbada0698b40da5880a060497..ee394ef9af49de7d2163e586558ba6188e807a41 100644 --- a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java +++ b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java @@ -66,12 +66,12 @@ import org.slf4j.LoggerFactory; * switches. This is just a big 'ol dumb list of flows and something external * is responsible for ensuring they make sense for the network. */ -public class StaticFlowEntryPusher +public class StaticFlowEntryPusher implements IOFSwitchListener, IFloodlightModule, IStaticFlowEntryPusherService, IStorageSourceListener, IOFMessageListener, IHAListener { protected static Logger log = LoggerFactory.getLogger(StaticFlowEntryPusher.class); public static final String StaticFlowName = "staticflowentry"; - + public static final int STATIC_FLOW_APP_ID = 10; public static final String TABLE_NAME = "controller_staticflowtableentry"; @@ -190,10 +190,10 @@ public class StaticFlowEntryPusher } } } - + /** * Used only for bundle-local indexing - * + * * @param map * @return */ @@ -207,10 +207,10 @@ public class StaticFlowEntryPusher } return ret; } - + /** * Read entries from storageSource, and store them in a hash - * + * * @return */ @LogMessageDoc(level="ERROR", @@ -239,10 +239,10 @@ public class StaticFlowEntryPusher /** * Take a single row, turn it into a flowMod, and add it to the - * entries{$dpid}.{$entryName}=FlowMod - * + * entries{$dpid}.{$entryName}=FlowMod + * * IF an entry is in active, mark it with FlowMod = null - * + * * @param row * @param entries */ @@ -269,7 +269,7 @@ public class StaticFlowEntryPusher if (!entries.containsKey(switchName)) entries.put(switchName, new HashMap<String, OFFlowMod>()); StaticFlowEntries.initDefaultFlowMod(flowMod, entryName); - + for (String key : row.keySet()) { if (row.get(key) == null) continue; @@ -291,8 +291,8 @@ public class StaticFlowEntryPusher StaticFlowEntries.parseActionString(flowMod, (String) row.get(COLUMN_ACTIONS), log); } else if (key.equals(COLUMN_COOKIE)) { flowMod.setCookie( - StaticFlowEntries.computeEntryCookie(flowMod, - Integer.valueOf((String) row.get(COLUMN_COOKIE)), + StaticFlowEntries.computeEntryCookie(flowMod, + Integer.valueOf((String) row.get(COLUMN_COOKIE)), entryName)); } else if (key.equals(COLUMN_PRIORITY)) { flowMod.setPriority(U16.t(Integer.valueOf((String) row.get(COLUMN_PRIORITY)))); @@ -327,7 +327,7 @@ public class StaticFlowEntryPusher entries.get(switchName).put(entryName, flowMod); } - + @Override public void addedSwitch(IOFSwitch sw) { log.debug("Switch {} connected; processing its static entries", HexString.toHexString(sw.getId())); @@ -339,7 +339,7 @@ public class StaticFlowEntryPusher // do NOT delete from our internal state; we're tracking the rules, // not the switches } - + @Override public void switchPortChanged(Long switchId) { // no-op @@ -349,9 +349,9 @@ public class StaticFlowEntryPusher public void rowsModified(String tableName, Set<Object> rowKeys) { // This handles both rowInsert() and rowUpdate() log.debug("Modifying Table {}", tableName); - HashMap<String, Map<String, OFFlowMod>> entriesToAdd = + HashMap<String, Map<String, OFFlowMod>> entriesToAdd = new HashMap<String, Map<String, OFFlowMod>>(); - // build up list of what was added + // build up list of what was added for (Object key: rowKeys) { IResultSet resultSet = storageSource.getRow(tableName, key); Iterator<IResultSet> it = resultSet.iterator(); @@ -364,7 +364,7 @@ public class StaticFlowEntryPusher for (String dpid : entriesToAdd.keySet()) { if (!entriesFromStorage.containsKey(dpid)) entriesFromStorage.put(dpid, new HashMap<String, OFFlowMod>()); - + List<OFMessage> outQueue = new ArrayList<OFMessage>(); for(String entry : entriesToAdd.get(dpid).keySet()) { OFFlowMod newFlowMod = entriesToAdd.get(dpid).get(entry); @@ -374,13 +374,13 @@ public class StaticFlowEntryPusher if (dpidOldFlowMod != null) { oldFlowMod = entriesFromStorage.get(dpidOldFlowMod).remove(entry); } - if (oldFlowMod != null && newFlowMod != null) { + if (oldFlowMod != null && newFlowMod != null) { // set the new flow mod to modify a pre-existing rule if these fields match if(oldFlowMod.getMatch().equals(newFlowMod.getMatch()) && oldFlowMod.getCookie() == newFlowMod.getCookie() && oldFlowMod.getPriority() == newFlowMod.getPriority()){ newFlowMod.setCommand(OFFlowMod.OFPFC_MODIFY_STRICT); - // if they don't match delete the old flow + // if they don't match delete the old flow } else{ oldFlowMod.setCommand(OFFlowMod.OFPFC_DELETE_STRICT); if (dpidOldFlowMod.equals(dpid)) { @@ -390,7 +390,7 @@ public class StaticFlowEntryPusher } } } - // write the new flow + // write the new flow if (newFlowMod != null) { entriesFromStorage.get(dpid).put(entry, newFlowMod); outQueue.add(newFlowMod); @@ -409,7 +409,7 @@ public class StaticFlowEntryPusher if (log.isDebugEnabled()) { log.debug("Deleting from table {}", tableName); } - + for(Object obj : rowKeys) { if (!(obj instanceof String)) { log.debug("Tried to delete non-string key {}; ignoring", obj); @@ -418,7 +418,7 @@ public class StaticFlowEntryPusher deleteStaticFlowEntry((String) obj); } } - + @LogMessageDoc(level="ERROR", message="inconsistent internal state: no switch has rule {rule}", explanation="Inconsistent internat state discovered while " + @@ -426,34 +426,34 @@ public class StaticFlowEntryPusher recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG) private void deleteStaticFlowEntry(String entryName) { String dpid = entry2dpid.remove(entryName); - + if (dpid == null) { // assume state has been cleared by deleteFlowsForSwitch() or // deleteAllFlows() return; } - + if (log.isDebugEnabled()) { log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid); } - + // send flow_mod delete OFFlowMod flowMod = entriesFromStorage.get(dpid).get(entryName); flowMod.setCommand(OFFlowMod.OFPFC_DELETE_STRICT); - if (entriesFromStorage.containsKey(dpid) && + if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) { entriesFromStorage.get(dpid).remove(entryName); - } else { - log.debug("Tried to delete non-existent entry {} for switch {}", + } else { + log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid); return; } - + writeFlowModToSwitch(HexString.toLong(dpid), flowMod); return; } - + /** * Writes a list of OFMessages to a switch * @param dpid The datapath ID of the switch to write to @@ -478,7 +478,7 @@ public class StaticFlowEntryPusher } } } - + /** * Writes a single OFMessage to a switch * @param dpid The datapath ID of the switch to write to @@ -503,7 +503,7 @@ public class StaticFlowEntryPusher } } } - + /** * Writes an OFFlowMod to a switch. It checks to make sure the switch * exists before it sends @@ -515,14 +515,14 @@ public class StaticFlowEntryPusher IOFSwitch ofSwitch = switches.get(dpid); if (ofSwitch == null) { if (log.isDebugEnabled()) { - log.debug("Not deleting key {} :: switch {} not connected", + log.debug("Not deleting key {} :: switch {} not connected", dpid); } return; } writeFlowModToSwitch(ofSwitch, flowMod); } - + /** * Writes an OFFlowMod to a switch * @param sw The IOFSwitch to write to @@ -538,7 +538,7 @@ public class StaticFlowEntryPusher sw.write(flowMod, null); sw.flush(); } catch (IOException e) { - log.error("Tried to write OFFlowMod to {} but failed: {}", + log.error("Tried to write OFFlowMod to {} but failed: {}", HexString.toHexString(sw.getId()), e.getMessage()); } } @@ -547,7 +547,7 @@ public class StaticFlowEntryPusher public String getName() { return StaticFlowName; } - + /** * Handles a flow removed message from a switch. If the flow was removed * and we did not explicitly delete it we re-install it. If we explicitly @@ -560,7 +560,7 @@ public class StaticFlowEntryPusher public Command handleFlowRemoved(IOFSwitch sw, OFFlowRemoved msg, FloodlightContext cntx) { long cookie = msg.getCookie(); /** - * This is just to sanity check our assumption that static flows + * This is just to sanity check our assumption that static flows * never expire. */ if (AppCookie.extractApp(cookie) == STATIC_FLOW_APP_ID) { @@ -570,10 +570,10 @@ public class StaticFlowEntryPusher // Stop the processing chain since we sent the delete. return Command.STOP; } - + return Command.CONTINUE; } - + @Override @LogMessageDoc(level="ERROR", message="Got a FlowRemove message for a infinite " + @@ -601,10 +601,10 @@ public class StaticFlowEntryPusher } // IFloodlightModule - + @Override public Collection<Class<? extends IFloodlightService>> getModuleServices() { - Collection<Class<? extends IFloodlightService>> l = + Collection<Class<? extends IFloodlightService>> l = new ArrayList<Class<? extends IFloodlightService>>(); l.add(IStaticFlowEntryPusherService.class); return l; @@ -613,7 +613,7 @@ public class StaticFlowEntryPusher @Override public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() { Map<Class<? extends IFloodlightService>, - IFloodlightService> m = + IFloodlightService> m = new HashMap<Class<? extends IFloodlightService>, IFloodlightService>(); m.put(IStaticFlowEntryPusherService.class, this); @@ -622,7 +622,7 @@ public class StaticFlowEntryPusher @Override public Collection<Class<? extends IFloodlightService>> getModuleDependencies() { - Collection<Class<? extends IFloodlightService>> l = + Collection<Class<? extends IFloodlightService>> l = new ArrayList<Class<? extends IFloodlightService>>(); l.add(IFloodlightProviderService.class); l.add(IStorageSourceService.class); @@ -642,22 +642,22 @@ public class StaticFlowEntryPusher } @Override - public void startUp(FloodlightModuleContext context) { + public void startUp(FloodlightModuleContext context) { floodlightProvider.addOFMessageListener(OFType.FLOW_REMOVED, this); floodlightProvider.addOFSwitchListener(this); floodlightProvider.addHAListener(this); - + // assumes no switches connected at startup() storageSource.createTable(TABLE_NAME, null); storageSource.setTablePrimaryKeyName(TABLE_NAME, COLUMN_NAME); storageSource.addListener(TABLE_NAME, this); - entriesFromStorage = readEntriesFromStorage(); + entriesFromStorage = readEntriesFromStorage(); entry2dpid = computeEntry2DpidMap(entriesFromStorage); restApi.addRestletRoutable(new StaticFlowEntryWebRoutable()); } // IStaticFlowEntryPusherService methods - + @Override public void addFlow(String name, OFFlowMod fm, String swDpid) { Map<String, Object> fmMap = StaticFlowEntries.flowModToStorageEntry(fm, swDpid, name); @@ -668,19 +668,19 @@ public class StaticFlowEntryPusher public void deleteFlow(String name) { storageSource.deleteRowAsync(TABLE_NAME, name); } - + @Override public void deleteAllFlows() { for (String entry : entry2dpid.keySet()) { deleteFlow(entry); } - + /* FIXME: Since the OF spec 1.0 is not clear on how to match on cookies. Once all switches come to a common implementation we can possibly re-enable this fix. - + // Send a delete for each switch Set<String> swSet = new HashSet<String>(); for (String dpid : entry2dpid.values()) { @@ -690,36 +690,36 @@ public class StaticFlowEntryPusher sendDeleteByCookie(HexString.toLong(dpid)); } } - + // Clear our map entry2dpid.clear(); - + // Clear our book keeping map for (Map<String, OFFlowMod> eMap : entriesFromStorage.values()) { eMap.clear(); } - + // Reset our DB storageSource.deleteMatchingRowsAsync(TABLE_NAME, null); */ } - + @Override public void deleteFlowsForSwitch(long dpid) { String sDpid = HexString.toHexString(dpid); - + for (Entry<String, String> e : entry2dpid.entrySet()) { if (e.getValue().equals(sDpid)) deleteFlow(e.getKey()); } - + /* FIXME: Since the OF spec 1.0 is not clear on how to match on cookies. Once all switches come to a common implementation we can possibly re-enable this fix. //sendDeleteByCookie(dpid); - + String sDpid = HexString.toHexString(dpid); // Clear all internal flows for this switch Map<String, OFFlowMod> sMap = entriesFromStorage.get(sDpid); @@ -735,11 +735,11 @@ public class StaticFlowEntryPusher } */ } - + /** * Deletes all flows installed by static flow pusher on a given switch. * We send a delete flow mod with the static flow pusher app ID in the cookie. - * Since OF1.0 doesn't support masking based on the cookie we have to + * Since OF1.0 doesn't support masking based on the cookie we have to * disable having flow specific cookies. * @param dpid The DPID of the switch to clear all it's flows. */ @@ -751,14 +751,14 @@ public class StaticFlowEntryPusher private void sendDeleteByCookie(long dpid) { if (log.isDebugEnabled()) log.debug("Deleting all static flows on switch {}", HexString.toHexString(dpid)); - + IOFSwitch sw = floodlightProvider.getSwitches().get(dpid); if (sw == null) { log.warn("Tried to delete static flows for non-existant switch {}", HexString.toHexString(dpid)); return; } - + OFFlowMod fm = (OFFlowMod) floodlightProvider.getOFMessageFactory(). getMessage(OFType.FLOW_MOD); OFMatch ofm = new OFMatch(); @@ -771,35 +771,33 @@ public class StaticFlowEntryPusher sw.write(fm, null); sw.flush(); } catch (IOException e1) { - log.error("Error deleting all flows for switch {}:\n {}", + log.error("Error deleting all flows for switch {}:\n {}", HexString.toHexString(dpid), e1.getMessage()); return; } } */ - + @Override public Map<String, Map<String, OFFlowMod>> getFlows() { return entriesFromStorage; } - + @Override public Map<String, OFFlowMod> getFlows(String dpid) { return entriesFromStorage.get(dpid); } - + // IHAListener - + @Override - public void roleChanged(Role oldRole, Role newRole) { + public void roleChanged(Role newRole) { switch(newRole) { case MASTER: - if (oldRole == Role.SLAVE) { - log.debug("Re-reading static flows from storage due " + - "to HA change from SLAVE->MASTER"); - entriesFromStorage = readEntriesFromStorage(); - entry2dpid = computeEntry2DpidMap(entriesFromStorage); - } + log.debug("Re-reading static flows from storage due " + + "to HA change from SLAVE->MASTER"); + entriesFromStorage = readEntriesFromStorage(); + entry2dpid = computeEntry2DpidMap(entriesFromStorage); break; case SLAVE: log.debug("Clearing in-memory flows due to " + @@ -811,7 +809,7 @@ public class StaticFlowEntryPusher break; } } - + @Override public void controllerNodeIPsChanged( Map<String, String> curControllerNodeIPs, diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java index e0e39729874fa23024b89050c670ed7b68ef8825..148055c35d5f645921e3fe4f3c9869a5ddf20ef3 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java @@ -664,15 +664,13 @@ public class TopologyManager implements // *************** @Override - public void roleChanged(Role oldRole, Role newRole) { + public void roleChanged(Role newRole) { switch(newRole) { case MASTER: - if (oldRole == Role.SLAVE) { - log.debug("Re-computing topology due " + - "to HA change from SLAVE->MASTER"); - newInstanceTask.reschedule(TOPOLOGY_COMPUTE_INTERVAL_MS, - TimeUnit.MILLISECONDS); - } + log.debug("Re-computing topology due " + + "to HA change from SLAVE->MASTER"); + newInstanceTask.reschedule(TOPOLOGY_COMPUTE_INTERVAL_MS, + TimeUnit.MILLISECONDS); break; case SLAVE: log.debug("Clearing topology due to " + diff --git a/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java b/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java index 78139acfba14f6d2fb61ec8092332be3dfe0ed0c..bc6ccf7c9bb4e6f0aa20de9728954e5a750e38a1 100644 --- a/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java +++ b/src/test/java/net/floodlightcontroller/core/test/MockFloodlightProvider.java @@ -1,7 +1,7 @@ /** -* Copyright 2011, Big Switch Networks, Inc. +* Copyright 2011, Big Switch Networks, Inc. * Originally created by David Erickson, Stanford University -* +* * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at @@ -69,10 +69,10 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro protected BasicFactory factory; /** - * + * */ public MockFloodlightProvider() { - listeners = new ConcurrentHashMap<OFType, ListenerDispatcher<OFType, + listeners = new ConcurrentHashMap<OFType, ListenerDispatcher<OFType, IOFMessageListener>>(); switches = new ConcurrentHashMap<Long, IOFSwitch>(); switchListeners = new CopyOnWriteArrayList<IOFSwitchListener>(); @@ -81,9 +81,9 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro } @Override - public synchronized void addOFMessageListener(OFType type, + public synchronized void addOFMessageListener(OFType type, IOFMessageListener listener) { - ListenerDispatcher<OFType, IOFMessageListener> ldd = + ListenerDispatcher<OFType, IOFMessageListener> ldd = listeners.get(type); if (ldd == null) { ldd = new ListenerDispatcher<OFType, IOFMessageListener>(); @@ -95,7 +95,7 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro @Override public synchronized void removeOFMessageListener(OFType type, IOFMessageListener listener) { - ListenerDispatcher<OFType, IOFMessageListener> ldd = + ListenerDispatcher<OFType, IOFMessageListener> ldd = listeners.get(type); if (ldd != null) { ldd.removeListener(listener); @@ -107,9 +107,9 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro */ @Override public Map<OFType, List<IOFMessageListener>> getListeners() { - Map<OFType, List<IOFMessageListener>> lers = + Map<OFType, List<IOFMessageListener>> lers = new HashMap<OFType, List<IOFMessageListener>>(); - for(Entry<OFType, ListenerDispatcher<OFType, IOFMessageListener>> e : + for(Entry<OFType, ListenerDispatcher<OFType, IOFMessageListener>> e : listeners.entrySet()) { lers.put(e.getKey(), e.getValue().getOrderedListeners()); } @@ -119,7 +119,7 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro public void clearListeners() { this.listeners.clear(); } - + @Override public Map<Long, IOFSwitch> getSwitches() { return this.switches; @@ -142,7 +142,7 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro public void dispatchMessage(IOFSwitch sw, OFMessage msg) { dispatchMessage(sw, msg, new FloodlightContext()); } - + public void dispatchMessage(IOFSwitch sw, OFMessage msg, FloodlightContext bc) { List<IOFMessageListener> theListeners = listeners.get(msg.getType()).getOrderedListeners(); if (theListeners != null) { @@ -152,8 +152,8 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro OFPacketIn pi = (OFPacketIn)msg; Ethernet eth = new Ethernet(); eth.deserialize(pi.getPacketData(), 0, pi.getPacketData().length); - IFloodlightProviderService.bcStore.put(bc, - IFloodlightProviderService.CONTEXT_PI_PAYLOAD, + IFloodlightProviderService.bcStore.put(bc, + IFloodlightProviderService.CONTEXT_PI_PAYLOAD, eth); } while (it.hasNext() && !Command.STOP.equals(result)) { @@ -161,15 +161,15 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro } } } - + @Override public void handleOutgoingMessage(IOFSwitch sw, OFMessage m, FloodlightContext bc) { List<IOFMessageListener> msgListeners = null; if (listeners.containsKey(m.getType())) { msgListeners = listeners.get(m.getType()).getOrderedListeners(); } - - if (msgListeners != null) { + + if (msgListeners != null) { for (IOFMessageListener listener : msgListeners) { if (listener instanceof IOFSwitchFilter) { if (!((IOFSwitchFilter)listener).isInterested(sw)) { @@ -182,7 +182,7 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro } } } - + public void handleOutgoingMessages(IOFSwitch sw, List<OFMessage> msglist, FloodlightContext bc) { for (OFMessage m:msglist) { handleOutgoingMessage(sw, m, bc); @@ -195,7 +195,7 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro public List<IOFSwitchListener> getSwitchListeners() { return switchListeners; } - + @Override public void terminate() { } @@ -205,14 +205,14 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro dispatchMessage(sw, msg); return true; } - + @Override - public boolean injectOfMessage(IOFSwitch sw, OFMessage msg, - FloodlightContext bContext) { - dispatchMessage(sw, msg, bContext); + public boolean injectOfMessage(IOFSwitch sw, OFMessage msg, + FloodlightContext bContext) { + dispatchMessage(sw, msg, bContext); return true; } - + @Override public BasicFactory getOFMessageFactory() { return factory; @@ -235,7 +235,7 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() { Map<Class<? extends IFloodlightService>, - IFloodlightService> m = + IFloodlightService> m = new HashMap<Class<? extends IFloodlightService>, IFloodlightService>(); m.put(IFloodlightProviderService.class, this); @@ -247,30 +247,30 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro getModuleDependencies() { return null; } - + @Override public void init(FloodlightModuleContext context) throws FloodlightModuleException { // TODO Auto-generated method stub - + } @Override public void startUp(FloodlightModuleContext context) { // TODO Auto-generated method stub - + } @Override public void addInfoProvider(String type, IInfoProvider provider) { // TODO Auto-generated method stub - + } @Override public void removeInfoProvider(String type, IInfoProvider provider) { // TODO Auto-generated method stub - + } @Override @@ -288,25 +288,25 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro public void removeHAListener(IHAListener listener) { haListeners.remove(listener); } - + @Override public Role getRole() { return null; } - + @Override public void setRole(Role role, String roleChangeDescription) { - + } - + /** * Dispatches a new role change notification * @param oldRole * @param newRole */ - public void dispatchRoleChanged(Role oldRole, Role newRole) { + public void dispatchRoleChanged(Role newRole) { for (IHAListener rl : haListeners) { - rl.roleChanged(oldRole, newRole); + rl.roleChanged(newRole); } } @@ -325,14 +325,14 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro private void logListeners() { for (Map.Entry<OFType, - ListenerDispatcher<OFType, + ListenerDispatcher<OFType, IOFMessageListener>> entry : listeners.entrySet()) { - + OFType type = entry.getKey(); - ListenerDispatcher<OFType, IOFMessageListener> ldd = + ListenerDispatcher<OFType, IOFMessageListener> ldd = entry.getValue(); - + StringBuffer sb = new StringBuffer(); sb.append("OFListeners for "); sb.append(type); @@ -341,20 +341,20 @@ public class MockFloodlightProvider implements IFloodlightModule, IFloodlightPro sb.append(l.getName()); sb.append(","); } - log.debug(sb.toString()); + log.debug(sb.toString()); } } @Override public void setAlwaysClearFlowsOnSwAdd(boolean value) { // TODO Auto-generated method stub - + } @Override public void addOFSwitchDriver(String desc, IOFSwitchDriver driver) { // TODO Auto-generated method stub - + } @Override diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java index 566493a7075a5c921c664a819ca776b1fc0f6614..89e5420d21cc1676503488220c4ed45f2703e9aa 100644 --- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java +++ b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java @@ -1,7 +1,7 @@ /** -* Copyright 2011, Big Switch Networks, Inc. +* Copyright 2011, Big Switch Networks, Inc. * Originally created by David Erickson, Stanford University -* +* * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain * a copy of the License at @@ -78,7 +78,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { private TestLinkDiscoveryManager ldm; protected static Logger log = LoggerFactory.getLogger(LinkDiscoveryManagerTest.class); - + public class TestLinkDiscoveryManager extends LinkDiscoveryManager { public boolean isSendLLDPsCalled = false; public boolean isClearLinksCalled = false; @@ -100,7 +100,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { super.clearAllLinks(); } } - + public LinkDiscoveryManager getLinkDiscoveryManager() { return ldm; } @@ -289,7 +289,7 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { Link lt = new Link(1L, 1, 2L, 1); NodePortTuple srcNpt = new NodePortTuple(1L, 1); NodePortTuple dstNpt = new NodePortTuple(2L, 1); - + LinkInfo info; info = new LinkInfo(System.currentTimeMillis() - 40000, @@ -439,11 +439,11 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { assertNotNull(linkDiscovery.portLinks.get(dstNpt)); assertTrue(linkDiscovery.portLinks.get(dstNpt).contains(lt)); assertTrue(linkDiscovery.links.containsKey(lt)); - + // check that it clears from memory - getMockFloodlightProvider().dispatchRoleChanged(null, Role.SLAVE); + getMockFloodlightProvider().dispatchRoleChanged(Role.SLAVE); assertTrue(linkDiscovery.switchLinks.isEmpty()); - getMockFloodlightProvider().dispatchRoleChanged(Role.SLAVE, Role.MASTER); + getMockFloodlightProvider().dispatchRoleChanged(Role.MASTER); // check that lldps were sent assertTrue(ldm.isSendLLDPsCalled); assertTrue(ldm.isClearLinksCalled); diff --git a/src/test/java/net/floodlightcontroller/staticflowentry/StaticFlowTests.java b/src/test/java/net/floodlightcontroller/staticflowentry/StaticFlowTests.java index abf5b59cb75ef3cd3f989fd9520064303eefdf0f..2c220a30fcb8b93f9b6b91693c459e05e252aeea 100644 --- a/src/test/java/net/floodlightcontroller/staticflowentry/StaticFlowTests.java +++ b/src/test/java/net/floodlightcontroller/staticflowentry/StaticFlowTests.java @@ -52,11 +52,11 @@ import net.floodlightcontroller.storage.memory.MemoryStorageSource; import static net.floodlightcontroller.staticflowentry.StaticFlowEntryPusher.*; import static org.easymock.EasyMock.*; -public class StaticFlowTests extends FloodlightTestCase { - +public class StaticFlowTests extends FloodlightTestCase { + static String TestSwitch1DPID = "00:00:00:00:00:00:00:01"; static int TotalTestRules = 3; - + /*** * Create TestRuleXXX and the corresponding FlowModXXX * for X = 1..3 @@ -75,7 +75,7 @@ public class StaticFlowTests extends FloodlightTestCase { // setup actions List<OFAction> actions = new LinkedList<OFAction>(); TestRule1.put(COLUMN_ACTIONS, "output=1"); - actions.add(new OFActionOutput((short)1, (short) Short.MAX_VALUE)); + actions.add(new OFActionOutput((short)1, Short.MAX_VALUE)); // done FlowMod1.setMatch(match); FlowMod1.setActions(actions); @@ -84,7 +84,7 @@ public class StaticFlowTests extends FloodlightTestCase { FlowMod1.setPriority(Short.MAX_VALUE); FlowMod1.setLengthU(OFFlowMod.MINIMUM_LENGTH + 8); // 8 bytes of actions } - + static Map<String,Object> TestRule2; static OFFlowMod FlowMod2; @@ -100,7 +100,7 @@ public class StaticFlowTests extends FloodlightTestCase { // setup actions List<OFAction> actions = new LinkedList<OFAction>(); TestRule2.put(COLUMN_ACTIONS, "output=1"); - actions.add(new OFActionOutput((short)1, (short) Short.MAX_VALUE)); + actions.add(new OFActionOutput((short)1, Short.MAX_VALUE)); // done FlowMod2.setMatch(match); FlowMod2.setActions(actions); @@ -110,8 +110,8 @@ public class StaticFlowTests extends FloodlightTestCase { FlowMod2.setLengthU(OFFlowMod.MINIMUM_LENGTH + 8); // 8 bytes of actions } - - + + static Map<String,Object> TestRule3; static OFFlowMod FlowMod3; static { @@ -127,7 +127,7 @@ public class StaticFlowTests extends FloodlightTestCase { // setup actions TestRule3.put(COLUMN_ACTIONS, "output=controller"); List<OFAction> actions = new LinkedList<OFAction>(); - actions.add(new OFActionOutput(OFPort.OFPP_CONTROLLER.getValue(), (short) Short.MAX_VALUE)); + actions.add(new OFActionOutput(OFPort.OFPP_CONTROLLER.getValue(), Short.MAX_VALUE)); // done FlowMod3.setMatch(match); FlowMod3.setActions(actions); @@ -137,7 +137,7 @@ public class StaticFlowTests extends FloodlightTestCase { FlowMod3.setLengthU(OFFlowMod.MINIMUM_LENGTH + 8); // 8 bytes of actions } - + private void verifyFlowMod(OFFlowMod testFlowMod, OFFlowMod goodFlowMod) { verifyMatch(testFlowMod, goodFlowMod); @@ -147,7 +147,7 @@ public class StaticFlowTests extends FloodlightTestCase { // .. so we can continue to use .equals() assertEquals(goodFlowMod, testFlowMod); } - + private void verifyMatch(OFFlowMod testFlowMod, OFFlowMod goodFlowMod) { assertEquals(goodFlowMod.getMatch(), testFlowMod.getMatch()); @@ -168,13 +168,13 @@ public class StaticFlowTests extends FloodlightTestCase { } - @Override + @Override public void setUp() throws Exception { super.setUp(); } - + @Test - public void testStaticFlowPush() throws IOException { + public void testStaticFlowPush() throws IOException { StaticFlowEntryPusher staticFlowEntryPusher = new StaticFlowEntryPusher(); IStorageSourceService storage = createStorageWithFlowEntries(); long dpid = HexString.toLong(TestSwitch1DPID); @@ -192,11 +192,11 @@ public class StaticFlowTests extends FloodlightTestCase { expectLastCall().anyTimes(); mockSwitch.flush(); expectLastCall().anyTimes(); - + staticFlowEntryPusher.setStorageSource(storage); - + FloodlightModuleContext fmc = new FloodlightModuleContext(); - + MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider(); Map<Long, IOFSwitch> switchMap = new HashMap<Long, IOFSwitch>(); switchMap.put(dpid, mockSwitch); @@ -214,25 +214,25 @@ public class StaticFlowTests extends FloodlightTestCase { // verify that flowpusher read all three entries from storage assertEquals(TotalTestRules, staticFlowEntryPusher.countEntries()); - + // if someone calls mockSwitch.getOutputStream(), return mockOutStream instead - //expect(mockSwitch.getOutputStream()).andReturn(mockOutStream).anyTimes(); + //expect(mockSwitch.getOutputStream()).andReturn(mockOutStream).anyTimes(); // if someone calls getId(), return this dpid instead expect(mockSwitch.getId()).andReturn(dpid).anyTimes(); expect(mockSwitch.getStringId()).andReturn(TestSwitch1DPID).anyTimes(); replay(mockSwitch); - + // hook the static pusher up to the fake switch staticFlowEntryPusher.addedSwitch(mockSwitch); - + verify(mockSwitch); - + // Verify that the switch has gotten some flow_mods assertEquals(true, writeCapture.hasCaptured()); assertEquals(TotalTestRules, writeCapture.getValues().size()); - - // Order assumes how things are stored in hash bucket; + + // Order assumes how things are stored in hash bucket; // should be fixed because OFMessage.hashCode() is deterministic OFFlowMod firstFlowMod = (OFFlowMod) writeCapture.getValues().get(2); verifyFlowMod(firstFlowMod, FlowMod1); @@ -240,11 +240,11 @@ public class StaticFlowTests extends FloodlightTestCase { verifyFlowMod(secondFlowMod, FlowMod2); OFFlowMod thirdFlowMod = (OFFlowMod) writeCapture.getValues().get(0); verifyFlowMod(thirdFlowMod, FlowMod3); - + writeCapture.reset(); contextCapture.reset(); - - + + // delete two rules and verify they've been removed // this should invoke staticFlowPusher.rowsDeleted() storage.deleteRow(StaticFlowEntryPusher.TABLE_NAME, "TestRule1"); @@ -252,7 +252,7 @@ public class StaticFlowTests extends FloodlightTestCase { assertEquals(1, staticFlowEntryPusher.countEntries()); assertEquals(2, writeCapture.getValues().size()); - + OFFlowMod firstDelete = (OFFlowMod) writeCapture.getValues().get(0); FlowMod1.setCommand(OFFlowMod.OFPFC_DELETE_STRICT); verifyFlowMod(firstDelete, FlowMod1); @@ -260,29 +260,29 @@ public class StaticFlowTests extends FloodlightTestCase { OFFlowMod secondDelete = (OFFlowMod) writeCapture.getValues().get(1); FlowMod2.setCommand(OFFlowMod.OFPFC_DELETE_STRICT); verifyFlowMod(secondDelete, FlowMod2); - + // add rules back to make sure that staticFlowPusher.rowsInserted() works writeCapture.reset(); FlowMod2.setCommand(OFFlowMod.OFPFC_ADD); storage.insertRow(StaticFlowEntryPusher.TABLE_NAME, TestRule2); assertEquals(2, staticFlowEntryPusher.countEntries()); assertEquals(1, writeCaptureList.getValues().size()); - List<OFMessage> outList = - (List<OFMessage>) writeCaptureList.getValues().get(0); + List<OFMessage> outList = + writeCaptureList.getValues().get(0); assertEquals(1, outList.size()); OFFlowMod firstAdd = (OFFlowMod) outList.get(0); verifyFlowMod(firstAdd, FlowMod2); writeCapture.reset(); contextCapture.reset(); writeCaptureList.reset(); - + // now try an overwriting update, calling staticFlowPusher.rowUpdated() TestRule3.put(COLUMN_DL_VLAN, 333); storage.updateRow(StaticFlowEntryPusher.TABLE_NAME, TestRule3); assertEquals(2, staticFlowEntryPusher.countEntries()); assertEquals(1, writeCaptureList.getValues().size()); - outList = (List<OFMessage>) writeCaptureList.getValues().get(0); + outList = writeCaptureList.getValues().get(0); assertEquals(2, outList.size()); OFFlowMod removeFlowMod = (OFFlowMod) outList.get(0); FlowMod3.setCommand(OFFlowMod.OFPFC_DELETE_STRICT); @@ -292,14 +292,14 @@ public class StaticFlowTests extends FloodlightTestCase { OFFlowMod updateFlowMod = (OFFlowMod) outList.get(1); verifyFlowMod(updateFlowMod, FlowMod3); writeCaptureList.reset(); - + // now try an action modifying update, calling staticFlowPusher.rowUpdated() TestRule3.put(COLUMN_ACTIONS, "output=controller,strip-vlan"); // added strip-vlan storage.updateRow(StaticFlowEntryPusher.TABLE_NAME, TestRule3); assertEquals(2, staticFlowEntryPusher.countEntries()); assertEquals(1, writeCaptureList.getValues().size()); - outList = (List<OFMessage>) writeCaptureList.getValues().get(0); + outList = writeCaptureList.getValues().get(0); assertEquals(1, outList.size()); OFFlowMod modifyFlowMod = (OFFlowMod) outList.get(0); FlowMod3.setCommand(OFFlowMod.OFPFC_MODIFY_STRICT); @@ -315,7 +315,7 @@ public class StaticFlowTests extends FloodlightTestCase { IStorageSourceService createStorageWithFlowEntries() { return populateStorageWithFlowEntries(new MemoryStorageSource()); } - + IStorageSourceService populateStorageWithFlowEntries(IStorageSourceService storage) { Set<String> indexedColumns = new HashSet<String>(); indexedColumns.add(COLUMN_NAME); @@ -328,8 +328,8 @@ public class StaticFlowTests extends FloodlightTestCase { return storage; } - - @Test + + @Test public void testHARoleChanged() throws IOException { StaticFlowEntryPusher staticFlowEntryPusher = new StaticFlowEntryPusher(); IStorageSourceService storage = createStorageWithFlowEntries(); @@ -345,20 +345,20 @@ public class StaticFlowTests extends FloodlightTestCase { } staticFlowEntryPusher.restApi = restApi; staticFlowEntryPusher.startUp(null); // again, to hack unittest - + assert(staticFlowEntryPusher.entry2dpid.containsValue(TestSwitch1DPID)); assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod1)); assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod2)); assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod3)); - + // Send a notification that we've changed to slave - mfp.dispatchRoleChanged(null, Role.SLAVE); + mfp.dispatchRoleChanged(Role.SLAVE); // Make sure we've removed all our entries assert(staticFlowEntryPusher.entry2dpid.isEmpty()); assert(staticFlowEntryPusher.entriesFromStorage.isEmpty()); - + // Send a notification that we've changed to master - mfp.dispatchRoleChanged(Role.SLAVE, Role.MASTER); + mfp.dispatchRoleChanged(Role.MASTER); // Make sure we've learned the entries assert(staticFlowEntryPusher.entry2dpid.containsValue(TestSwitch1DPID)); assert(staticFlowEntryPusher.entriesFromStorage.containsValue(FlowMod1)); diff --git a/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java b/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java index 135e622054192c08f9c3bb1e07acb9a31ba92420..abe069e3502d9d45bd4f2d5b6ae02a0b67791f41 100644 --- a/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java +++ b/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java @@ -34,7 +34,8 @@ public class TopologyManagerTest extends FloodlightTestCase { protected static Logger log = LoggerFactory.getLogger(TopologyManagerTest.class); TopologyManager tm; FloodlightModuleContext fmc; - + + @Override @Before public void setUp() throws Exception { super.setUp(); @@ -50,7 +51,7 @@ public class TopologyManagerTest extends FloodlightTestCase { @Test public void testBasic1() throws Exception { - tm.addOrUpdateLink((long)1, (short)1, (long)2, (short)1, ILinkDiscovery.LinkType.DIRECT_LINK); + tm.addOrUpdateLink(1, (short)1, 2, (short)1, ILinkDiscovery.LinkType.DIRECT_LINK); assertTrue(tm.getSwitchPorts().size() == 2); // for two nodes. assertTrue(tm.getSwitchPorts().get((long)1).size()==1); assertTrue(tm.getSwitchPorts().get((long)2).size()==1); @@ -58,7 +59,7 @@ public class TopologyManagerTest extends FloodlightTestCase { assertTrue(tm.getPortBroadcastDomainLinks().size()==0); assertTrue(tm.getTunnelPorts().size()==0); - tm.addOrUpdateLink((long)1, (short)2, (long)2, (short)2, ILinkDiscovery.LinkType.MULTIHOP_LINK); + tm.addOrUpdateLink(1, (short)2, 2, (short)2, ILinkDiscovery.LinkType.MULTIHOP_LINK); assertTrue(tm.getSwitchPorts().size() == 2); // for two nodes. assertTrue(tm.getSwitchPorts().get((long)1).size()==2); assertTrue(tm.getSwitchPorts().get((long)2).size()==2); @@ -66,23 +67,23 @@ public class TopologyManagerTest extends FloodlightTestCase { assertTrue(tm.getPortBroadcastDomainLinks().size()==2); assertTrue(tm.getTunnelPorts().size()==0); - tm.removeLink((long)1, (short)2, (long)2, (short)2); + tm.removeLink(1, (short)2, 2, (short)2); assertTrue(tm.getSwitchPorts().get((long)1).size()==1); assertTrue(tm.getSwitchPorts().get((long)2).size()==1); assertTrue(tm.getSwitchPorts().size() == 2); assertTrue(tm.getSwitchPortLinks().size()==2); assertTrue(tm.getPortBroadcastDomainLinks().size()==0); - tm.removeLink((long)1, (short)1, (long)2, (short)1); - assertTrue(tm.getSwitchPorts().size() == 0); + tm.removeLink(1, (short)1, 2, (short)1); + assertTrue(tm.getSwitchPorts().size() == 0); assertTrue(tm.getSwitchPortLinks().size()==0); assertTrue(tm.getPortBroadcastDomainLinks().size()==0); } @Test public void testBasic2() throws Exception { - tm.addOrUpdateLink((long)1, (short)1, (long)2, (short)1, ILinkDiscovery.LinkType.DIRECT_LINK); - tm.addOrUpdateLink((long)2, (short)2, (long)3, (short)1, ILinkDiscovery.LinkType.MULTIHOP_LINK); + tm.addOrUpdateLink(1, (short)1, 2, (short)1, ILinkDiscovery.LinkType.DIRECT_LINK); + tm.addOrUpdateLink(2, (short)2, 3, (short)1, ILinkDiscovery.LinkType.MULTIHOP_LINK); assertTrue(tm.getSwitchPorts().size() == 3); // for two nodes. assertTrue(tm.getSwitchPorts().get((long)1).size()==1); assertTrue(tm.getSwitchPorts().get((long)2).size()==2); @@ -90,7 +91,7 @@ public class TopologyManagerTest extends FloodlightTestCase { assertTrue(tm.getSwitchPortLinks().size()==4); assertTrue(tm.getPortBroadcastDomainLinks().size()==2); - tm.removeLink((long)1, (short)1, (long)2, (short)1); + tm.removeLink(1, (short)1, 2, (short)1); assertTrue(tm.getSwitchPorts().size() == 2); assertTrue(tm.getSwitchPorts().get((long)1) == null); assertTrue(tm.getSwitchPorts().get((long)2).size()==1); @@ -99,7 +100,7 @@ public class TopologyManagerTest extends FloodlightTestCase { assertTrue(tm.getPortBroadcastDomainLinks().size()==2); // nonexistent link // no null pointer exceptions. - tm.removeLink((long)3, (short)1, (long)2, (short)2); + tm.removeLink(3, (short)1, 2, (short)2); assertTrue(tm.getSwitchPorts().size() == 2); assertTrue(tm.getSwitchPorts().get((long)1) == null); assertTrue(tm.getSwitchPorts().get((long)2).size()==1); @@ -107,7 +108,7 @@ public class TopologyManagerTest extends FloodlightTestCase { assertTrue(tm.getSwitchPortLinks().size()==2); assertTrue(tm.getPortBroadcastDomainLinks().size()==2); - tm.removeLink((long)3, (short)2, (long)1, (short)2); + tm.removeLink(3, (short)2, 1, (short)2); assertTrue(tm.getSwitchPorts().size() == 2); assertTrue(tm.getSwitchPorts().get((long)1)==null); assertTrue(tm.getSwitchPorts().get((long)2).size()==1); @@ -115,7 +116,7 @@ public class TopologyManagerTest extends FloodlightTestCase { assertTrue(tm.getSwitchPortLinks().size()==2); assertTrue(tm.getPortBroadcastDomainLinks().size()==2); - tm.removeLink((long)2, (short)2, (long)3, (short)1); + tm.removeLink(2, (short)2, 3, (short)1); assertTrue(tm.getSwitchPorts().size() == 0); // for two nodes. assertTrue(tm.getSwitchPortLinks().size()==0); assertTrue(tm.getPortBroadcastDomainLinks().size()==0); @@ -125,7 +126,7 @@ public class TopologyManagerTest extends FloodlightTestCase { @Test public void testHARoleChange() throws Exception { testBasic2(); - getMockFloodlightProvider().dispatchRoleChanged(null, Role.SLAVE); + getMockFloodlightProvider().dispatchRoleChanged(Role.SLAVE); assertTrue(tm.switchPorts.isEmpty()); assertTrue(tm.switchPortLinks.isEmpty()); assertTrue(tm.portBroadcastDomainLinks.isEmpty());