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>
38 files changed:
} catch (Exception e) {
logger.error("GossipRouter didn't start exception " + e
+ " met");
} catch (Exception e) {
logger.error("GossipRouter didn't start exception " + e
+ " met");
- StringWriter sw = new StringWriter();
logger.error("Stack Trace that raised the exception");
logger.error("Stack Trace that raised the exception");
- e.printStackTrace(new PrintWriter(sw));
- logger.error(sw.toString());
}
}
logger.info("Starting the ClusterManager");
}
}
logger.info("Starting the ClusterManager");
logger.debug("Started the ClusterManager");
}
} catch (Exception ioe) {
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");
logger.error("Cannot configure infinispan .. bailing out ");
logger.error("Stack Trace that raised th exception");
- ioe.printStackTrace(new PrintWriter(sw));
- logger.error(sw.toString());
this.cm = null;
this.stop();
}
this.cm = null;
this.stop();
}
import org.opendaylight.controller.sal.utils.NodeCreator;
import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
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 {
/**
* 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.
*/
/**
* This Enum defines the possible types for the next hop address.
*/
return InetAddress.getByAddress(BitBufferHelper
.toByteArray(netmask));
} catch (Exception e) {
return InetAddress.getByAddress(BitBufferHelper
.toByteArray(netmask));
} catch (Exception e) {
try {
return InetAddress.getByAddress(bbself.array());
} catch (Exception e) {
try {
return InetAddress.getByAddress(bbself.array());
} catch (Exception e) {
try {
ra.staticRouteUpdate(s, update);
} catch (Exception e) {
try {
ra.staticRouteUpdate(s, update);
} catch (Exception e) {
try {
host = future.get();
} catch (Exception e) {
try {
host = future.get();
} catch (Exception e) {
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.flowprogrammer.Flow;
import org.opendaylight.controller.sal.match.Match;
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
/**
* 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 {
* 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)
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) {
cloned = (FlowEntry) super.clone();
cloned.flow = this.flow.clone();
} catch (CloneNotSupportedException e) {
try {
node = NodeCreator.createOFNode(Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = NodeCreator.createOFNode(Long.valueOf(nodeId));
} catch (NumberFormatException e) {
}
ci.println(this.programmer.addFlow(node, getSampleFlow(node)));
}
}
ci.println(this.programmer.addFlow(node, getSampleFlow(node)));
}
try {
node = NodeCreator.createOFNode(Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = NodeCreator.createOFNode(Long.valueOf(nodeId));
} catch (NumberFormatException e) {
}
ci.println(this.programmer.removeFlow(node, getSampleFlow(node)));
}
}
ci.println(this.programmer.removeFlow(node, getSampleFlow(node)));
}
import java.util.concurrent.Future;
import org.apache.felix.dm.Component;
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;
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) {
nc,
Short.valueOf(vlan));
} catch (UnknownHostException e) {
return new Status(StatusCode.BADREQUEST, "Invalid Address");
}
}
return new Status(StatusCode.BADREQUEST, "Invalid Address");
}
}
address = InetAddress.getByName(networkAddress);
return removeStaticHostReq(address);
} catch (UnknownHostException e) {
address = InetAddress.getByName(networkAddress);
return removeStaticHostReq(address);
} catch (UnknownHostException e) {
return new Status(StatusCode.BADREQUEST, "Invalid Address");
}
}
return new Status(StatusCode.BADREQUEST, "Invalid Address");
}
}
this.listener.logged(entry);
}
}
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");
} 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.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 {
public class TopologyTest {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(TopologyTest.class);
@Test
public void edgePropertiesTopologyTest() {
@Test
public void edgePropertiesTopologyTest() {
try {
e12 = new Edge(nc12, nc21);
} catch (ConstructionException e) {
try {
e12 = new Edge(nc12, nc21);
} catch (ConstructionException e) {
assertTrue(false);
}
try {
e23 = new Edge(nc23, nc32);
} catch (ConstructionException e) {
assertTrue(false);
}
try {
e23 = new Edge(nc23, nc32);
} catch (ConstructionException e) {
import org.eclipse.osgi.framework.console.CommandProvider;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
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
/**
* This java class provides the osgi console with the commands for running the unit test scripts for the API3
*
*/
public class API3UnitTest implements CommandProvider {
*
*/
public class API3UnitTest implements CommandProvider {
+ private static Logger log = LoggerFactory
+ .getLogger(API3UnitTest.class);
+
private static final String python = "/usr/bin/python";
/**
private static final String python = "/usr/bin/python";
/**
printStream(process.getErrorStream());
} catch (Exception e) {
System.out.println("Exception!");
printStream(process.getErrorStream());
} catch (Exception e) {
System.out.println("Exception!");
printStream(process.getErrorStream());
} catch (Exception e) {
System.out.println("Exception!");
printStream(process.getErrorStream());
} catch (Exception e) {
System.out.println("Exception!");
if (shuttingDown)
return;
} catch (Exception e2) {
if (shuttingDown)
return;
} catch (Exception e2) {
import org.opendaylight.controller.sal.match.MatchType;
import org.opendaylight.controller.sal.utils.NetUtils;
import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
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 {
/**
* 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
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) {
try {
ip = InetAddress.getByAddress(addr);
} catch (UnknownHostException e) {
}
salAction = new SetNwSrc(ip);
} else if (ofAction instanceof OFActionNetworkLayerDestination) {
}
salAction = new SetNwSrc(ip);
} else if (ofAction instanceof OFActionNetworkLayerDestination) {
try {
ip = InetAddress.getByAddress(addr);
} catch (UnknownHostException e) {
try {
ip = InetAddress.getByAddress(addr);
} catch (UnknownHostException e) {
}
salAction = new SetNwDst(ip);
} else if (ofAction instanceof OFActionNetworkTypeOfService) {
}
salAction = new SetNwDst(ip);
} else if (ofAction instanceof OFActionNetworkTypeOfService) {
-}
\ No newline at end of file
try {
node = new Node(NodeIDType.OPENFLOW, id);
} catch (ConstructionException e) {
try {
node = new Node(NodeIDType.OPENFLOW, id);
} catch (ConstructionException e) {
handlePortStatusMessage(sw, (OFPortStatus) msg);
}
} catch (ConstructionException e) {
handlePortStatusMessage(sw, (OFPortStatus) msg);
}
} catch (ConstructionException e) {
return;
}
} catch (Exception e2) {
return;
}
} catch (Exception e2) {
return;
}
} catch (Exception e2) {
return;
}
} catch (Exception e2) {
address = InetAddress.getByAddress(ByteBuffer.allocate(4)
.putInt(match.getNetworkSource()).array());
} catch (UnknownHostException e) {
address = InetAddress.getByAddress(ByteBuffer.allocate(4)
.putInt(match.getNetworkSource()).array());
} catch (UnknownHostException e) {
}
this.setNetworkSource(address, null);
} else {
}
this.setNetworkSource(address, null);
} else {
address = InetAddress.getByAddress(ByteBuffer.allocate(4)
.putInt(match.getNetworkDestination()).array());
} catch (UnknownHostException e) {
address = InetAddress.getByAddress(ByteBuffer.allocate(4)
.putInt(match.getNetworkDestination()).array());
} catch (UnknownHostException e) {
}
this.setNetworkDestination(address, null);
} else {
}
this.setNetworkDestination(address, null);
} else {
match_len += 20;
}
} catch (UnknownHostException e) {
match_len += 20;
}
} catch (UnknownHostException e) {
}
} else if (values[0].equals(STR_NW_SRC)
|| values[0].equals("ip_src")) {
}
} else if (values[0].equals(STR_NW_SRC)
|| values[0].equals("ip_src")) {
match_len += 20;
}
} catch (UnknownHostException e) {
match_len += 20;
}
} catch (UnknownHostException e) {
}
} else if (values[0].equals(STR_NW_PROTO)) {
this.networkProtocol = U8.t(Short.valueOf(values[1]));
}
} else if (values[0].equals(STR_NW_PROTO)) {
this.networkProtocol = U8.t(Short.valueOf(values[1]));
.getNode(), dst
.getNode(), EdgeType.DIRECTED);
} catch (ConstructionException e) {
.getNode(), dst
.getNode(), EdgeType.DIRECTED);
} catch (ConstructionException e) {
return edgePresentInGraph;
}
}
return edgePresentInGraph;
}
}
try {
topo.removeEdge(new Edge(src, dst));
} catch (ConstructionException e) {
try {
topo.removeEdge(new Edge(src, dst));
} catch (ConstructionException e) {
return edgePresentInGraph;
}
return edgePresentInGraph;
}
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.controller.routing.dijkstra_implementation.internal.DijkstraImplementation;
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 {
public class DijkstraTest {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(DijkstraTest.class);
@Test
public void testSinglePathRouteNoBw() {
DijkstraImplementation imp = new DijkstraImplementation();
@Test
public void testSinglePathRouteNoBw() {
DijkstraImplementation imp = new DijkstraImplementation();
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
}
Set<Property> props = new HashSet<Property>();
props.add(new Bandwidth(0));
}
Set<Property> props = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge2 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
try {
edge2 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
}
Set<Property> props2 = new HashSet<Property>();
props.add(new Bandwidth(0));
}
Set<Property> props2 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
}
Set<Property> props = new HashSet<Property>();
props.add(new Bandwidth(0));
}
Set<Property> props = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge2 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
try {
edge2 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
}
Set<Property> props2 = new HashSet<Property>();
props.add(new Bandwidth(0));
}
Set<Property> props2 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge3 = new Edge(nc12, nc32);
} catch (ConstructionException e) {
try {
edge3 = new Edge(nc12, nc32);
} catch (ConstructionException e) {
}
Set<Property> props3 = new HashSet<Property>();
props.add(new Bandwidth(0));
}
Set<Property> props3 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
}
Set<Property> props = new HashSet<Property>();
props.add(new Bandwidth(0));
}
Set<Property> props = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge2 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
try {
edge2 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
}
Set<Property> props2 = new HashSet<Property>();
props.add(new Bandwidth(0));
}
Set<Property> props2 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
edge3 = new Edge(nc12, nc32);
} catch (ConstructionException e) {
try {
edge3 = new Edge(nc12, nc32);
} catch (ConstructionException e) {
}
Set<Property> props3 = new HashSet<Property>();
props.add(new Bandwidth(0));
}
Set<Property> props3 = new HashSet<Property>();
props.add(new Bandwidth(0));
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
}
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.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 {
public class MaxThruputTest {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(MaxThruputTest.class);
Map<Edge, Number> LinkCostMap = new HashMap<Edge, Number>();
@Test
Map<Edge, Number> LinkCostMap = new HashMap<Edge, Number>();
@Test
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
try {
edge1 = new Edge(nc11, nc21);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge1, 10);
Edge edge2 = null;
try {
edge2 = new Edge(nc21, nc11);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge1, 10);
Edge edge2 = null;
try {
edge2 = new Edge(nc21, nc11);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge2, 10);
}
LinkCostMap.put(edge2, 10);
try {
edge3 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
try {
edge3 = new Edge(nc22, nc31);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge3, 30);
Edge edge4 = null;
try {
edge4 = new Edge(nc31, nc22);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge3, 30);
Edge edge4 = null;
try {
edge4 = new Edge(nc31, nc22);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge4, 30);
}
LinkCostMap.put(edge4, 30);
try {
edge5 = new Edge(nc32, nc41);
} catch (ConstructionException e) {
try {
edge5 = new Edge(nc32, nc41);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge5, 10);
Edge edge6 = null;
try {
edge6 = new Edge(nc41, nc32);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge5, 10);
Edge edge6 = null;
try {
edge6 = new Edge(nc41, nc32);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge6, 10);
}
LinkCostMap.put(edge6, 10);
try {
edge7 = new Edge(nc12, nc51);
} catch (ConstructionException e) {
try {
edge7 = new Edge(nc12, nc51);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge7, 20);
Edge edge8 = null;
try {
edge8 = new Edge(nc51, nc12);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge7, 20);
Edge edge8 = null;
try {
edge8 = new Edge(nc51, nc12);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge8, 20);
}
LinkCostMap.put(edge8, 20);
try {
edge9 = new Edge(nc52, nc61);
} catch (ConstructionException e) {
try {
edge9 = new Edge(nc52, nc61);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge9, 20);
Edge edge10 = null;
try {
edge10 = new Edge(nc61, nc52);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge9, 20);
Edge edge10 = null;
try {
edge10 = new Edge(nc61, nc52);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge10, 20);
}
LinkCostMap.put(edge10, 20);
try {
edge11 = new Edge(nc62, nc42);
} catch (ConstructionException e) {
try {
edge11 = new Edge(nc62, nc42);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge11, 20);
Edge edge12 = null;
try {
edge12 = new Edge(nc42, nc62);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge11, 20);
Edge edge12 = null;
try {
edge12 = new Edge(nc42, nc62);
} catch (ConstructionException e) {
}
LinkCostMap.put(edge12, 20);
}
LinkCostMap.put(edge12, 20);
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
try {
expectedRes = new Path(expectedPath);
} catch (ConstructionException e) {
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
}
if (!res.equals(expectedRes)) {
System.out.println("Actual Res is " + res);
} catch (Exception e) {
logger.error(e.getMessage());
if (debug) {
} catch (Exception e) {
logger.error(e.getMessage());
if (debug) {
import org.opendaylight.controller.sal.action.SetNwSrc;
import org.opendaylight.controller.sal.match.Match;
import org.opendaylight.controller.sal.utils.EtherTypes;
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
/**
* Represent a flow: match + actions + flow specific properties
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class Flow implements Cloneable, Serializable {
@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;
private static final long serialVersionUID = 1L;
@XmlElement
private Match match;
try {
throw new Exception("Conflicting Match and Action list");
} catch (Exception e) {
try {
throw new Exception("Conflicting Match and Action list");
} catch (Exception e) {
}
} else {
this.match = match;
}
} else {
this.match = match;
cloned.match = this.getMatch();
cloned.actions = this.getActions();
} catch (CloneNotSupportedException e) {
cloned.match = this.getMatch();
cloned.actions = this.getActions();
} catch (CloneNotSupportedException e) {
}
}
} catch (CloneNotSupportedException e) {
}
}
} catch (CloneNotSupportedException e) {
import java.util.Arrays;
import org.opendaylight.controller.sal.utils.NetUtils;
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
/**
* BitBufferHelper class that provides utility methods to
*
*/
public abstract class BitBufferHelper {
*
*/
public abstract class BitBufferHelper {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(BitBufferHelper.class);
public static long ByteMask = 0xFF;
public static long ByteMask = 0xFF;
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
}
}
return (short) toNumber(data);
}
}
return (short) toNumber(data);
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
}
}
return (int) toNumber(data);
}
}
return (int) toNumber(data);
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
}
}
return (long) toNumber(data);
}
}
return (long) toNumber(data);
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
}
}
int startOffset = data.length * NetUtils.NumBitsInAByte - numBits;
}
}
int startOffset = data.length * NetUtils.NumBitsInAByte - numBits;
throw new Exception(
"Container is too small for the number of requiested bits");
} catch (Exception e) {
throw new Exception(
"Container is too small for the number of requiested bits");
} catch (Exception e) {
}
}
int startOffset = data.length * NetUtils.NumBitsInAByte - numBits;
}
}
int startOffset = data.length * NetUtils.NumBitsInAByte - numBits;
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
throw new Exception(
"Container is too small for the number of requested bits");
} catch (Exception e) {
}
}
if (numBits > data.length * NetUtils.NumBitsInAByte) {
}
}
if (numBits > data.length * NetUtils.NumBitsInAByte) {
throw new Exception(
"Trying to read more bits than contained in the data buffer");
} catch (Exception e) {
throw new Exception(
"Trying to read more bits than contained in the data buffer");
} catch (Exception e) {
}
}
int startOffset = data.length * NetUtils.NumBitsInAByte - numBits;
}
}
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.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
/**
* Class that represents the IPv4 packet objects
*/
public class IPv4 extends Packet {
*/
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";
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) {
try {
payloadLength = payload.serialize().length;
} catch (Exception e) {
}
this.setTotalLength((short) (this.getHeaderLen() + payloadLength));
}
}
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.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
/**
* Abstract class which represents the generic network packet object
*/
public abstract class Packet {
*/
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
// Access level granted to this packet
protected boolean writeAccess;
// When deserialized from wire, packet could result corrupted
.getHostAddress()
+ " ");
} catch (UnknownHostException e) {
.getHostAddress()
+ " ");
} catch (UnknownHostException e) {
}
} else {
ret.append(((Long) BitBufferHelper.getLong(entry.getValue()))
}
} else {
ret.append(((Long) BitBufferHelper.getLong(entry.getValue()))
import java.util.regex.Matcher;
import java.util.regex.Pattern;
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
/**
* Utility class containing the common utility functions needed
* for operating on networking data structures
*
*/
public abstract class NetUtils {
*
*/
public abstract class NetUtils {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(NetUtils.class);
/**
* Constant holding the number of bits in a byte
*/
/**
* Constant holding the number of bits in a byte
*/
try {
ip = InetAddress.getByAddress(NetUtils.intToByteArray4(address));
} catch (UnknownHostException e) {
try {
ip = InetAddress.getByAddress(NetUtils.intToByteArray4(address));
} catch (UnknownHostException e) {
try {
return InetAddress.getByAddress(address);
} catch (UnknownHostException e) {
try {
return InetAddress.getByAddress(address);
} catch (UnknownHostException e) {
try {
address = InetAddress.getByName(addressString);
} catch (UnknownHostException e) {
try {
address = InetAddress.getByName(addressString);
} catch (UnknownHostException e) {
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.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
/**
* The class provides helper functions to create a node connector
*
*/
public abstract class NodeConnectorCreator {
*
*/
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
/**
* Generic NodeConnector creator
* The nodeConnector type is inferred from the node type
return new NodeConnector(NodeConnectorIDType.OPENFLOW,
(Short) portId, node);
} catch (ConstructionException e1) {
return new NodeConnector(NodeConnectorIDType.OPENFLOW,
(Short) portId, node);
} catch (ConstructionException e1) {
try {
return new NodeConnector(nodeConnectorType, portId, node);
} catch (ConstructionException e1) {
try {
return new NodeConnector(nodeConnectorType, portId, node);
} catch (ConstructionException e1) {
try {
return new NodeConnector(NodeConnectorIDType.OPENFLOW, portId, node);
} catch (ConstructionException e1) {
try {
return new NodeConnector(NodeConnectorIDType.OPENFLOW, portId, node);
} catch (ConstructionException e1) {
}
return nodeConnectors;
} catch (ConstructionException e1) {
}
return nodeConnectors;
} catch (ConstructionException e1) {
import org.opendaylight.controller.sal.core.ConstructionException;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.Node.NodeIDType;
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
/**
* Utility class for creating a Node object
*
*/
public abstract class NodeCreator {
*
*/
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) {
public static Node createOFNode(Long switchId) {
try {
return new Node(NodeIDType.OPENFLOW, switchId);
} catch (ConstructionException e1) {
import java.io.*;
import java.util.ArrayList;
import java.io.*;
import java.util.ArrayList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Convenience object to write a file
*
/**
* Convenience object to write a file
*
*
*/
public class WriteToFile {
*
*/
public class WriteToFile {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(WriteToFile.class);
private FileWriter fstream;
private BufferedWriter bufferOut;
private String fileName;
private FileWriter fstream;
private BufferedWriter bufferOut;
private String fileName;
try {
this.bufferOut.flush();
} catch (IOException e) {
try {
this.bufferOut.flush();
} catch (IOException e) {
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.controller.sal.utils.EtherTypes;
import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
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 {
public class ActionTest {
+ protected static final Logger logger = LoggerFactory
+ .getLogger(ActionTest.class);
@Test
public void tesActionCreationValidation() {
Action action = new PopVlan();
@Test
public void tesActionCreationValidation() {
Action action = new PopVlan();
try {
ip = InetAddress.getByName("171.71.9.52");
} catch (UnknownHostException e) {
try {
ip = InetAddress.getByName("171.71.9.52");
} catch (UnknownHostException e) {
}
action = new SetNwSrc(ip);
}
action = new SetNwSrc(ip);
try {
ip = InetAddress.getByName("2001:420:281:1003:f2de:f1ff:fe71:728d");
} catch (UnknownHostException e) {
try {
ip = InetAddress.getByName("2001:420:281:1003:f2de:f1ff:fe71:728d");
} catch (UnknownHostException e) {
}
action = new SetNwSrc(ip);
Assert.assertTrue(action.isValid());
}
action = new SetNwSrc(ip);
Assert.assertTrue(action.isValid());
try {
ip = InetAddress.getByName("1.1.1.1");
} catch (UnknownHostException e) {
try {
ip = InetAddress.getByName("1.1.1.1");
} catch (UnknownHostException e) {
}
actions.add(new SetDlSrc(mac));
}
actions.add(new SetDlSrc(mac));
try {
data = pkt.serialize();
} catch (Exception e) {
try {
data = pkt.serialize();
} catch (Exception e) {
return null;
}
if (data.length <= 0) {
return null;
}
if (data.length <= 0) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
}
ci.println(this.addFlow(node, getSampleFlow(node)));
}
}
ci.println(this.addFlow(node, getSampleFlow(node)));
}
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
}
Flow flowA = getSampleFlow(node);
Flow flowB = getSampleFlow(node);
}
Flow flowA = getSampleFlow(node);
Flow flowB = getSampleFlow(node);
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
}
ci.println(this.removeFlow(node, getSampleFlow(node)));
}
}
ci.println(this.removeFlow(node, getSampleFlow(node)));
}
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
}
ci.println(this.addFlow(node, getSampleFlowV6(node)));
}
}
ci.println(this.addFlow(node, getSampleFlowV6(node)));
}
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
}
ci.println(this.removeFlow(node, getSampleFlowV6(node)));
}
}
ci.println(this.removeFlow(node, getSampleFlowV6(node)));
}
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
}
List<FlowOnNode> list = (cached) ? this.readAllFlows(node) : this
.nonCachedReadAllFlows(node);
}
List<FlowOnNode> list = (cached) ? this.readAllFlows(node) : this
.nonCachedReadAllFlows(node);
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
}
Flow flow = getSampleFlow(node);
FlowOnNode flowOnNode = (cached) ? this.readFlow(node, flow) : this
}
Flow flow = getSampleFlow(node);
FlowOnNode flowOnNode = (cached) ? this.readFlow(node, flow) : this
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
}
List<NodeConnectorStatistics> list = (cached) ? this
.readNodeConnectors(node) : this
}
List<NodeConnectorStatistics> list = (cached) ? this
.readNodeConnectors(node) : this
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
try {
node = new Node(NodeIDType.OPENFLOW, Long.valueOf(nodeId));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
}
NodeDescription desc = (cached) ? this.readDescription(node) : this
.nonCachedReadDescription(node);
}
NodeDescription desc = (cached) ? this.readDescription(node) : this
.nonCachedReadDescription(node);
import org.opendaylight.controller.sal.core.impl.NotificationModule;\r
\r
\r
import org.opendaylight.controller.sal.core.impl.NotificationModule;\r
\r
\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+ protected static final Logger logger = LoggerFactory\r
+ .getLogger(SALDemo.class);\r
\r
static BrokerImpl broker;\r
static DemoProviderImpl provider;\r
\r
static BrokerImpl broker;\r
static DemoProviderImpl provider;\r
}\r
} catch (IOException e) {\r
\r
}\r
} catch (IOException e) {\r
\r
import java.text.SimpleDateFormat;\r
import java.util.Date;\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
* 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
* \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
\r
private SimpleDateFormat revisionFormat = new SimpleDateFormat("yyyy-MM-dd");\r
\r
namespace.getPort(), namespace.getPath(), query,\r
namespace.getFragment());\r
} catch (URISyntaxException e) {\r
namespace.getPort(), namespace.getPath(), query,\r
namespace.getFragment());\r
} catch (URISyntaxException e) {\r
}\r
return compositeURI;\r
}\r
}\r
return compositeURI;\r
}\r
}
}catch (UnknownHostException e) {
lbsLogger.error("Pool member not found in the network : {}",e.getMessage());
}
}catch (UnknownHostException e) {
lbsLogger.error("Pool member not found in the network : {}",e.getMessage());
import org.opendaylight.controller.sal.utils.GUIField;
import org.opendaylight.controller.switchmanager.SpanConfig;
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 {
/**
* 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() };
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) {
NodeConnectorIDType.OPENFLOW, Short.valueOf(j),
node));
} catch (ConstructionException e) {
NodeConnectorIDType.OPENFLOW, Short.valueOf(elem),
node));
} catch (NumberFormatException e) {
NodeConnectorIDType.OPENFLOW, Short.valueOf(elem),
node));
} catch (NumberFormatException e) {
} catch (ConstructionException e) {
} catch (ConstructionException e) {
try {
nis = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e1) {
try {
nis = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e1) {
return null;
}
byte[] MAC = null;
return null;
}
byte[] MAC = null;
try {
MAC = ni.getHardwareAddress();
} catch (SocketException e) {
try {
MAC = ni.getHardwareAddress();
} catch (SocketException e) {
}
if (MAC != null) {
return MAC;
}
if (MAC != null) {
return MAC;