Created the outline of the Forwarding module for reactive forwarding on top of the network map
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/module/OnosModuleLoader.java b/src/main/java/net/onrc/onos/ofcontroller/core/module/OnosModuleLoader.java
index bd7cf49..f3d0da5 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/module/OnosModuleLoader.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/module/OnosModuleLoader.java
@@ -16,6 +16,8 @@
 import net.floodlightcontroller.topology.ITopologyService;
 import net.onrc.onos.ofcontroller.core.config.DefaultConfiguration;
 import net.onrc.onos.ofcontroller.core.config.IConfigInfoService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.forwarding.Forwarding;
 import net.onrc.onos.ofcontroller.proxyarp.IProxyArpService;
 import net.onrc.onos.ofcontroller.proxyarp.ProxyArpManager;
 
@@ -25,11 +27,14 @@
 	private IDeviceService deviceService;
 	private IConfigInfoService config;
 	private IRestApiService restApi;
+	private IFlowService flowService;
 
 	private ProxyArpManager arpManager;
+	private Forwarding forwarding;
 	
 	public OnosModuleLoader() {
 		arpManager = new ProxyArpManager();
+		forwarding = new Forwarding();
 	}
 	
 	@Override
@@ -57,6 +62,7 @@
 		dependencies.add(IDeviceService.class);
 		//dependencies.add(IConfigInfoService.class);
 		dependencies.add(IRestApiService.class);
+		dependencies.add(IFlowService.class);
 		return dependencies;
 	}
 
@@ -67,6 +73,7 @@
 		topology = context.getServiceImpl(ITopologyService.class);
 		deviceService = context.getServiceImpl(IDeviceService.class);
 		restApi = context.getServiceImpl(IRestApiService.class);
+		flowService = context.getServiceImpl(IFlowService.class);
 		
 		//This could be null because it's not mandatory to have an
 		//IConfigInfoService loaded.
@@ -76,11 +83,13 @@
 		}
 
 		arpManager.init(floodlightProvider, topology, deviceService, config, restApi);
+		forwarding.init(floodlightProvider, flowService);
 	}
 
 	@Override
 	public void startUp(FloodlightModuleContext context) {
 		arpManager.startUp();
+		forwarding.startUp();
 	}
 
 }
diff --git a/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
new file mode 100644
index 0000000..d6bac5c
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/forwarding/Forwarding.java
@@ -0,0 +1,157 @@
+package net.onrc.onos.ofcontroller.forwarding;
+
+import java.util.Iterator;
+
+import net.floodlightcontroller.core.FloodlightContext;
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IOFMessageListener;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.packet.Ethernet;
+import net.floodlightcontroller.util.MACAddress;
+import net.onrc.onos.ofcontroller.core.IDeviceStorage;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
+import net.onrc.onos.ofcontroller.flowmanager.FlowManager;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
+import net.onrc.onos.ofcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.util.CallerId;
+import net.onrc.onos.ofcontroller.util.DataPath;
+import net.onrc.onos.ofcontroller.util.Dpid;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.util.FlowPath;
+import net.onrc.onos.ofcontroller.util.FlowPathType;
+import net.onrc.onos.ofcontroller.util.FlowPathUserState;
+import net.onrc.onos.ofcontroller.util.Port;
+import net.onrc.onos.ofcontroller.util.SwitchPort;
+
+import org.openflow.protocol.OFMessage;
+import org.openflow.protocol.OFPacketIn;
+import org.openflow.protocol.OFType;
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Forwarding implements IOFMessageListener {
+	private final static Logger log = LoggerFactory.getLogger(Forwarding.class);
+
+	private IFloodlightProviderService floodlightProvider;
+	private IFlowService flowService;
+	
+	private IDeviceStorage deviceStorage;
+	private TopologyManager topologyService;
+	
+	public Forwarding() {
+		
+	}
+	
+	public void init(IFloodlightProviderService floodlightProvider, 
+			IFlowService flowService) {
+		this.floodlightProvider = floodlightProvider;
+		this.flowService = flowService;
+		
+		floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
+		
+		deviceStorage = new DeviceStorageImpl();
+		deviceStorage.init("");
+		topologyService = new TopologyManager();
+		topologyService.init("");
+	}
+	
+	public void startUp() {
+		// no-op
+	}
+
+	@Override
+	public String getName() {
+		return "onosforwarding";
+	}
+
+	@Override
+	public boolean isCallbackOrderingPrereq(OFType type, String name) {
+		return (type == OFType.PACKET_IN) && 
+				(name.equals("devicemanager") || name.equals("proxyarpmanager"));
+	}
+
+	@Override
+	public boolean isCallbackOrderingPostreq(OFType type, String name) {
+		return false;
+	}
+
+	@Override
+	public Command receive(
+			IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
+		
+		if (msg.getType() != OFType.PACKET_IN) {
+			return Command.CONTINUE;
+		}
+		
+		OFPacketIn pi = (OFPacketIn) msg;
+		
+		Ethernet eth = IFloodlightProviderService.bcStore.
+				get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
+		
+		// We don't want to handle broadcast traffic
+		if (eth.isBroadcast()) {
+			return Command.CONTINUE;
+		}
+		
+		handlePacketIn(sw, pi, eth);
+		
+		return Command.STOP;
+	}
+	
+	private void handlePacketIn(IOFSwitch sw, OFPacketIn pi, Ethernet eth) {
+		String destinationMac = HexString.toHexString(eth.getDestinationMACAddress()); 
+		
+		IDeviceObject deviceObject = deviceStorage.getDeviceByMac(
+				destinationMac);
+		
+		if (deviceObject == null) {
+			log.debug("No device entry found for {}", destinationMac);
+			return;
+		}
+		
+		Iterator<IPortObject> ports = deviceObject.getAttachedPorts().iterator();
+		if (!ports.hasNext()) {
+			log.debug("No attachment point found for device {}", destinationMac);
+			return;
+		}
+		IPortObject portObject = ports.next();
+		short destinationPort = portObject.getNumber();
+		ISwitchObject switchObject = portObject.getSwitch();
+		long destinationDpid = HexString.toLong(switchObject.getDPID());
+		
+		SwitchPort srcSwitchPort = new SwitchPort(
+				new Dpid(sw.getId()), new Port(pi.getInPort())); 
+		SwitchPort dstSwitchPort = new SwitchPort(
+				new Dpid(destinationDpid), new Port(destinationPort)); 
+		DataPath shortestPath = 
+				topologyService.getDatabaseShortestPath(srcSwitchPort, dstSwitchPort);
+		
+		if (shortestPath == null) {
+			log.debug("Shortest path not found between {} and {}", 
+					srcSwitchPort, dstSwitchPort);
+			return;
+		}
+		
+		MACAddress srcMacAddress = MACAddress.valueOf(eth.getSourceMACAddress());
+		MACAddress dstMacAddress = MACAddress.valueOf(eth.getDestinationMACAddress());
+		
+		FlowId flowId = new FlowId(1L); //dummy flow ID
+		FlowPath flowPath = new FlowPath();
+		flowPath.setFlowId(flowId);
+		flowPath.setInstallerId(new CallerId("Forwarding"));
+		flowPath.setFlowPathType(FlowPathType.FP_TYPE_SHORTEST_PATH);
+		flowPath.setFlowPathUserState(FlowPathUserState.FP_USER_ADD);
+		flowPath.flowEntryMatch().enableSrcMac(srcMacAddress);
+		flowPath.flowEntryMatch().enableDstMac(dstMacAddress);
+		// For now just forward IPv4 packets. This prevents accidentally
+		// other stuff like ARP.
+		flowPath.flowEntryMatch().enableEthernetFrameType(Ethernet.TYPE_IPv4);
+		flowService.addFlow(flowPath, flowId);
+		//flowService.addAndMaintainShortestPathFlow(shortestPath.)
+	}
+
+}