Thomas Vachuska
Committed by Gerrit Code Review

Demoting boy-cried-wolf log messages.

Change-Id: Idfb9b3178b79ab6b30af285c10a52b9f20dfbfe1
......@@ -581,7 +581,6 @@ public class DeviceManager
@Override
public void event(MastershipEvent event) {
if (event.type() != MastershipEvent.Type.MASTER_CHANGED) {
// Don't care if backup list changed.
return;
......@@ -625,7 +624,7 @@ public class DeviceManager
if (store.getDevice(did) != null) {
reassertRole(did, myNextRole);
} else {
log.warn("Device is not yet/no longer in the store: {}", did);
log.debug("Device is not yet/no longer in the store: {}", did);
}
}
}
......
......@@ -207,7 +207,7 @@ public class Controller {
Driver driver = driverService
.getDriver(desc.getMfrDesc(), desc.getHwDesc(), desc.getSwDesc());
if (driver.hasBehaviour(OpenFlowSwitchDriver.class)) {
if (driver != null && driver.hasBehaviour(OpenFlowSwitchDriver.class)) {
OpenFlowSwitchDriver ofSwitchDriver = driver.createBehaviour(new DefaultDriverHandler(
new DefaultDriverData(driver)), OpenFlowSwitchDriver.class);
ofSwitchDriver.init(new Dpid(dpid), desc, ofv);
......
......@@ -25,6 +25,7 @@ import org.apache.felix.scr.annotations.Modified;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
import org.onosproject.net.driver.DefaultDriverProviderService;
import org.onosproject.net.driver.DriverService;
import org.onosproject.openflow.controller.DefaultOpenFlowPacketContext;
import org.onosproject.openflow.controller.Dpid;
......@@ -81,6 +82,10 @@ public class OpenFlowControllerImpl implements OpenFlowController {
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DriverService driverService;
// References exists merely for sequencing purpose to assure drivers are loaded
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected DefaultDriverProviderService defaultDriverProviderService;
private final ExecutorService executorMsgs =
Executors.newFixedThreadPool(32, groupedThreads("onos/of", "event-stats-%d"));
......@@ -507,11 +512,10 @@ public class OpenFlowControllerImpl implements OpenFlowController {
connectedSwitches.remove(dpid);
OpenFlowSwitch sw = activeMasterSwitches.remove(dpid);
if (sw == null) {
log.warn("sw was null for {}", dpid);
log.debug("sw was null for {}", dpid);
sw = activeEqualSwitches.remove(dpid);
}
for (OpenFlowSwitchListener l : ofSwitchListener) {
log.warn("removal for {}", dpid);
l.switchRemoved(dpid);
}
}
......
......@@ -92,7 +92,7 @@ class RoleManager implements RoleHandler {
// ensuring that the only two roles sent to 1.0 switches with
// Nicira role support, are MASTER and SLAVE
roleToSend = OFNiciraControllerRole.ROLE_OTHER;
log.warn("Sending Nx Role.SLAVE to switch {}.", sw);
log.debug("Sending Nx Role.SLAVE to switch {}.", sw);
}
int xid = sw.getNextTransactionId();
OFExperimenter roleRequest = OFFactories.getFactory(OFVersion.OF_10)
......
......@@ -266,7 +266,6 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
@Override
public void event(MastershipEvent event) {
if (MastershipEvent.Type.BACKUPS_CHANGED.equals(event.type())) {
// only need new master events
return;
......@@ -275,7 +274,7 @@ public class LLDPLinkProvider extends AbstractProvider implements LinkProvider {
DeviceId deviceId = event.subject();
Device device = deviceService.getDevice(deviceId);
if (device == null) {
log.warn("Device {} doesn't exist, or isn't there yet", deviceId);
log.debug("Device {} doesn't exist, or isn't there yet", deviceId);
return;
}
if (rules.isSuppressed(device)) {
......
......@@ -51,6 +51,7 @@ import org.onosproject.openflow.controller.OpenFlowSwitchListener;
import org.onosproject.openflow.controller.RoleState;
import org.onosproject.openflow.controller.ThirdPartyMessage;
import org.osgi.service.component.ComponentContext;
import org.projectfloodlight.openflow.protocol.OFBadRequestCode;
import org.projectfloodlight.openflow.protocol.OFBarrierRequest;
import org.projectfloodlight.openflow.protocol.OFErrorMsg;
import org.projectfloodlight.openflow.protocol.OFErrorType;
......@@ -61,6 +62,7 @@ import org.projectfloodlight.openflow.protocol.OFMessage;
import org.projectfloodlight.openflow.protocol.OFPortStatus;
import org.projectfloodlight.openflow.protocol.OFStatsReply;
import org.projectfloodlight.openflow.protocol.OFStatsType;
import org.projectfloodlight.openflow.protocol.errormsg.OFBadRequestErrorMsg;
import org.projectfloodlight.openflow.protocol.errormsg.OFFlowModFailedErrorMsg;
import org.slf4j.Logger;
......@@ -327,8 +329,7 @@ public class OpenFlowRuleProvider extends AbstractProvider
break;
case BARRIER_REPLY:
try {
InternalCacheEntry entry = pendingBatches.getIfPresent(msg
.getXid());
InternalCacheEntry entry = pendingBatches.getIfPresent(msg.getXid());
if (entry != null) {
providerService
.batchOperationCompleted(msg.getXid(),
......@@ -342,32 +343,32 @@ public class OpenFlowRuleProvider extends AbstractProvider
}
break;
case ERROR:
log.warn("received Error message {} from {}", msg, dpid);
// TODO: This needs to get suppressed in a better way.
if (msg instanceof OFBadRequestErrorMsg &&
((OFBadRequestErrorMsg) msg).getCode() == OFBadRequestCode.BAD_TYPE) {
log.debug("Received error message {} from {}", msg, dpid);
} else {
log.warn("Received error message {} from {}", msg, dpid);
}
OFErrorMsg error = (OFErrorMsg) msg;
if (error.getErrType() == OFErrorType.FLOW_MOD_FAILED) {
OFFlowModFailedErrorMsg fmFailed = (OFFlowModFailedErrorMsg) error;
if (fmFailed.getData().getParsedMessage().isPresent()) {
OFMessage m = fmFailed.getData().getParsedMessage()
.get();
OFMessage m = fmFailed.getData().getParsedMessage().get();
OFFlowMod fm = (OFFlowMod) m;
InternalCacheEntry entry = pendingBatches
.getIfPresent(msg.getXid());
InternalCacheEntry entry =
pendingBatches.getIfPresent(msg.getXid());
if (entry != null) {
entry.appendFailure(new FlowEntryBuilder(dpid, fm)
.build());
entry.appendFailure(new FlowEntryBuilder(dpid, fm).build());
} else {
log.error("No matching batch for this error: {}",
error);
log.error("No matching batch for this error: {}", error);
}
} else {
// FIXME: Potentially add flowtracking to avoid this
// message.
// FIXME: Potentially add flowtracking to avoid this message.
log.error("Flow installation failed but switch didn't"
+ " tell us which one.");
}
} else {
log.warn("Received error {}", error);
}
default:
......