@Override
public void receive(ISwitch sw, OFMessage msg) {
- try {
- if (msg instanceof OFPortStatus) {
- handlePortStatusMessage(sw, (OFPortStatus) msg);
- }
- } catch (ConstructionException e) {
- logger.error("",e);
+ if (msg instanceof OFPortStatus) {
+ handlePortStatusMessage(sw, (OFPortStatus) msg);
}
return;
}
- protected void handlePortStatusMessage(ISwitch sw, OFPortStatus m)
- throws ConstructionException {
+ protected void handlePortStatusMessage(ISwitch sw, OFPortStatus m) {
Node node = NodeCreator.createOFNode(sw.getId());
- NodeConnector nodeConnector = PortConverter.toNodeConnector(m.getDesc()
- .getPortNumber(), node);
- UpdateType type = null;
+ NodeConnector nodeConnector = PortConverter.toNodeConnector(
+ m.getDesc().getPortNumber(), node);
+ UpdateType type = null;
if (m.getReason() == (byte) OFPortReason.OFPPR_ADD.ordinal()) {
type = UpdateType.ADDED;
} else if (m.getReason() == (byte) OFPortReason.OFPPR_DELETE.ordinal()) {
if (type != null) {
// get node connector properties
- Set<Property> props = InventoryServiceHelper.OFPortToProps(m
- .getDesc());
+ Set<Property> props = InventoryServiceHelper.OFPortToProps(m.getDesc());
notifyInventoryShimListener(nodeConnector, type, props);
}
}
package org.opendaylight.controller.protocol_plugin.openflow.internal;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ConcurrentSkipListSet;
import org.opendaylight.controller.protocol_plugin.openflow.IOFStatisticsListener;
import org.opendaylight.controller.protocol_plugin.openflow.IOFStatisticsManager;
switch (type) {
case ADDED:
if (!containerToNc.containsKey(containerName)) {
- containerToNc.put(containerName, new ConcurrentSkipListSet<NodeConnector>());
+ containerToNc.put(containerName,
+ Collections.newSetFromMap(new ConcurrentHashMap<NodeConnector,Boolean>()));
}
containerToNc.get(containerName).add(p);
if (!containerToNode.containsKey(containerName)) {
nodeSet.remove(node);
}
}
-
}
break;
case CHANGED:
public String getHelp() {
StringBuffer help = new StringBuffer();
help.append("---SAL Reader testing commands---\n");
- help
- .append("\t readflows <sid> <cached> - Read all the (cached) flows from the openflow switch <sid>\n");
- help
- .append("\t readflow <sid> <cached> - Read the (cached) sample flow from the openflow switch <sid>\n");
- help
- .append("\t readdesc <sid> <cached> - Read the (cached) description from openflow switch <sid>\n");
- help
- .append("\t cached=true/false. If false or not specified, the protocol plugin cached info\n");
- help
- .append("\t is returned. If true, the info is directly retrieved from the switch\n");
+ help.append("\t readflows <sid> <cached> - Read all the (cached) flows from the openflow switch <sid>\n");
+ help.append("\t readflow <sid> <cached> - Read the (cached) sample flow from the openflow switch <sid>\n");
+ help.append("\t readdescr <sid> <cached> - Read the (cached) description from openflow switch <sid>\n");
+ help.append("\t\t cached = (true|false). If false or not specified, the plugin cached info\n");
+ help.append("\t\t is returned. If true, the info is directly retrieved from the switch\n");
+ help.append("\t readport <sid> <port> - Read port statistics for the specified port\n");
+ help.append("\t readports <sid> - Read port statistics for all ports of specified switch\n");
+ help.append("\t readtable <sid> <tableid>- Read specified table statistics\n");
+
return help.toString();
}