removing log message doc craziness
diff --git a/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java b/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
index ce85938..7669294 100644
--- a/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
+++ b/apps/fwd/src/main/java/org/onlab/onos/fwd/ReactiveForwarding.java
@@ -74,6 +74,10 @@
@Override
public void process(PacketContext context) {
+ /*
+ * stop processing if the packet has been handled,
+ * we can't do any more to it
+ */
if (context.isHandled()) {
return;
}
diff --git a/of/api/src/main/java/org/onlab/onos/of/controller/DefaultOpenFlowPacketContext.java b/of/api/src/main/java/org/onlab/onos/of/controller/DefaultOpenFlowPacketContext.java
index fd47ad3..5b6d109 100644
--- a/of/api/src/main/java/org/onlab/onos/of/controller/DefaultOpenFlowPacketContext.java
+++ b/of/api/src/main/java/org/onlab/onos/of/controller/DefaultOpenFlowPacketContext.java
@@ -20,7 +20,7 @@
private final Logger log = getLogger(getClass());
private final AtomicBoolean free = new AtomicBoolean(true);
- private boolean isBuilt = false;
+ private final AtomicBoolean isBuilt = new AtomicBoolean(false);
private final OpenFlowSwitch sw;
private final OFPacketIn pktin;
private OFPacketOut pktout = null;
@@ -32,14 +32,14 @@
@Override
public void send() {
- if (block() && isBuilt) {
+ if (block() && isBuilt.get()) {
sw.sendMsg(pktout);
}
}
@Override
- public synchronized void build(OFPort outPort) {
- if (isBuilt) {
+ public void build(OFPort outPort) {
+ if (isBuilt.getAndSet(true)) {
return;
}
OFPacketOut.Builder builder = sw.factory().buildPacketOut();
@@ -49,12 +49,11 @@
.setBufferId(pktin.getBufferId())
.setActions(Collections.singletonList(act))
.build();
- isBuilt = true;
}
@Override
- public synchronized void build(Ethernet ethFrame, OFPort outPort) {
- if (isBuilt) {
+ public void build(Ethernet ethFrame, OFPort outPort) {
+ if (isBuilt.getAndSet(true)) {
return;
}
OFPacketOut.Builder builder = sw.factory().buildPacketOut();
@@ -65,7 +64,6 @@
.setActions(Collections.singletonList(act))
.setData(ethFrame.serialize())
.build();
- isBuilt = true;
}
@Override
diff --git a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/Controller.java b/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/Controller.java
index 7c6b2ce..d8cec26 100644
--- a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/Controller.java
+++ b/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/Controller.java
@@ -32,8 +32,6 @@
import org.onlab.onos.of.controller.Dpid;
import org.onlab.onos.of.controller.driver.OpenFlowAgent;
import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriver;
-import org.onlab.onos.of.controller.impl.annotations.LogMessageDoc;
-import org.onlab.onos.of.controller.impl.annotations.LogMessageDocs;
import org.onlab.onos.of.drivers.impl.DriverManager;
import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
import org.projectfloodlight.openflow.protocol.OFFactories;
@@ -119,19 +117,6 @@
/**
* Tell controller that we're ready to accept switches loop.
*/
- @LogMessageDocs({
- @LogMessageDoc(message = "Listening for switch connections on {address}",
- explanation = "The controller is ready and listening for new" +
- " switch connections"),
- @LogMessageDoc(message = "Storage exception in controller " +
- "updates loop; terminating process",
- explanation = ERROR_DATABASE,
- recommendation = LogMessageDoc.CHECK_CONTROLLER),
- @LogMessageDoc(level = "ERROR",
- message = "Exception in controller updates loop",
- explanation = "Failed to dispatch controller event",
- recommendation = LogMessageDoc.GENERIC_ACTION)
- })
public void run() {
try {
diff --git a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFChannelHandler.java b/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFChannelHandler.java
index bcbbd26..4218f44 100644
--- a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFChannelHandler.java
+++ b/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFChannelHandler.java
@@ -17,11 +17,8 @@
import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler;
import org.jboss.netty.handler.timeout.IdleStateEvent;
import org.jboss.netty.handler.timeout.ReadTimeoutException;
-import org.onlab.onos.of.controller.RoleState;
import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriver;
import org.onlab.onos.of.controller.driver.SwitchStateException;
-import org.onlab.onos.of.controller.impl.annotations.LogMessageDoc;
-import org.onlab.onos.of.controller.impl.annotations.LogMessageDocs;
import org.projectfloodlight.openflow.exceptions.OFParseError;
import org.projectfloodlight.openflow.protocol.OFAsyncGetReply;
import org.projectfloodlight.openflow.protocol.OFBadRequestCode;
@@ -75,9 +72,6 @@
// needs to check if the handshake is complete
private volatile ChannelState state;
- // Used to coordinate between the controller and the cleanup thread(?)
- // for access to the global registry on a per switch basis.
- volatile Boolean controlRequested;
// When a switch with a duplicate dpid is found (i.e we already have a
// connected switch with the same dpid), the new switch is immediately
// disconnected. At that point netty callsback channelDisconnected() which
@@ -113,7 +107,6 @@
this.pendingPortStatusMsg = new CopyOnWriteArrayList<OFPortStatus>();
factory13 = controller.getOFMessageFactory13();
factory10 = controller.getOFMessageFactory10();
- controlRequested = Boolean.FALSE;
duplicateDpidFound = Boolean.FALSE;
}
@@ -316,16 +309,6 @@
*/
WAIT_CONFIG_REPLY(false) {
@Override
- @LogMessageDocs({
- @LogMessageDoc(level = "WARN",
- message = "Config Reply from {switch} has "
- + "miss length set to {length}",
- explanation = "The controller requires that the switch "
- + "use a miss length of 0xffff for correct "
- + "function",
- recommendation = "Use a different switch to ensure "
- + "correct function")
- })
void processOFGetConfigReply(OFChannelHandler h, OFGetConfigReply m)
throws IOException {
if (m.getMissSendLen() == 0xffff) {
@@ -395,11 +378,6 @@
* All following states will have a h.sw instance!
*/
WAIT_DESCRIPTION_STAT_REPLY(false) {
- @LogMessageDoc(message = "Switch {switch info} bound to class "
- + "{switch driver}, description {switch description}",
- explanation = "The specified switch has been bound to "
- + "a switch driver based on the switch description"
- + "received from the switch")
@Override
void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
throws SwitchStateException {
@@ -528,15 +506,6 @@
* SLAVE.
*/
ACTIVE(true) {
- @LogMessageDoc(level = "WARN",
- message = "Received permission error from switch {} while"
- + "being master. Reasserting master role.",
- explanation = "The switch has denied an operation likely "
- + "indicating inconsistent controller roles",
- recommendation = "This situation can occurs transiently during role"
- + " changes. If, however, the condition persists or happens"
- + " frequently this indicates a role inconsistency. "
- + LogMessageDoc.CHECK_CONTROLLER)
@Override
void processOFError(OFChannelHandler h, OFErrorMsg m)
throws IOException, SwitchStateException {
@@ -685,15 +654,6 @@
* @param h The switch that sent the error
* @param error The error message
*/
- @LogMessageDoc(level = "ERROR",
- message = "Error {error type} {error code} from {switch} "
- + "in state {state}",
- explanation = "The switch responded with an unexpected error"
- + "to an OpenFlow message from the controller",
- recommendation = "This could indicate improper network operation. "
- + "If the problem persists restarting the switch and "
- + "controller may help."
- )
protected void logError(OFChannelHandler h, OFErrorMsg error) {
log.error("{} from switch {} in state {}",
new Object[] {
@@ -1003,9 +963,6 @@
//*************************
@Override
- @LogMessageDoc(message = "New switch connection from {ip address}",
- explanation = "A new switch has connected from the "
- + "specified IP address")
public void channelConnected(ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception {
channel = e.getChannel();
@@ -1016,8 +973,6 @@
}
@Override
- @LogMessageDoc(message = "Disconnected switch {switch information}",
- explanation = "The specified switch has disconnected.")
public void channelDisconnected(ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception {
log.info("Switch disconnected callback for sw:{}. Cleaning up ...",
@@ -1044,47 +999,6 @@
}
@Override
- @LogMessageDocs({
- @LogMessageDoc(level = "ERROR",
- message = "Disconnecting switch {switch} due to read timeout",
- explanation = "The connected switch has failed to send any "
- + "messages or respond to echo requests",
- recommendation = LogMessageDoc.CHECK_SWITCH),
- @LogMessageDoc(level = "ERROR",
- message = "Disconnecting switch {switch}: failed to "
- + "complete handshake",
- explanation = "The switch did not respond correctly "
- + "to handshake messages",
- recommendation = LogMessageDoc.CHECK_SWITCH),
- @LogMessageDoc(level = "ERROR",
- message = "Disconnecting switch {switch} due to IO Error: {}",
- explanation = "There was an error communicating with the switch",
- recommendation = LogMessageDoc.CHECK_SWITCH),
- @LogMessageDoc(level = "ERROR",
- message = "Disconnecting switch {switch} due to switch "
- + "state error: {error}",
- explanation = "The switch sent an unexpected message",
- recommendation = LogMessageDoc.CHECK_SWITCH),
- @LogMessageDoc(level = "ERROR",
- message = "Disconnecting switch {switch} due to "
- + "message parse failure",
- explanation = "Could not parse a message from the switch",
- recommendation = LogMessageDoc.CHECK_SWITCH),
- @LogMessageDoc(level = "ERROR",
- message = "Terminating controller due to storage exception",
- explanation = Controller.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.",
- recommendation = LogMessageDoc.CHECK_CONTROLLER),
- @LogMessageDoc(level = "ERROR",
- message = "Error while processing message "
- + "from switch {switch} {cause}",
- explanation = "An error occurred processing the switch message",
- recommendation = LogMessageDoc.GENERIC_ACTION)
- })
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
if (e.getCause() instanceof ReadTimeoutException) {
@@ -1248,10 +1162,6 @@
channel.write(Collections.singletonList(m));
}
- private void setSwitchRole(RoleState role) {
- sw.setRole(role);
- }
-
/**
* Send the configuration requests to tell the switch we want full
* packets.
diff --git a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/LogMessageCategory.java b/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/LogMessageCategory.java
deleted file mode 100644
index 643c639..0000000
--- a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/LogMessageCategory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright 2012, 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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- **/
-
-package org.onlab.onos.of.controller.impl.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to set the category for log messages for a class.
- *
- */
-@Target({ ElementType.TYPE, ElementType.METHOD })
-public @interface LogMessageCategory {
-
- /**
- * The category for the log messages for this class.
- *
- * @return category
- */
- String value() default "Core";
-}
diff --git a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/LogMessageDoc.java b/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/LogMessageDoc.java
deleted file mode 100644
index 6f0db4d..0000000
--- a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/LogMessageDoc.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Copyright 2012, 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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- **/
-
-package org.onlab.onos.of.controller.impl.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to document log messages. This can be used to generate
- * documentation on syslog output.
- *
- */
-@Target({ ElementType.TYPE, ElementType.METHOD })
-public @interface LogMessageDoc {
- public static final String NO_ACTION = "No action is required.";
- public static final String UNKNOWN_ERROR = "An unknown error occured";
- public static final String GENERIC_ACTION =
- "Examine the returned error or exception and take " +
- "appropriate action.";
- public static final String CHECK_SWITCH =
- "Check the health of the indicated switch. " +
- "Test and troubleshoot IP connectivity.";
- public static final String CHECK_CONTROLLER =
- "Verify controller system health, CPU usage, and memory. " +
- "Rebooting the controller node may help if the controller " +
- "node is in a distressed state.";
- public static final String REPORT_CONTROLLER_BUG =
- "This is likely a defect in the controller. Please report this " +
- "issue. Restarting the controller or switch may help to " +
- "alleviate.";
- public static final String REPORT_SWITCH_BUG =
- "This is likely a defect in the switch. Please report this " +
- "issue. Restarting the controller or switch may help to " +
- "alleviate.";
-
- /**
- * The log level for the log message.
- *
- * @return the log level as a tring
- */
- String level() default "INFO";
-
- /**
- * The message that will be printed.
- *
- * @return the message
- */
- String message() default UNKNOWN_ERROR;
-
- /**
- * An explanation of the meaning of the log message.
- *
- * @return the explanation
- */
- String explanation() default UNKNOWN_ERROR;
-
- /**
- * The recommendated action associated with the log message.
- *
- * @return the recommendation
- */
- String recommendation() default NO_ACTION;
-}
diff --git a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/LogMessageDocs.java b/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/LogMessageDocs.java
deleted file mode 100644
index f8b0dd9..0000000
--- a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/LogMessageDocs.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Copyright 2012, 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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- **/
-
-package org.onlab.onos.of.controller.impl.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to document log messages. This can be used to generate
- * documentation on syslog output. This version allows multiple log messages
- * to be documentated on an interface.
- *
- */
-@Target({ ElementType.TYPE, ElementType.METHOD })
-public @interface LogMessageDocs {
- /**
- * A list of {@link LogMessageDoc} elements.
- *
- * @return the list of log message doc
- */
- LogMessageDoc[] value();
-}
diff --git a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/package-info.java b/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/package-info.java
deleted file mode 100644
index 7bf2f1f..0000000
--- a/of/ctl/src/main/java/org/onlab/onos/of/controller/impl/annotations/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Controller logging annotations - do be deprecated.
- */
-package org.onlab.onos.of.controller.impl.annotations;
diff --git a/providers/of/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowPacketProvider.java b/providers/of/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowPacketProvider.java
index 40b40e4..769ba7f 100644
--- a/providers/of/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowPacketProvider.java
+++ b/providers/of/packet/src/main/java/org/onlab/onos/provider/of/packet/impl/OpenFlowPacketProvider.java
@@ -87,7 +87,8 @@
pktCtx.parsed(), ByteBuffer.wrap(pktCtx.unparsed()));
OpenFlowCorePacketContext corePktCtx =
- new OpenFlowCorePacketContext(0, inPkt, null, pktCtx.isHandled(), pktCtx);
+ new OpenFlowCorePacketContext(System.currentTimeMillis(),
+ inPkt, null, pktCtx.isHandled(), pktCtx);
providerService.processPacket(corePktCtx);
}