Cleaned up the code further after removing the storage framework
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index 7f788b1..084d6c4 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -194,48 +194,6 @@
// Flag to always flush flow table on switch reconnect (HA or otherwise)
protected boolean alwaysClearFlowsOnSwAdd = false;
- /*
- // Storage table names
- protected static final String CONTROLLER_TABLE_NAME = "controller_controller";
- protected static final String CONTROLLER_ID = "id";
-
- protected static final String SWITCH_TABLE_NAME = "controller_switch";
- protected static final String SWITCH_DATAPATH_ID = "dpid";
- protected static final String SWITCH_SOCKET_ADDRESS = "socket_address";
- protected static final String SWITCH_IP = "ip";
- protected static final String SWITCH_CONTROLLER_ID = "controller_id";
- protected static final String SWITCH_ACTIVE = "active";
- protected static final String SWITCH_CONNECTED_SINCE = "connected_since";
- protected static final String SWITCH_CAPABILITIES = "capabilities";
- protected static final String SWITCH_BUFFERS = "buffers";
- protected static final String SWITCH_TABLES = "tables";
- protected static final String SWITCH_ACTIONS = "actions";
-
- protected static final String SWITCH_CONFIG_TABLE_NAME = "controller_switchconfig";
- protected static final String SWITCH_CONFIG_CORE_SWITCH = "core_switch";
-
- protected static final String PORT_TABLE_NAME = "controller_port";
- protected static final String PORT_ID = "id";
- protected static final String PORT_SWITCH = "switch_id";
- protected static final String PORT_NUMBER = "number";
- protected static final String PORT_HARDWARE_ADDRESS = "hardware_address";
- protected static final String PORT_NAME = "name";
- protected static final String PORT_CONFIG = "config";
- protected static final String PORT_STATE = "state";
- protected static final String PORT_CURRENT_FEATURES = "current_features";
- protected static final String PORT_ADVERTISED_FEATURES = "advertised_features";
- protected static final String PORT_SUPPORTED_FEATURES = "supported_features";
- protected static final String PORT_PEER_FEATURES = "peer_features";
-
- protected static final String CONTROLLER_INTERFACE_TABLE_NAME = "controller_controllerinterface";
- protected static final String CONTROLLER_INTERFACE_ID = "id";
- protected static final String CONTROLLER_INTERFACE_CONTROLLER_ID = "controller_id";
- protected static final String CONTROLLER_INTERFACE_TYPE = "type";
- protected static final String CONTROLLER_INTERFACE_NUMBER = "number";
- protected static final String CONTROLLER_INTERFACE_DISCOVERED_IP = "discovered_ip";
- */
-
-
// Perf. related configuration
protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024;
protected static final int BATCH_MAX_SIZE = 100;
@@ -583,10 +541,6 @@
explanation="Could not parse a message from the switch",
recommendation=LogMessageDoc.CHECK_SWITCH),
@LogMessageDoc(level="ERROR",
- message="Terminating controller due to storage exception",
- explanation=ERROR_DATABASE,
- recommendation=LogMessageDoc.CHECK_CONTROLLER),
- @LogMessageDoc(level="ERROR",
message="Could not process message: queue full",
explanation="OpenFlow messages are arriving faster than " +
" the controller can process them.",
@@ -1759,227 +1713,6 @@
// Initialization
// **************
- /*
- protected void updateAllInactiveSwitchInfo() {
- if (role == Role.SLAVE) {
- return;
- }
- String controllerId = getControllerId();
- String[] switchColumns = { SWITCH_DATAPATH_ID,
- SWITCH_CONTROLLER_ID,
- SWITCH_ACTIVE };
- String[] portColumns = { PORT_ID, PORT_SWITCH };
- IResultSet switchResultSet = null;
- try {
- OperatorPredicate op =
- new OperatorPredicate(SWITCH_CONTROLLER_ID,
- OperatorPredicate.Operator.EQ,
- controllerId);
- switchResultSet =
- storageSource.executeQuery(SWITCH_TABLE_NAME,
- switchColumns,
- op, null);
- while (switchResultSet.next()) {
- IResultSet portResultSet = null;
- try {
- String datapathId =
- switchResultSet.getString(SWITCH_DATAPATH_ID);
- switchResultSet.setBoolean(SWITCH_ACTIVE, Boolean.FALSE);
- op = new OperatorPredicate(PORT_SWITCH,
- OperatorPredicate.Operator.EQ,
- datapathId);
- portResultSet =
- storageSource.executeQuery(PORT_TABLE_NAME,
- portColumns,
- op, null);
- while (portResultSet.next()) {
- portResultSet.deleteRow();
- }
- portResultSet.save();
- }
- finally {
- if (portResultSet != null)
- portResultSet.close();
- }
- }
- switchResultSet.save();
- }
- finally {
- if (switchResultSet != null)
- switchResultSet.close();
- }
- }
- */
-
- /*
- protected void updateControllerInfo() {
- updateAllInactiveSwitchInfo();
-
- // Write out the controller info to the storage source
- Map<String, Object> controllerInfo = new HashMap<String, Object>();
- String id = getControllerId();
- controllerInfo.put(CONTROLLER_ID, id);
- storageSource.updateRow(CONTROLLER_TABLE_NAME, controllerInfo);
- }
- */
-
- /*
- protected void updateActiveSwitchInfo(IOFSwitch sw) {
- if (role == Role.SLAVE) {
- return;
- }
- // Obtain the row info for the switch
- Map<String, Object> switchInfo = new HashMap<String, Object>();
- String datapathIdString = sw.getStringId();
- switchInfo.put(SWITCH_DATAPATH_ID, datapathIdString);
- String controllerId = getControllerId();
- switchInfo.put(SWITCH_CONTROLLER_ID, controllerId);
- Date connectedSince = sw.getConnectedSince();
- switchInfo.put(SWITCH_CONNECTED_SINCE, connectedSince);
- Channel channel = sw.getChannel();
- SocketAddress socketAddress = channel.getRemoteAddress();
- if (socketAddress != null) {
- String socketAddressString = socketAddress.toString();
- switchInfo.put(SWITCH_SOCKET_ADDRESS, socketAddressString);
- if (socketAddress instanceof InetSocketAddress) {
- InetSocketAddress inetSocketAddress =
- (InetSocketAddress)socketAddress;
- InetAddress inetAddress = inetSocketAddress.getAddress();
- String ip = inetAddress.getHostAddress();
- switchInfo.put(SWITCH_IP, ip);
- }
- }
-
- // Write out the switch features info
- long capabilities = U32.f(sw.getCapabilities());
- switchInfo.put(SWITCH_CAPABILITIES, capabilities);
- long buffers = U32.f(sw.getBuffers());
- switchInfo.put(SWITCH_BUFFERS, buffers);
- long tables = U32.f(sw.getTables());
- switchInfo.put(SWITCH_TABLES, tables);
- long actions = U32.f(sw.getActions());
- switchInfo.put(SWITCH_ACTIONS, actions);
- switchInfo.put(SWITCH_ACTIVE, Boolean.TRUE);
-
- // Update the switch
- storageSource.updateRowAsync(SWITCH_TABLE_NAME, switchInfo);
-
- // Update the ports
- for (OFPhysicalPort port: sw.getPorts()) {
- updatePortInfo(sw, port);
- }
- }
- */
-
- /*
- protected void updateInactiveSwitchInfo(IOFSwitch sw) {
- if (role == Role.SLAVE) {
- return;
- }
- log.debug("Update DB with inactiveSW {}", sw);
- // Update the controller info in the storage source to be inactive
- Map<String, Object> switchInfo = new HashMap<String, Object>();
- String datapathIdString = sw.getStringId();
- switchInfo.put(SWITCH_DATAPATH_ID, datapathIdString);
- //switchInfo.put(SWITCH_CONNECTED_SINCE, null);
- switchInfo.put(SWITCH_ACTIVE, Boolean.FALSE);
- storageSource.updateRowAsync(SWITCH_TABLE_NAME, switchInfo);
- }
- */
-
- /*
- protected void updatePortInfo(IOFSwitch sw, OFPhysicalPort port) {
- if (role == Role.SLAVE) {
- return;
- }
- String datapathIdString = sw.getStringId();
- Map<String, Object> portInfo = new HashMap<String, Object>();
- int portNumber = U16.f(port.getPortNumber());
- String id = datapathIdString + "|" + portNumber;
- portInfo.put(PORT_ID, id);
- portInfo.put(PORT_SWITCH, datapathIdString);
- portInfo.put(PORT_NUMBER, portNumber);
- byte[] hardwareAddress = port.getHardwareAddress();
- String hardwareAddressString = HexString.toHexString(hardwareAddress);
- portInfo.put(PORT_HARDWARE_ADDRESS, hardwareAddressString);
- String name = port.getName();
- portInfo.put(PORT_NAME, name);
- long config = U32.f(port.getConfig());
- portInfo.put(PORT_CONFIG, config);
- long state = U32.f(port.getState());
- portInfo.put(PORT_STATE, state);
- long currentFeatures = U32.f(port.getCurrentFeatures());
- portInfo.put(PORT_CURRENT_FEATURES, currentFeatures);
- long advertisedFeatures = U32.f(port.getAdvertisedFeatures());
- portInfo.put(PORT_ADVERTISED_FEATURES, advertisedFeatures);
- long supportedFeatures = U32.f(port.getSupportedFeatures());
- portInfo.put(PORT_SUPPORTED_FEATURES, supportedFeatures);
- long peerFeatures = U32.f(port.getPeerFeatures());
- portInfo.put(PORT_PEER_FEATURES, peerFeatures);
- storageSource.updateRowAsync(PORT_TABLE_NAME, portInfo);
- }
- */
-
- /**
- * Read switch port data from storage and write it into a switch object
- * @param sw the switch to update
- */
- /*
- protected void readSwitchPortStateFromStorage(OFSwitchImpl sw) {
- OperatorPredicate op =
- new OperatorPredicate(PORT_SWITCH,
- OperatorPredicate.Operator.EQ,
- sw.getStringId());
- IResultSet portResultSet =
- storageSource.executeQuery(PORT_TABLE_NAME,
- null, op, null);
- //Map<Short, OFPhysicalPort> oldports =
- // new HashMap<Short, OFPhysicalPort>();
- //oldports.putAll(sw.getPorts());
-
- while (portResultSet.next()) {
- try {
- OFPhysicalPort p = new OFPhysicalPort();
- p.setPortNumber((short)portResultSet.getInt(PORT_NUMBER));
- p.setName(portResultSet.getString(PORT_NAME));
- p.setConfig((int)portResultSet.getLong(PORT_CONFIG));
- p.setState((int)portResultSet.getLong(PORT_STATE));
- String portMac = portResultSet.getString(PORT_HARDWARE_ADDRESS);
- p.setHardwareAddress(HexString.fromHexString(portMac));
- p.setCurrentFeatures((int)portResultSet.
- getLong(PORT_CURRENT_FEATURES));
- p.setAdvertisedFeatures((int)portResultSet.
- getLong(PORT_ADVERTISED_FEATURES));
- p.setSupportedFeatures((int)portResultSet.
- getLong(PORT_SUPPORTED_FEATURES));
- p.setPeerFeatures((int)portResultSet.
- getLong(PORT_PEER_FEATURES));
- //oldports.remove(Short.valueOf(p.getPortNumber()));
- sw.setPort(p);
- } catch (NullPointerException e) {
- // ignore
- }
- }
- SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.PORTCHANGED);
- try {
- this.updates.put(update);
- } catch (InterruptedException e) {
- log.error("Failure adding update to queue", e);
- }
- }
- */
-
- /*
- protected void removePortInfo(IOFSwitch sw, short portNumber) {
- if (role == Role.SLAVE) {
- return;
- }
- String datapathIdString = sw.getStringId();
- String id = datapathIdString + "|" + portNumber;
- storageSource.deleteRowAsync(PORT_TABLE_NAME, id);
- }
- */
-
/**
* Sets the initial role based on properties in the config params.
* It looks for two different properties.
@@ -2180,7 +1913,6 @@
this.factory = new BasicFactory();
this.providerMap = new HashMap<String, List<IInfoProvider>>();
setConfigParams(configParams);
- //this.role = getInitialRole(configParams);
//Set the controller's role to MASTER so it always tries to do role requests.
this.role = Role.MASTER;
this.roleChanger = new RoleChanger();
@@ -2199,40 +1931,9 @@
public void startupComponents() {
try {
registryService.registerController(controllerId);
- } catch (RegistryException e2) {
- log.warn("Registry service error: {}", e2.getMessage());
+ } catch (RegistryException e) {
+ log.warn("Registry service error: {}", e.getMessage());
}
-
- /*
- // Create the table names we use
- storageSource.createTable(CONTROLLER_TABLE_NAME, null);
- storageSource.createTable(SWITCH_TABLE_NAME, null);
- storageSource.createTable(PORT_TABLE_NAME, null);
- storageSource.createTable(CONTROLLER_INTERFACE_TABLE_NAME, null);
- storageSource.createTable(SWITCH_CONFIG_TABLE_NAME, null);
- storageSource.setTablePrimaryKeyName(CONTROLLER_TABLE_NAME,
- CONTROLLER_ID);
- storageSource.setTablePrimaryKeyName(SWITCH_TABLE_NAME,
- SWITCH_DATAPATH_ID);
- storageSource.setTablePrimaryKeyName(PORT_TABLE_NAME, PORT_ID);
- storageSource.setTablePrimaryKeyName(CONTROLLER_INTERFACE_TABLE_NAME,
- CONTROLLER_INTERFACE_ID);
- storageSource.addListener(CONTROLLER_INTERFACE_TABLE_NAME, this);
-
- while (true) {
- try {
- updateControllerInfo();
- break;
- }
- catch (StorageException e) {
- log.info("Waiting for storage source");
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e1) {
- }
- }
- }
- */
// Add our REST API
restApi.addRestletRoutable(new CoreWebRoutable());
@@ -2277,71 +1978,6 @@
this.haListeners.remove(listener);
}
-
- /**
- * Handle changes to the controller nodes IPs and dispatch update.
- */
- /*
- @SuppressWarnings("unchecked")
- protected void handleControllerNodeIPChanges() {
- HashMap<String,String> curControllerNodeIPs = new HashMap<String,String>();
- HashMap<String,String> addedControllerNodeIPs = new HashMap<String,String>();
- HashMap<String,String> removedControllerNodeIPs =new HashMap<String,String>();
- String[] colNames = { CONTROLLER_INTERFACE_CONTROLLER_ID,
- CONTROLLER_INTERFACE_TYPE,
- CONTROLLER_INTERFACE_NUMBER,
- CONTROLLER_INTERFACE_DISCOVERED_IP };
- synchronized(controllerNodeIPsCache) {
- // We currently assume that interface Ethernet0 is the relevant
- // controller interface. Might change.
- // We could (should?) implement this using
- // predicates, but creating the individual and compound predicate
- // seems more overhead then just checking every row. Particularly,
- // since the number of rows is small and changes infrequent
- IResultSet res = storageSource.executeQuery(CONTROLLER_INTERFACE_TABLE_NAME,
- colNames,null, null);
- while (res.next()) {
- if (res.getString(CONTROLLER_INTERFACE_TYPE).equals("Ethernet") &&
- res.getInt(CONTROLLER_INTERFACE_NUMBER) == 0) {
- String controllerID = res.getString(CONTROLLER_INTERFACE_CONTROLLER_ID);
- String discoveredIP = res.getString(CONTROLLER_INTERFACE_DISCOVERED_IP);
- String curIP = controllerNodeIPsCache.get(controllerID);
-
- curControllerNodeIPs.put(controllerID, discoveredIP);
- if (curIP == null) {
- // new controller node IP
- addedControllerNodeIPs.put(controllerID, discoveredIP);
- }
- else if (!curIP.equals(discoveredIP)) {
- // IP changed
- removedControllerNodeIPs.put(controllerID, curIP);
- addedControllerNodeIPs.put(controllerID, discoveredIP);
- }
- }
- }
- // Now figure out if rows have been deleted. We can't use the
- // rowKeys from rowsDeleted directly, since the tables primary
- // key is a compound that we can't disassemble
- Set<String> curEntries = curControllerNodeIPs.keySet();
- Set<String> removedEntries = controllerNodeIPsCache.keySet();
- removedEntries.removeAll(curEntries);
- for (String removedControllerID : removedEntries)
- removedControllerNodeIPs.put(removedControllerID, controllerNodeIPsCache.get(removedControllerID));
- controllerNodeIPsCache = (HashMap<String, String>) curControllerNodeIPs.clone();
- HAControllerNodeIPUpdate update = new HAControllerNodeIPUpdate(
- curControllerNodeIPs, addedControllerNodeIPs,
- removedControllerNodeIPs);
- if (!removedControllerNodeIPs.isEmpty() || !addedControllerNodeIPs.isEmpty()) {
- try {
- this.updates.put(update);
- } catch (InterruptedException e) {
- log.error("Failure adding update to queue", e);
- }
- }
- }
- }
- */
-
@Override
public Map<String, String> getControllerNodeIPs() {
// We return a copy of the mapping so we can guarantee that
@@ -2354,23 +1990,6 @@
return retval;
}
- /*
- @Override
- public void rowsModified(String tableName, Set<Object> rowKeys) {
- if (tableName.equals(CONTROLLER_INTERFACE_TABLE_NAME)) {
- handleControllerNodeIPChanges();
- }
-
- }
-
- @Override
- public void rowsDeleted(String tableName, Set<Object> rowKeys) {
- if (tableName.equals(CONTROLLER_INTERFACE_TABLE_NAME)) {
- handleControllerNodeIPChanges();
- }
- }
- */
-
@Override
public long getSystemStartTime() {
return (this.systemStartTime);
diff --git a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index 1a890cb..7716781 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -121,22 +121,6 @@
protected IFloodlightProviderService controller;
protected final static Logger log = LoggerFactory.getLogger(LinkDiscoveryManager.class);
- /*
- // Names of table/fields for links in the storage API
- private static final String LINK_TABLE_NAME = "controller_link";
- 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";
- private static final String SWITCH_CONFIG_CORE_SWITCH = "core_switch";
- */
-
protected IFloodlightProviderService floodlightProvider;
protected IThreadPoolService threadPool;
protected IRestApiService restApi;
@@ -239,26 +223,24 @@
recommendation=LogMessageDoc.GENERIC_ACTION)
@Override
public void dispatch() {
- if (linkDiscoveryAware != null) {
- if (log.isTraceEnabled()) {
- log.trace("Dispatching link discovery update {} {} {} {} {} for {}",
- new Object[]{this.getOperation(),
- HexString.toHexString(this.getSrc()), this.getSrcPort(),
- HexString.toHexString(this.getDst()), this.getDstPort(),
- linkDiscoveryAware});
- }
- try {
- for (ILinkDiscoveryListener lda : linkDiscoveryAware) { // order maintained
- lda.linkDiscoveryUpdate(this);
- }
- }
- catch (Exception e) {
- log.error("Error in link discovery updates loop", e);
- }
- }
-
+ if (linkDiscoveryAware != null) {
+ if (log.isTraceEnabled()) {
+ log.trace("Dispatching link discovery update {} {} {} {} {} for {}",
+ new Object[]{this.getOperation(),
+ HexString.toHexString(this.getSrc()), this.getSrcPort(),
+ HexString.toHexString(this.getDst()), this.getDstPort(),
+ linkDiscoveryAware});
+ }
+ try {
+ for (ILinkDiscoveryListener lda : linkDiscoveryAware) { // order maintained
+ lda.linkDiscoveryUpdate(this);
+ }
+ }
+ catch (Exception e) {
+ log.error("Error in link discovery updates loop", e);
+ }
+ }
}
-
}
/**
@@ -1561,105 +1543,6 @@
}
}
- // STORAGE METHODS
- /**
- * Deletes all links from storage
- */
- /*
- void clearAllLinks() {
- storageSource.deleteRowsAsync(LINK_TABLE_NAME, null);
- }
- */
-
- /**
- * Gets the storage key for a LinkTuple
- * @param lt The LinkTuple to get
- * @return The storage key as a String
- */
- private String getLinkId(Link lt) {
- return HexString.toHexString(lt.getSrc()) +
- "-" + lt.getSrcPort() + "-" +
- HexString.toHexString(lt.getDst())+
- "-" + lt.getDstPort();
- }
-
- /**
- * Writes a LinkTuple and corresponding LinkInfo to storage
- * @param lt The LinkTuple to write
- * @param linkInfo The LinkInfo to write
- */
- /*
- protected void writeLinkToStorage(Link lt, LinkInfo linkInfo) {
- LinkType type = getLinkType(lt, linkInfo);
-
- // Write only direct links. Do not write links to external
- // L2 network.
- // if (type != LinkType.DIRECT_LINK && type != LinkType.TUNNEL) {
- // return;
- // }
-
- Map<String, Object> rowValues = new HashMap<String, Object>();
- String id = getLinkId(lt);
- rowValues.put(LINK_ID, id);
- rowValues.put(LINK_VALID_TIME, linkInfo.getUnicastValidTime());
- String srcDpid = HexString.toHexString(lt.getSrc());
- rowValues.put(LINK_SRC_SWITCH, srcDpid);
- rowValues.put(LINK_SRC_PORT, lt.getSrcPort());
-
- if (type == LinkType.DIRECT_LINK)
- rowValues.put(LINK_TYPE, "internal");
- else if (type == LinkType.MULTIHOP_LINK)
- rowValues.put(LINK_TYPE, "external");
- else if (type == LinkType.TUNNEL)
- rowValues.put(LINK_TYPE, "tunnel");
- 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);
- }
- */
-
- /**
- * Removes a link from storage using an asynchronous call.
- * @param lt The LinkTuple to delete.
- */
- /*
- protected void removeLinkFromStorage(Link lt) {
- String id = getLinkId(lt);
- storageSource.deleteRowAsync(LINK_TABLE_NAME, id);
- }
- */
-
@Override
public void addListener(ILinkDiscoveryListener listener) {
linkDiscoveryAware.add(listener);
@@ -1693,76 +1576,6 @@
return false;
}
- /*
- @Override
- public void rowsModified(String tableName, Set<Object> rowKeys) {
- Map<Long, IOFSwitch> switches = floodlightProvider.getSwitches();
- ArrayList<IOFSwitch> updated_switches = new ArrayList<IOFSwitch>();
- for(Object key: rowKeys) {
- Long swId = new Long(HexString.toLong((String)key));
- if (switches.containsKey(swId)) {
- IOFSwitch sw = switches.get(swId);
- boolean curr_status = sw.hasAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH);
- boolean new_status = false;
- IResultSet resultSet = null;
-
- try {
- resultSet = storageSource.getRow(tableName, key);
- for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
- // In case of multiple rows, use the status in last row?
- Map<String, Object> row = it.next().getRow();
- if (row.containsKey(SWITCH_CONFIG_CORE_SWITCH)) {
- new_status = ((String)row.get(SWITCH_CONFIG_CORE_SWITCH)).equals("true");
- }
- }
- }
- finally {
- if (resultSet != null)
- resultSet.close();
- }
-
- if (curr_status != new_status) {
- updated_switches.add(sw);
- }
- } else {
- if (log.isTraceEnabled()) {
- log.trace("Update for switch which has no entry in switch " +
- "list (dpid={}), a delete action.", (String)key);
- }
- }
- }
-
- for (IOFSwitch sw : updated_switches) {
- // Set SWITCH_IS_CORE_SWITCH to it's inverse value
- if (sw.hasAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH)) {
- sw.removeAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH);
- if (log.isTraceEnabled()) {
- log.trace("SWITCH_IS_CORE_SWITCH set to False for {}", sw);
- }
- LinkUpdate update = new LinkUpdate(new LDUpdate(sw.getId(), SwitchType.BASIC_SWITCH,
- UpdateOperation.SWITCH_UPDATED));
- controller.publishUpdate(update);
- }
- else {
- sw.setAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH, new Boolean(true));
- if (log.isTraceEnabled()) {
- log.trace("SWITCH_IS_CORE_SWITCH set to True for {}", sw);
- }
- LinkUpdate update = new LinkUpdate(new LDUpdate(sw.getId(), SwitchType.CORE_SWITCH,
- UpdateOperation.SWITCH_UPDATED));
- controller.publishUpdate(update);
- }
- }
- }
- */
-
- /*
- @Override
- public void rowsDeleted(String tableName, Set<Object> rowKeys) {
- // Ignore delete events, the switch delete will do the right thing on it's own
- }
- */
-
// IFloodlightModule classes
@Override
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index a3f3859..48dfcfb 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -32,7 +32,6 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;
@@ -116,9 +115,6 @@
controller = (Controller)cm.getServiceImpls().get(IFloodlightProviderService.class);
fmc.addService(IFloodlightProviderService.class, controller);
- //MemoryStorageSource memstorage = new MemoryStorageSource();
- //fmc.addService(IStorageSourceService.class, memstorage);
-
RestApiServer restApi = new RestApiServer();
fmc.addService(IRestApiService.class, restApi);
@@ -141,13 +137,11 @@
ppt.init(fmc);
restApi.init(fmc);
- //memstorage.init(fmc);
cm.init(fmc);
tp.init(fmc);
sr.init(fmc);
ppt.startUp(fmc);
restApi.startUp(fmc);
- //memstorage.startUp(fmc);
cm.startUp(fmc);
tp.startUp(fmc);
sr.startUp(fmc);
@@ -480,19 +474,6 @@
switchListener.nPortChanged == 1);
}
}
-
- /*
- private Map<String,Object> getFakeControllerIPRow(String id, String controllerId,
- String type, int number, String discoveredIP ) {
- HashMap<String, Object> row = new HashMap<String,Object>();
- row.put(Controller.CONTROLLER_INTERFACE_ID, id);
- row.put(Controller.CONTROLLER_INTERFACE_CONTROLLER_ID, controllerId);
- row.put(Controller.CONTROLLER_INTERFACE_TYPE, type);
- row.put(Controller.CONTROLLER_INTERFACE_NUMBER, number);
- row.put(Controller.CONTROLLER_INTERFACE_DISCOVERED_IP, discoveredIP);
- return row;
- }
- */
/**
* Test notifications for controller node IP changes. This requires
diff --git a/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java b/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
index 6bef8c1..d938abe 100644
--- a/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
+++ b/src/test/java/net/floodlightcontroller/core/module/FloodlightTestModuleLoader.java
@@ -19,8 +19,6 @@
protected final static Logger log = LoggerFactory.getLogger(FloodlightTestModuleLoader.class);
// List of default modules to use unless specified otherwise
- //public static final Class<? extends IFloodlightModule> DEFAULT_STORAGE_SOURCE =
- //MemoryStorageSource.class;
public static final Class<? extends IFloodlightModule> DEFAULT_FLOODLIGHT_PRPOVIDER =
MockFloodlightProvider.class;
public static final Class<? extends IFloodlightModule> DEFAULT_TOPOLOGY_PROVIDER =
@@ -42,7 +40,6 @@
DEFAULT_MODULE_LIST = new ArrayList<Class<? extends IFloodlightModule>>();
DEFAULT_MODULE_LIST.add(DEFAULT_DEVICE_SERVICE);
DEFAULT_MODULE_LIST.add(DEFAULT_FLOODLIGHT_PRPOVIDER);
- //DEFAULT_MODULE_LIST.add(DEFAULT_STORAGE_SOURCE);
DEFAULT_MODULE_LIST.add(DEFAULT_TOPOLOGY_PROVIDER);
DEFAULT_MODULE_LIST.add(DEFAULT_COUNTER_STORE);
DEFAULT_MODULE_LIST.add(DEFAULT_THREADPOOL);
diff --git a/src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
index b2689a4..cb6c607 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
@@ -73,13 +73,6 @@
isSendLLDPsCalled = false;
isClearLinksCalled = false;
}
-
- /*
- @Override
- protected void clearAllLinks() {
- isClearLinksCalled = true;
- super.clearAllLinks();
- }*/
}
public LinkDiscoveryManager getTopology() {
@@ -106,7 +99,6 @@
cntx.addService(IRoutingService.class, routingEngine);
cntx.addService(ILinkDiscoveryService.class, ldm);
cntx.addService(ITopologyService.class, ldm);
- //cntx.addService(IStorageSourceService.class, new MemoryStorageSource());
cntx.addService(IFloodlightProviderService.class, getMockFloodlightProvider());
restApi.init(cntx);
tp.init(cntx);
@@ -426,7 +418,6 @@
getMockFloodlightProvider().dispatchRoleChanged(Role.SLAVE, Role.MASTER);
// check that lldps were sent
assertTrue(ldm.isSendLLDPsCalled);
- //assertTrue(ldm.isClearLinksCalled);
ldm.reset();
}
}