The existing mechanism int the Controller allows the exceptions to be printed only
the console. This applies to both caught and uncaught exception. If the console
buffer is not too large and gets overwritten or gets cleared, there is no way for
the user to know what exceptions occurred. This commit implements a new mechanism
by which both types of exceptions will get printed on the console as well as logged
to the file.
Signed-off-by: Maurice Qureshi <maquresh@cisco.com>
} catch (Exception e) {
logger.error("GossipRouter didn't start exception " + e
+ " met");
- StringWriter sw = new StringWriter();
logger.error("Stack Trace that raised the exception");
- e.printStackTrace(new PrintWriter(sw));
- logger.error(sw.toString());
+ logger.error("",e);
}
}
logger.info("Starting the ClusterManager");
logger.debug("Started the ClusterManager");
}
} catch (Exception ioe) {
- StringWriter sw = new StringWriter();
logger.error("Cannot configure infinispan .. bailing out ");
logger.error("Stack Trace that raised th exception");
- ioe.printStackTrace(new PrintWriter(sw));
- logger.error(sw.toString());
+ logger.error("",ioe);
this.cm = null;
this.stop();
}
import org.opendaylight.controller.sal.utils.NodeCreator;
import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This class defines a static route object.
*/
public class StaticRoute {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(StaticRoute.class);
+
/**
* This Enum defines the possible types for the next hop address.
*/
return InetAddress.getByAddress(BitBufferHelper
.toByteArray(netmask));
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
return null;
}
}
try {
return InetAddress.getByAddress(bbself.array());
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
}
try {
ra.staticRouteUpdate(s, update);
} catch (Exception e) {
- e.printStackTrace();
+ log.error("",e);
}
}
}
try {
host = future.get();
} catch (Exception e) {
- e.printStackTrace();
+ log.error("",e);
}
}
}
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.flowprogrammer.Flow;
import org.opendaylight.controller.sal.match.Match;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Represents a flow applications request Forwarding Rules Manager to install
* For instance the flows constituting a policy all share the same group name.
*/
public class FlowEntry implements Cloneable, Serializable {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(FlowEntry.class);
private static final long serialVersionUID = 1L;
private String groupName; // group name
private String flowName; // flow name (may be null)
cloned = (FlowEntry) super.clone();
cloned.flow = this.flow.clone();
} catch (CloneNotSupportedException e) {
- e.printStackTrace();
+ logger.error("",e);
}
return cloned;
}
try {
node = NodeCreator.createOFNode(Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ log.error("",e);
}
ci.println(this.programmer.addFlow(node, getSampleFlow(node)));
}
try {
node = NodeCreator.createOFNode(Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ log.error("",e);
}
ci.println(this.programmer.removeFlow(node, getSampleFlow(node)));
}
import java.util.concurrent.Future;
import org.apache.felix.dm.Component;
+import org.apache.taglibs.standard.lang.jstl.DivideOperator;
import org.opendaylight.controller.clustering.services.CacheConfigException;
import org.opendaylight.controller.clustering.services.CacheExistException;
import org.opendaylight.controller.clustering.services.IClusterContainerServices;
nc,
Short.valueOf(vlan));
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
return new Status(StatusCode.BADREQUEST, "Invalid Address");
}
}
address = InetAddress.getByName(networkAddress);
return removeStaticHostReq(address);
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
return new Status(StatusCode.BADREQUEST, "Invalid Address");
}
}
this.listener.logged(entry);
}
}
+
+ /*
+ * Install the default exception handler so that the uncaught
+ * exceptions are handled by our customized handler. This new
+ * handler will display the exceptions to OSGI console as well
+ * as log to file.
+ */
+ Thread.setDefaultUncaughtExceptionHandler(new org.opendaylight.
+ controller.logging.bridge.internal.UncaughtExceptionHandler());
} else {
this.log.error("Cannot register the LogListener because "
+ "cannot retrive LogReaderService");
--- /dev/null
+package org.opendaylight.controller.logging.bridge.internal;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class UncaughtExceptionHandler implements Thread.UncaughtExceptionHandler{
+ private static Logger log = LoggerFactory.getLogger(UncaughtExceptionHandler.class);
+
+ public void uncaughtException (Thread t, Throwable e) {
+ log.error("Uncaught ExceptionHandler:", e);
+ }
+}
import org.opendaylight.controller.sal.core.State;
import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
import org.opendaylight.controller.sal.utils.NodeCreator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class TopologyTest {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(TopologyTest.class);
@Test
public void edgePropertiesTopologyTest() {
try {
e12 = new Edge(nc12, nc21);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
assertTrue(false);
}
try {
e23 = new Edge(nc23, nc32);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
assertTrue(false);
}
import org.eclipse.osgi.framework.console.CommandProvider;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This java class provides the osgi console with the commands for running the unit test scripts for the API3
*
*/
public class API3UnitTest implements CommandProvider {
+ private static Logger log = LoggerFactory
+ .getLogger(API3UnitTest.class);
+
private static final String python = "/usr/bin/python";
/**
printStream(process.getErrorStream());
} catch (Exception e) {
System.out.println("Exception!");
- e.printStackTrace();
+ logger.error("",e);
}
}
printStream(process.getErrorStream());
} catch (Exception e) {
System.out.println("Exception!");
- e.printStackTrace();
+ logger.error("",e);
}
}
if (shuttingDown)
return;
} catch (Exception e2) {
- e2.printStackTrace();
+ logger.error("",e2);
}
}
}
import org.opendaylight.controller.sal.match.MatchType;
import org.opendaylight.controller.sal.utils.NetUtils;
import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Utility class for converting a SAL Flow into the OF flow and vice-versa
*/
public class FlowConverter {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(FlowConverter.class);
private Flow flow; // SAL Flow
private OFMatch ofMatch; // OF 1.0 match or OF 1.0 + IPv6 extension match
private List<OFAction> actionsList; // OF 1.0 actions
try {
ip = InetAddress.getByAddress(addr);
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
salAction = new SetNwSrc(ip);
} else if (ofAction instanceof OFActionNetworkLayerDestination) {
try {
ip = InetAddress.getByAddress(addr);
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
salAction = new SetNwDst(ip);
} else if (ofAction instanceof OFActionNetworkTypeOfService) {
return flow;
}
-}
\ No newline at end of file
+}
try {
node = new Node(NodeIDType.OPENFLOW, id);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
return node;
handlePortStatusMessage(sw, (OFPortStatus) msg);
}
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
return;
}
return;
}
} catch (Exception e2) {
- e2.printStackTrace();
+ logger.error("",e2);
}
}
}
return;
}
} catch (Exception e2) {
- e2.printStackTrace();
+ logger.error("",e2);
}
}
}
address = InetAddress.getByAddress(ByteBuffer.allocate(4)
.putInt(match.getNetworkSource()).array());
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
this.setNetworkSource(address, null);
} else {
address = InetAddress.getByAddress(ByteBuffer.allocate(4)
.putInt(match.getNetworkDestination()).array());
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
this.setNetworkDestination(address, null);
} else {
match_len += 20;
}
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
} else if (values[0].equals(STR_NW_SRC)
|| values[0].equals("ip_src")) {
match_len += 20;
}
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
} else if (values[0].equals(STR_NW_PROTO)) {
this.networkProtocol = U8.t(Short.valueOf(values[1]));
.getNode(), dst
.getNode(), EdgeType.DIRECTED);
} catch (ConstructionException e) {
- e.printStackTrace();
+ log.error("",e);
return edgePresentInGraph;
}
}
try {
topo.removeEdge(new Edge(src, dst));
} catch (ConstructionException e) {
- e.printStackTrace();
+ log.error("",e);
return edgePresentInGraph;
}
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.controller.routing.dijkstra_implementation.internal.DijkstraImplementation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class DijkstraTest {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(DijkstraTest.class);
@Test
public void testSinglePathRouteNoBw() {
DijkstraImplementation imp = new DijkstraImplementation();
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Set<Property> props = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge2 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Set<Property> props2 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Set<Property> props = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge2 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Set<Property> props2 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge3 = new Edge(nc12, nc32);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Set<Property> props3 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Set<Property> props = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge2 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Set<Property> props2 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge3 = new Edge(nc12, nc32);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Set<Property> props3 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
import org.opendaylight.controller.routing.dijkstra_implementation.internal.DijkstraImplementation;
import org.opendaylight.controller.sal.core.UpdateType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class MaxThruputTest {
-
+ protected static final Logger logger = LoggerFactory
+ .getLogger(MaxThruputTest.class);
Map<Edge, Number> LinkCostMap = new HashMap<Edge, Number>();
@Test
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge1, 10);
Edge edge2 = null;
try {
edge2 = new Edge(nc21, nc11);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge2, 10);
try {
edge3 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge3, 30);
Edge edge4 = null;
try {
edge4 = new Edge(nc31, nc22);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge4, 30);
try {
edge5 = new Edge(nc32, nc41);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge5, 10);
Edge edge6 = null;
try {
edge6 = new Edge(nc41, nc32);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge6, 10);
try {
edge7 = new Edge(nc12, nc51);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge7, 20);
Edge edge8 = null;
try {
edge8 = new Edge(nc51, nc12);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge8, 20);
try {
edge9 = new Edge(nc52, nc61);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge9, 20);
Edge edge10 = null;
try {
edge10 = new Edge(nc61, nc52);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge10, 20);
try {
edge11 = new Edge(nc62, nc42);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge11, 20);
Edge edge12 = null;
try {
edge12 = new Edge(nc42, nc62);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
LinkCostMap.put(edge12, 20);
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
} catch (Exception e) {
logger.error(e.getMessage());
if (debug) {
- e.printStackTrace();
+ logger.error("",e);
}
}
}
import org.opendaylight.controller.sal.action.SetNwSrc;
import org.opendaylight.controller.sal.match.Match;
import org.opendaylight.controller.sal.utils.EtherTypes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Represent a flow: match + actions + flow specific properties
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class Flow implements Cloneable, Serializable {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(Flow.class);
private static final long serialVersionUID = 1L;
@XmlElement
private Match match;
try {
throw new Exception("Conflicting Match and Action list");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
} else {
this.match = match;
cloned.match = this.getMatch();
cloned.actions = this.getActions();
} catch (CloneNotSupportedException e) {
- e.printStackTrace();
+ logger.error("",e);
}
return cloned;
}
}
}
} catch (CloneNotSupportedException e) {
- e.printStackTrace();
+ logger.error("",e);
}
return cloned;
}
import java.util.Arrays;
import org.opendaylight.controller.sal.utils.NetUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* BitBufferHelper class that provides utility methods to
*
*/
public abstract class BitBufferHelper {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(BitBufferHelper.class);
public static long ByteMask = 0xFF;
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
return (data[0]);
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
return (short) toNumber(data);
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
return (int) toNumber(data);
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
return (long) toNumber(data);
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
int startOffset = data.length * NetUtils.NumBitsInAByte - numBits;
throw new Exception(
"Container is too small for the number of requiested bits");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
int startOffset = data.length * NetUtils.NumBitsInAByte - numBits;
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
if (numBits > data.length * NetUtils.NumBitsInAByte) {
throw new Exception(
"Trying to read more bits than contained in the data buffer");
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
int startOffset = data.length * NetUtils.NumBitsInAByte - numBits;
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.controller.sal.utils.IPProtocols;
import org.opendaylight.controller.sal.utils.NetUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Class that represents the IPv4 packet objects
*/
public class IPv4 extends Packet {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(IPv4.class);
private static final String VERSION = "Version";
private static final String HEADERLENGTH = "HeaderLength";
private static final String DIFFSERV = "DiffServ";
try {
payloadLength = payload.serialize().length;
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
}
this.setTotalLength((short) (this.getHeaderLen() + payloadLength));
}
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.controller.sal.utils.HexEncode;
import org.opendaylight.controller.sal.utils.NetUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Abstract class which represents the generic network packet object
*/
public abstract class Packet {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(Packet.class);
// Access level granted to this packet
protected boolean writeAccess;
// When deserialized from wire, packet could result corrupted
.getHostAddress()
+ " ");
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
} else {
ret.append(((Long) BitBufferHelper.getLong(entry.getValue()))
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Utility class containing the common utility functions needed
* for operating on networking data structures
*
*/
public abstract class NetUtils {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(NetUtils.class);
/**
* Constant holding the number of bits in a byte
*/
try {
ip = InetAddress.getByAddress(NetUtils.intToByteArray4(address));
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
return ip;
}
try {
return InetAddress.getByAddress(address);
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
return null;
}
try {
address = InetAddress.getByName(addressString);
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
return address;
}
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.controller.sal.core.Node.NodeIDType;
import org.opendaylight.controller.sal.core.NodeConnector.NodeConnectorIDType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The class provides helper functions to create a node connector
*
*/
public abstract class NodeConnectorCreator {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(NodeConnectorCreator.class);
/**
* Generic NodeConnector creator
* The nodeConnector type is inferred from the node type
return new NodeConnector(NodeConnectorIDType.OPENFLOW,
(Short) portId, node);
} catch (ConstructionException e1) {
- e1.printStackTrace();
+ logger.error("",e1);
return null;
}
}
try {
return new NodeConnector(nodeConnectorType, portId, node);
} catch (ConstructionException e1) {
- e1.printStackTrace();
+ logger.error("",e1);
return null;
}
}
try {
return new NodeConnector(NodeConnectorIDType.OPENFLOW, portId, node);
} catch (ConstructionException e1) {
- e1.printStackTrace();
+ logger.error("",e1);
return null;
}
}
}
return nodeConnectors;
} catch (ConstructionException e1) {
- e1.printStackTrace();
+ logger.error("",e1);
return null;
}
}
import org.opendaylight.controller.sal.core.ConstructionException;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.Node.NodeIDType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Utility class for creating a Node object
*
*/
public abstract class NodeCreator {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(NodeCreator.class);
public static Node createOFNode(Long switchId) {
try {
return new Node(NodeIDType.OPENFLOW, switchId);
} catch (ConstructionException e1) {
- e1.printStackTrace();
+ logger.error("",e1);
return null;
}
}
import java.io.*;
import java.util.ArrayList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Convenience object to write a file
*
*
*/
public class WriteToFile {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(WriteToFile.class);
private FileWriter fstream;
private BufferedWriter bufferOut;
private String fileName;
try {
this.bufferOut.flush();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.controller.sal.utils.EtherTypes;
import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ActionTest {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(ActionTest.class);
@Test
public void tesActionCreationValidation() {
Action action = new PopVlan();
try {
ip = InetAddress.getByName("171.71.9.52");
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
action = new SetNwSrc(ip);
try {
ip = InetAddress.getByName("2001:420:281:1003:f2de:f1ff:fe71:728d");
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
action = new SetNwSrc(ip);
Assert.assertTrue(action.isValid());
try {
ip = InetAddress.getByName("1.1.1.1");
} catch (UnknownHostException e) {
- e.printStackTrace();
+ logger.error("",e);
}
actions.add(new SetDlSrc(mac));
try {
data = pkt.serialize();
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("",e);
return null;
}
if (data.length <= 0) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
ci.println(this.addFlow(node, getSampleFlow(node)));
}
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Flow flowA = getSampleFlow(node);
Flow flowB = getSampleFlow(node);
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
ci.println(this.removeFlow(node, getSampleFlow(node)));
}
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
ci.println(this.addFlow(node, getSampleFlowV6(node)));
}
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
ci.println(this.removeFlow(node, getSampleFlowV6(node)));
}
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
List<FlowOnNode> list = (cached) ? this.readAllFlows(node) : this
.nonCachedReadAllFlows(node);
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
Flow flow = getSampleFlow(node);
FlowOnNode flowOnNode = (cached) ? this.readFlow(node, flow) : this
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
List<NodeConnectorStatistics> list = (cached) ? this
.readNodeConnectors(node) : this
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
NodeDescription desc = (cached) ? this.readDescription(node) : this
.nonCachedReadDescription(node);
import org.opendaylight.controller.sal.core.impl.NotificationModule;\r
\r
\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
public class SALDemo {\r
+ protected static final Logger logger = LoggerFactory\r
+ .getLogger(SALDemo.class);\r
\r
static BrokerImpl broker;\r
static DemoProviderImpl provider;\r
}\r
} catch (IOException e) {\r
\r
- e.printStackTrace();\r
+ logger.error("",e);\r
}\r
}\r
\r
import java.text.SimpleDateFormat;\r
import java.util.Date;\r
\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
/**\r
* The QName from XML consists of local name of element and XML namespace, but\r
* for our use, we added module revision to it.\r
* \r
*/\r
public class QName {\r
+ protected static final Logger logger = LoggerFactory\r
+ .getLogger(QName.class);\r
\r
private SimpleDateFormat revisionFormat = new SimpleDateFormat("yyyy-MM-dd");\r
\r
namespace.getPort(), namespace.getPath(), query,\r
namespace.getFragment());\r
} catch (URISyntaxException e) {\r
- e.printStackTrace();\r
+ logger.error("",e);\r
}\r
return compositeURI;\r
}\r
}
}catch (UnknownHostException e) {
lbsLogger.error("Pool member not found in the network : {}",e.getMessage());
- e.printStackTrace();
+ lbsLogger.error("",e);
}
}
}
import org.opendaylight.controller.sal.utils.GUIField;
import org.opendaylight.controller.switchmanager.SpanConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The class represents a Span Port configuration for a network node.
*/
public class SpanConfig implements Serializable {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(SpanConfig.class);
private static final long serialVersionUID = 1L;
private static final String guiFields[] = { GUIField.NODE.toString(),
GUIField.SPANPORTS.toString() };
NodeConnectorIDType.OPENFLOW, Short.valueOf(j),
node));
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
} else {
NodeConnectorIDType.OPENFLOW, Short.valueOf(elem),
node));
} catch (NumberFormatException e) {
- e.printStackTrace();
+ logger.error("",e);
} catch (ConstructionException e) {
- e.printStackTrace();
+ logger.error("",e);
}
}
}
try {
nis = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e1) {
- e1.printStackTrace();
+ log.error("",e1);
return null;
}
byte[] MAC = null;
try {
MAC = ni.getHardwareAddress();
} catch (SocketException e) {
- e.printStackTrace();
+ log.error("",e);
}
if (MAC != null) {
return MAC;