Merging in the mastership implementation
diff --git a/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java b/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java
new file mode 100644
index 0000000..eb363a7
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/core/INetMapTopologyObjects.java
@@ -0,0 +1,113 @@
+package net.floodlightcontroller.core;
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import com.tinkerpop.blueprints.Direction;
+import com.tinkerpop.frames.Adjacency;
+import com.tinkerpop.frames.Incidence;
+import com.tinkerpop.frames.Property;
+import com.tinkerpop.frames.annotations.gremlin.GremlinGroovy;
+import com.tinkerpop.frames.VertexFrame;
+
+public interface INetMapTopologyObjects {
+	
+public interface IBaseObject extends VertexFrame {
+	
+	@JsonProperty("state")
+	@Property("state")
+	public String getState();
+	@Property("state")
+	public void setState(final String state);
+	
+	@JsonIgnore
+	@Property("type")
+	public String getType();
+	@Property("type")
+	public void setType(final String type);
+	
+}
+	
+public interface ISwitchObject extends IBaseObject{
+		
+		@JsonProperty("dpid")
+		@Property("dpid")
+		public String getDPID();
+		
+		@Property("dpid")
+		public void setDPID(String dpid);
+				
+		@JsonProperty("ports")
+		@Adjacency(label="on")
+		public Iterable<IPortObject> getPorts();
+		
+		@Adjacency(label="on")
+		public void addPort(final IPortObject port);
+		
+		@Adjacency(label="on")
+		public void removePort(final IPortObject port);
+		
+		@JsonIgnore
+		@GremlinGroovy("_().out('on').out('host')")
+		public Iterable<IDeviceObject> getDevices();
+	}
+	
+	public interface IPortObject extends IBaseObject{
+				
+		@JsonProperty("number")
+		@Property("number")
+		public Short getNumber();
+		
+		@JsonProperty("desc")
+		@Property("desc")
+		public String getDesc();
+		
+		@JsonIgnore
+		@Incidence(label="on",direction = Direction.IN)
+		public ISwitchObject getSwitch();
+		
+		@JsonIgnore
+		@Adjacency(label="host")
+		public Iterable<IDeviceObject> getDevices();
+		
+		@Adjacency(label="host")
+		public void setDevice(final IDeviceObject device);
+		
+		@Adjacency(label="host")
+		public void removeDevice(final IDeviceObject device);
+		
+//		@JsonIgnore
+//		@Adjacency(label="link")
+//		public Iterable<ILinkObject> getLinks();
+	}
+	
+	public interface IDeviceObject extends IBaseObject {
+		
+		@JsonProperty("mac")
+		@Property("dl_addr")
+		public String getMACAddress();
+		@Property("dl_addr")
+		public void setMACAddress();
+		
+		@JsonProperty("ipv4")
+		@Property("nw_addr")
+		public String getIPAddress();
+		@Property("dl_addr")
+		public void setIPAddress();
+		
+		@JsonIgnore
+		@Incidence(label="host",direction = Direction.IN)
+		public IPortObject getPort();
+		
+		@JsonIgnore
+		@GremlinGroovy("_().in('host').in('on')")
+		public ISwitchObject getSwitch();
+				
+		public interface AttachmentPoint {
+			@GremlinGroovy("_().in('host').in('on').dpid")
+			public String getDPID();
+			@GremlinGroovy("_().in('host').number")
+			public Short getPortNumber();
+		}
+	}
+}
diff --git a/src/main/java/net/floodlightcontroller/core/INetMapTopologyService.java b/src/main/java/net/floodlightcontroller/core/INetMapTopologyService.java
index f0c7f7f..e5df25e 100644
--- a/src/main/java/net/floodlightcontroller/core/INetMapTopologyService.java
+++ b/src/main/java/net/floodlightcontroller/core/INetMapTopologyService.java
@@ -2,7 +2,7 @@
 
 import java.util.List;
 
-import net.floodlightcontroller.core.ISwitchStorage.ISwitchObject;
+import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
 import net.floodlightcontroller.routing.Link;
 import net.floodlightcontroller.topology.NodePortTuple;
 
diff --git a/src/main/java/net/floodlightcontroller/core/ISwitchStorage.java b/src/main/java/net/floodlightcontroller/core/ISwitchStorage.java
index 5e81000..5a1e1a7 100644
--- a/src/main/java/net/floodlightcontroller/core/ISwitchStorage.java
+++ b/src/main/java/net/floodlightcontroller/core/ISwitchStorage.java
@@ -1,6 +1,9 @@
 package net.floodlightcontroller.core;
 
 import java.util.Collection;
+
+import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
+
 import org.codehaus.jackson.annotate.JsonIgnore;
 import org.codehaus.jackson.annotate.JsonProperty;
 import org.openflow.protocol.OFPhysicalPort;
@@ -17,52 +20,7 @@
 		INACTIVE,
 		ACTIVE
 	}
-
-	public interface ISwitchObject extends VertexFrame{
-		
-		@JsonProperty("dpid")
-		@Property("dpid")
-		public String getDPID();
-		
-		@JsonProperty("state")
-		@Property("state")
-		public String getState();
-		
-		@JsonIgnore
-		@Property("type")
-		public String getType();
-		
-		@JsonProperty("ports")
-		@Adjacency(label="on")
-		public Iterable<IPortObject> getPorts();
-	}
 	
-	public interface IPortObject extends VertexFrame{
-		
-		@JsonProperty("state")
-		@Property("state")
-		public int getState();
-		
-		@JsonIgnore
-		@Property("type")
-		public String getType();
-		
-		@JsonProperty("number")
-		@Property("number")
-		public Short getNumber();
-		
-		@JsonProperty("desc")
-		@Property("desc")
-		public String getDesc();
-		
-		@JsonIgnore
-		@Incidence(label="on",direction = Direction.IN)
-		public ISwitchObject getSwitch();
-		
-//		@JsonIgnore
-//		@Adjacency(label="link")
-//		public Iterable<ILinkObject> getLinks();
-	}
 	/*
 	 * Update the switch details
 	 */
diff --git a/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java b/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java
index 72c6b50..3cb8163 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java
@@ -22,6 +22,7 @@
 import com.tinkerpop.frames.FramedGraph;
 import com.tinkerpop.gremlin.java.GremlinPipeline;
 
+import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
 import net.floodlightcontroller.core.ISwitchStorage;
 
 public class SwitchStorageImpl implements ISwitchStorage {
diff --git a/src/main/java/net/floodlightcontroller/core/internal/TopoSwitchServiceImpl.java b/src/main/java/net/floodlightcontroller/core/internal/TopoSwitchServiceImpl.java
index cb2eb46..1136a90 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/TopoSwitchServiceImpl.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/TopoSwitchServiceImpl.java
@@ -2,8 +2,8 @@
 
 import java.util.List;
 
+import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
 import net.floodlightcontroller.core.INetMapTopologyService.ITopoSwitchService;
-import net.floodlightcontroller.core.ISwitchStorage.ISwitchObject;
 
 public class TopoSwitchServiceImpl implements ITopoSwitchService {
 	
diff --git a/src/main/java/net/floodlightcontroller/core/web/TopoSwitchesResource.java b/src/main/java/net/floodlightcontroller/core/web/TopoSwitchesResource.java
index e75d26a..c5b7e66 100644
--- a/src/main/java/net/floodlightcontroller/core/web/TopoSwitchesResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/TopoSwitchesResource.java
@@ -2,7 +2,7 @@
 
 import java.util.Iterator;
 
-import net.floodlightcontroller.core.ISwitchStorage.ISwitchObject;
+import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
 import net.floodlightcontroller.core.internal.TopoSwitchServiceImpl;
 
 import org.restlet.resource.Get;
diff --git a/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
new file mode 100644
index 0000000..d9f19ba
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/FlowManager.java
@@ -0,0 +1,149 @@
+package net.floodlightcontroller.flowcache;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.flowcache.IFlowService;
+import net.floodlightcontroller.flowcache.web.FlowWebRoutable;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.floodlightcontroller.util.CallerId;
+import net.floodlightcontroller.util.DataPathEndpoints;
+import net.floodlightcontroller.util.FlowId;
+import net.floodlightcontroller.util.FlowPath;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class FlowManager implements IFloodlightModule, IFlowService {
+
+    protected IRestApiService restApi;
+
+    /** The logger. */
+    private static Logger logger =
+	LoggerFactory.getLogger(FlowReconcileManager.class);
+
+    @Override
+    public Collection<Class<? extends IFloodlightService>> getModuleServices() {
+        Collection<Class<? extends IFloodlightService>> l = 
+            new ArrayList<Class<? extends IFloodlightService>>();
+        l.add(IFlowService.class);
+        return l;
+    }
+
+    @Override
+    public Map<Class<? extends IFloodlightService>, IFloodlightService> 
+			       getServiceImpls() {
+        Map<Class<? extends IFloodlightService>,
+        IFloodlightService> m = 
+            new HashMap<Class<? extends IFloodlightService>,
+                IFloodlightService>();
+        m.put(IFlowService.class, this);
+        return m;
+    }
+
+    @Override
+    public Collection<Class<? extends IFloodlightService>> 
+                                                    getModuleDependencies() {
+	Collection<Class<? extends IFloodlightService>> l =
+	    new ArrayList<Class<? extends IFloodlightService>>();
+	l.add(IRestApiService.class);
+        return l;
+    }
+
+    @Override
+    public void init(FloodlightModuleContext context)
+	throws FloodlightModuleException {
+	restApi = context.getServiceImpl(IRestApiService.class);
+    }
+
+    @Override
+    public void startUp(FloodlightModuleContext context) {
+	restApi.addRestletRoutable(new FlowWebRoutable());
+    }
+
+    /**
+     * Add a flow.
+     *
+     * Internally, ONOS will automatically register the installer for
+     * receiving Flow Path Notifications for that path.
+     *
+     * @param flowPath the Flow Path to install.
+     * @param flowId the return-by-reference Flow ID as assigned internally.
+     * @return true on success, otherwise false.
+     */
+    @Override
+    public boolean addFlow(FlowPath flowPath, FlowId flowId) {
+	// TODO
+	return true;
+    }
+
+    /**
+     * Delete a previously added flow.
+     *
+     * @param flowId the Flow ID of the flow to delete.
+     * @return true on success, otherwise false.
+     */
+    @Override
+    public boolean deleteFlow(FlowId flowId) {
+	// TODO
+	return true;
+    }
+
+    /**
+     * Get a previously added flow.
+     *
+     * @param flowId the Flow ID of the flow to get.
+     * @param flowPath the return-by-reference flow path.
+     * @return true on success, otherwise false.
+     */
+    @Override
+    public boolean getFlow(FlowId flowId, FlowPath flowPath) {
+	// TODO
+	return true;
+    }
+
+    /**
+     * Get a previously added flow by a specific installer for given
+     * data path endpoints.
+     *
+     * @param installerId the Caller ID of the installer of the flow to get.
+     * @param dataPathEndpoints the data path endpoints of the flow to get.
+     * @param flowPath the return-by-reference flow path.
+     * @return true on success, otherwise false.
+     */
+    @Override
+    public boolean getFlow(CallerId installerId,
+			   DataPathEndpoints dataPathEndpoints,
+			   FlowPath flowPath) {
+	// TODO
+	return true;
+    }
+
+    /**
+     * Get all installed flows by all installers for given data path endpoints.
+     *
+     * @param dataPathEndpoints the data path endpoints of the flows to get.
+     * @param flowPaths the return-by-reference list of flows.
+     */
+    @Override
+    public void getAllFlows(DataPathEndpoints dataPathEndpoints,
+			    ArrayList<FlowPath> flowPaths) {
+	// TODO
+    }
+
+    /**
+     * Get all installed flows by all installers.
+     *
+     * @param flowPaths the return-by-reference list of flows.
+     */
+    @Override
+    public void getAllFlows(ArrayList<FlowPath> flowPaths) {
+	// TODO
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/IFlowService.java b/src/main/java/net/floodlightcontroller/flowcache/IFlowService.java
new file mode 100644
index 0000000..956caab
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/IFlowService.java
@@ -0,0 +1,72 @@
+package net.floodlightcontroller.flowcache;
+
+import java.util.ArrayList;
+
+import net.floodlightcontroller.core.module.IFloodlightService;
+import net.floodlightcontroller.util.CallerId;
+import net.floodlightcontroller.util.DataPathEndpoints;
+import net.floodlightcontroller.util.FlowId;
+import net.floodlightcontroller.util.FlowPath;
+
+/**
+ * @short Interface for providing Flow Service to other modules.
+ */
+public interface IFlowService extends IFloodlightService {
+    /**
+     * Add a flow.
+     *
+     * Internally, ONOS will automatically register the installer for
+     * receiving Flow Path Notifications for that path.
+     *
+     * @param flowPath the Flow Path to install.
+     * @param flowId the return-by-reference Flow ID as assigned internally.
+     * @return true on success, otherwise false.
+     */
+    boolean addFlow(FlowPath flowPath, FlowId flowId);
+
+    /**
+     * Delete a previously added flow.
+     *
+     * @param flowId the Flow ID of the flow to delete.
+     * @return true on success, otherwise false.
+     */
+    boolean deleteFlow(FlowId flowId);
+
+    /**
+     * Get a previously added flow.
+     *
+     * @param flowId the Flow ID of the flow to get.
+     * @param flowPath the return-by-reference flow path.
+     * @return true on success, otherwise false.
+     */
+    boolean getFlow(FlowId flowId, FlowPath flowPath);
+
+    /**
+     * Get a previously added flow by a specific installer for given
+     * data path endpoints.
+     *
+     * @param installerId the Caller ID of the installer of the flow to get.
+     * @param dataPathEndpoints the data path endpoints of the flow to get.
+     * @param flowPath the return-by-reference flow path.
+     * @return true on success, otherwise false.
+     */
+    boolean getFlow(CallerId installerId,
+		    DataPathEndpoints dataPathEndpoints,
+		    FlowPath flowPath);
+
+    /**
+     * Get all installed flows by all installers for given data path endpoints.
+     *
+     * @param dataPathEndpoints the data path endpoints of the flows to get.
+     * @param flowPaths the return-by-reference list of flows.
+     */
+    void getAllFlows(DataPathEndpoints dataPathEndpoints,
+		     ArrayList<FlowPath> flowPaths);
+
+    /**
+     * Get all installed flows by all installers.
+     *
+     * @param flowPaths the return-by-reference list of flows.
+     */
+    void getAllFlows(ArrayList<FlowPath> flowPaths);
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java
new file mode 100644
index 0000000..35367eb
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java
@@ -0,0 +1,36 @@
+package net.floodlightcontroller.flowcache.web;
+
+import net.floodlightcontroller.flowcache.IFlowService;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AddFlowResource extends ServerResource {
+
+    protected static Logger log = LoggerFactory.getLogger(AddFlowResource.class);
+
+    @Get("json")
+    public Boolean retrieve() {
+	Boolean result = false;
+
+        IFlowService flowService =
+                (IFlowService)getContext().getAttributes().
+                get(IFlowService.class.getCanonicalName());
+
+        if (flowService == null) {
+	    log.debug("ONOS Flow Service not found");
+            return result;
+	}
+
+	// Extract the arguments
+	String flowPathStr = (String) getRequestAttributes().get("flow");
+	log.debug("Add Flow Path: " + flowPathStr);
+
+	// TODO: Implement it.
+	result = true;
+
+        return result;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/DeleteFlowResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/DeleteFlowResource.java
new file mode 100644
index 0000000..f323a54
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/web/DeleteFlowResource.java
@@ -0,0 +1,37 @@
+package net.floodlightcontroller.flowcache.web;
+
+import net.floodlightcontroller.flowcache.IFlowService;
+
+import org.openflow.util.HexString;
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DeleteFlowResource extends ServerResource {
+    protected static Logger log = LoggerFactory.getLogger(DeleteFlowResource.class);
+
+    @Get("json")
+    public Boolean retrieve() {
+	Boolean result = false;
+
+        IFlowService flowService =
+                (IFlowService)getContext().getAttributes().
+                get(IFlowService.class.getCanonicalName());
+
+        if (flowService == null) {
+	    log.debug("ONOS Flow Service not found");
+            return result;
+	}
+
+	// Extract the arguments
+	String flowIdStr = (String) getRequestAttributes().get("flow-id");
+	long flowId = HexString.toLong(flowIdStr);
+	log.debug("Delete Flow Id: " + flowIdStr);
+
+	// TODO: Implement it.
+	result = true;
+
+        return result;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/FlowWebRoutable.java b/src/main/java/net/floodlightcontroller/flowcache/web/FlowWebRoutable.java
new file mode 100644
index 0000000..b1188c8
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/web/FlowWebRoutable.java
@@ -0,0 +1,32 @@
+package net.floodlightcontroller.flowcache.web;
+
+import net.floodlightcontroller.restserver.RestletRoutable;
+
+import org.restlet.Context;
+import org.restlet.Restlet;
+import org.restlet.routing.Router;
+
+public class FlowWebRoutable implements RestletRoutable {
+    /**
+     * Create the Restlet router and bind to the proper resources.
+     */
+    @Override
+    public Restlet getRestlet(Context context) {
+        Router router = new Router(context);
+        router.attach("/add/{flow}/json", AddFlowResource.class);
+        router.attach("/delete/{flow-id}/json", DeleteFlowResource.class);
+        router.attach("/get/{flow-id}/json", GetFlowByIdResource.class);
+        router.attach("/get/{installer-id}/{data-path-endpoints}/json", GetFlowByInstallerIdResource.class);
+        router.attach("/getall/{data-path-endpoints}/json", GetAllFlowsByEndpointsResource.class);
+        router.attach("/getall/json", GetAllFlowsResource.class);
+        return router;
+    }
+
+    /**
+     * Set the base path for the Topology
+     */
+    @Override
+    public String basePath() {
+        return "/wm/flow";
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsByEndpointsResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsByEndpointsResource.java
new file mode 100644
index 0000000..211a051
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsByEndpointsResource.java
@@ -0,0 +1,37 @@
+package net.floodlightcontroller.flowcache.web;
+
+import java.util.ArrayList;
+
+import net.floodlightcontroller.flowcache.IFlowService;
+import net.floodlightcontroller.util.FlowPath;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GetAllFlowsByEndpointsResource extends ServerResource {
+    protected static Logger log = LoggerFactory.getLogger(GetAllFlowsByEndpointsResource.class);
+
+    @Get("json")
+    public ArrayList<FlowPath> retrieve() {
+	ArrayList<FlowPath> result = new ArrayList<FlowPath>();
+
+        IFlowService flowService =
+                (IFlowService)getContext().getAttributes().
+                get(IFlowService.class.getCanonicalName());
+
+        if (flowService == null) {
+	    log.debug("ONOS Flow Service not found");
+            return result;
+	}
+
+	// Extract the arguments
+	String dataPathEndpointsStr = (String) getRequestAttributes().get("data-path-endpoints");
+	log.debug("Get All Flows Endpoints: " + dataPathEndpointsStr);
+
+	// TODO: Implement it.
+
+        return result;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsResource.java
new file mode 100644
index 0000000..9d95651
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/web/GetAllFlowsResource.java
@@ -0,0 +1,36 @@
+package net.floodlightcontroller.flowcache.web;
+
+import java.util.ArrayList;
+
+import net.floodlightcontroller.flowcache.IFlowService;
+import net.floodlightcontroller.util.FlowPath;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GetAllFlowsResource extends ServerResource {
+    protected static Logger log = LoggerFactory.getLogger(GetAllFlowsResource.class);
+
+    @Get("json")
+    public ArrayList<FlowPath> retrieve() {
+	ArrayList<FlowPath> result = new ArrayList<FlowPath>();
+
+        IFlowService flowService =
+                (IFlowService)getContext().getAttributes().
+                get(IFlowService.class.getCanonicalName());
+
+        if (flowService == null) {
+	    log.debug("ONOS Flow Service not found");
+            return result;
+	}
+
+	// Extract the arguments
+	log.debug("Get All Flows Endpoints");
+
+	// TODO: Implement it.
+
+        return result;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/GetFlowByIdResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/GetFlowByIdResource.java
new file mode 100644
index 0000000..99f880c
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/web/GetFlowByIdResource.java
@@ -0,0 +1,37 @@
+package net.floodlightcontroller.flowcache.web;
+
+import net.floodlightcontroller.flowcache.IFlowService;
+import net.floodlightcontroller.util.FlowPath;
+
+import org.openflow.util.HexString;
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GetFlowByIdResource extends ServerResource {
+    protected static Logger log = LoggerFactory.getLogger(GetFlowByIdResource.class);
+
+    @Get("json")
+    public FlowPath retrieve() {
+	FlowPath result = null;
+
+        IFlowService flowService =
+                (IFlowService)getContext().getAttributes().
+                get(IFlowService.class.getCanonicalName());
+
+        if (flowService == null) {
+	    log.debug("ONOS Flow Service not found");
+            return result;
+	}
+
+	// Extract the arguments
+	String flowIdStr = (String) getRequestAttributes().get("flow-id");
+	long flowId = HexString.toLong(flowIdStr);
+	log.debug("Get Flow Id: " + flowIdStr);
+
+	// TODO: Implement it.
+
+        return result;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/GetFlowByInstallerIdResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/GetFlowByInstallerIdResource.java
new file mode 100644
index 0000000..32d20cc
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/flowcache/web/GetFlowByInstallerIdResource.java
@@ -0,0 +1,36 @@
+package net.floodlightcontroller.flowcache.web;
+
+import net.floodlightcontroller.flowcache.IFlowService;
+import net.floodlightcontroller.util.FlowPath;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GetFlowByInstallerIdResource extends ServerResource {
+    protected static Logger log = LoggerFactory.getLogger(GetFlowByInstallerIdResource.class);
+
+    @Get("json")
+    public FlowPath retrieve() {
+	FlowPath result = null;
+
+        IFlowService flowService =
+                (IFlowService)getContext().getAttributes().
+                get(IFlowService.class.getCanonicalName());
+
+        if (flowService == null) {
+	    log.debug("ONOS Flow Service not found");
+            return result;
+	}
+
+	// Extract the arguments
+	String installerIdStr = (String) getRequestAttributes().get("installer-id");
+	String dataPathEndpointsStr = (String) getRequestAttributes().get("data-path-endpoints");
+	log.debug("Get Flow Installer: " + installerIdStr + " Endpoints: " + dataPathEndpointsStr);
+
+	// TODO: Implement it.
+
+        return result;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
index 3aa1fc0..966e180 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
@@ -5,8 +5,8 @@
 import java.util.List;
 import java.util.Set;
 
+import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
 import net.floodlightcontroller.core.INetMapTopologyService.ITopoSwitchService;
-import net.floodlightcontroller.core.ISwitchStorage.ISwitchObject;
 import net.floodlightcontroller.core.internal.TopoSwitchServiceImpl;
 import net.floodlightcontroller.linkdiscovery.ILinkStorage;
 import net.floodlightcontroller.linkdiscovery.LinkInfo;
diff --git a/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java b/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java
index 142453a..90fdb6e 100644
--- a/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java
+++ b/src/main/java/net/floodlightcontroller/routing/TopoRouteService.java
@@ -10,20 +10,8 @@
 
 import org.openflow.util.HexString;
 
-import com.thinkaurelius.titan.core.TitanFactory;
 import com.thinkaurelius.titan.core.TitanGraph;
-// import com.tinkerpop.blueprints.Direction;
 import com.tinkerpop.blueprints.Vertex;
-// import com.tinkerpop.gremlin.groovy.Gremlin;
-// import com.tinkerpop.gremlin.java.GremlinPipeline;
-// import com.tinkerpop.pipes.Pipe;
-// import com.tinkerpop.pipes.PipeFunction;
-// import com.tinkerpop.pipes.branch.LoopPipe;
-// import com.tinkerpop.pipes.branch.LoopPipe.LoopBundle;
-// import com.tinkerpop.pipes.filter.FilterPipe.Filter;
-// import com.tinkerpop.pipes.util.PipesFluentPipeline;
-
-import com.tinkerpop.blueprints.Element;
 
 import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
@@ -56,11 +44,12 @@
 
 	    //
 	    // Implement the Shortest Path between two vertices by using
-	    // the following Gremlin code:
-	    //   results = []; v_src.as('x').out.out.in.has("type", "switch").dedup().loop('x'){it.object.dpid != v_dest.dpid & it.loops < 10}.path().fill(results)
+	    // the following Gremlin CLI code:
+	    //   v_src.as("x").out("on").out("link").in("on").dedup().loop("x"){it.object.dpid != v_dest.dpid}.path(){it.dpid}{it.number}{it.number}
+	    // The equivalent code used here is:
+	    //   results = []; v_src.as("x").out("on").out("link").in("on").dedup().loop("x"){it.object.dpid != v_dest.dpid}.path().fill(results)
 	    //
 
-//	    String gremlin = "v_src.as(\"x\").out.out.in.has(\"type\", \"switch\").dedup().loop(\"x\"){it.object.dpid != v_dest.dpid & it.loops < 10}.path().fill(results)";
 	    String gremlin = "v_src.as(\"x\").out(\"on\").out(\"link\").in(\"on\").dedup().loop(\"x\"){it.object.dpid != v_dest.dpid}.path().fill(results)";
 
 	    // Get the source vertex
@@ -74,7 +63,21 @@
 	    if (! iter.hasNext())
 		return null;		// Destination vertex not found
 	    Vertex v_dest = iter.next();
-	
+
+	    //
+	    // Test whether we are computing a path from/to the same DPID.
+	    // If "yes", then just list the "src" and "dest" in the return
+	    // result.
+	    // NOTE: The return value will change in the future to return
+	    // a single hop/entry instead of two. Currently, we need
+	    // both entries to capture the source and destination ports.
+	    //
+	    if (dpid_src.equals(dpid_dest)) {
+		result_list.add(new NodePortTuple(src));
+		result_list.add(new NodePortTuple(dest));
+		return result_list;
+	    }
+
 	    //
 	    // Implement the Gremlin script and run it
 	    //
diff --git a/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java b/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java
index 4983529..6ac8f29 100644
--- a/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java
+++ b/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java
@@ -18,6 +18,16 @@
     protected short portId; // switch port id
 
     /**
+     * A copy constructor for NodePortTuple.
+     *
+     * @param other the object to copy the state from.
+     */
+    public NodePortTuple(NodePortTuple other) {
+	this.nodeId = other.nodeId;
+	this.portId = other.portId;
+    }
+
+    /**
      * Creates a NodePortTuple
      * @param nodeId The DPID of the switch
      * @param portId The port of the switch
diff --git a/src/main/java/net/floodlightcontroller/util/CallerId.java b/src/main/java/net/floodlightcontroller/util/CallerId.java
new file mode 100644
index 0000000..898da31
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/CallerId.java
@@ -0,0 +1,48 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The class representing a Caller ID for an ONOS component.
+ */
+public class CallerId {
+    private String value;
+
+    /**
+     * Default constructor.
+     */
+    public CallerId() {}
+
+    /**
+     * Constructor from a string value.
+     *
+     * @param value the value to use.
+     */
+    public CallerId(String value) {
+	this.value = value;
+    }
+
+    /**
+     * Get the value of the Caller ID.
+     *
+     * @return the value of the Caller ID.
+     */
+    public String value() { return value; }
+
+    /**
+     * Set the value of the Caller ID.
+     *
+     * @param value the value to set.
+     */
+    public void setValue(String value) {
+	this.value = value;
+    }
+
+    /**
+     * Convert the Caller ID value to a string.
+     *
+     * @return the Caller ID value to a string.
+     */
+    @Override
+    public String toString() {
+	return value;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/DataPath.java b/src/main/java/net/floodlightcontroller/util/DataPath.java
new file mode 100644
index 0000000..2374fbe
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/DataPath.java
@@ -0,0 +1,81 @@
+package net.floodlightcontroller.util;
+
+import java.util.ArrayList;
+
+import net.floodlightcontroller.util.SwitchPort;
+import net.floodlightcontroller.util.FlowEntry;
+
+/**
+ * The class representing the Data Path.
+ */
+public class DataPath {
+    private SwitchPort srcPort;		// The source port
+    private SwitchPort dstPort;		// The destination port
+    private ArrayList<FlowEntry> flowEntries;	// The Flow Entries
+
+    /**
+     * Default constructor.
+     */
+    public DataPath() {
+    }
+
+    /**
+     * Get the data path source port.
+     *
+     * @return the data path source port.
+     */
+    public SwitchPort srcPort() { return srcPort; }
+
+    /**
+     * Set the data path source port.
+     *
+     * @param srcPort the data path source port to set.
+     */
+    public void setSrcPort(SwitchPort srcPort) {
+	this.srcPort = srcPort;
+    }
+
+    /**
+     * Get the data path destination port.
+     *
+     * @return the data path destination port.
+     */
+    public SwitchPort dstPort() { return dstPort; }
+
+    /**
+     * Set the data path destination port.
+     *
+     * @param dstPort the data path destination port to set.
+     */
+    public void setDstPort(SwitchPort dstPort) {
+	this.dstPort = dstPort;
+    }
+
+    /**
+     * Get the data path flow entries.
+     *
+     * @return the data path flow entries.
+     */
+    public ArrayList<FlowEntry> flowEntries() { return flowEntries; }
+
+    /**
+     * Set the data path flow entries.
+     *
+     * @param flowEntries the data path flow entries to set.
+     */
+    public void setFlowEntries(ArrayList<FlowEntry> flowEntries) {
+	this.flowEntries = flowEntries;
+    }
+
+    /**
+     * Convert the data path to a string.
+     *
+     * @return the data path as a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/DataPathEndpoints.java b/src/main/java/net/floodlightcontroller/util/DataPathEndpoints.java
new file mode 100644
index 0000000..5c9e02c
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/DataPathEndpoints.java
@@ -0,0 +1,72 @@
+package net.floodlightcontroller.util;
+
+import net.floodlightcontroller.util.SwitchPort;
+
+/**
+ * The class representing the Data Path Endpoints.
+ */
+public class DataPathEndpoints {
+    private SwitchPort srcPort;		// The source port
+    private SwitchPort dstPort;		// The destination port
+
+    /**
+     * Default constructor.
+     */
+    public DataPathEndpoints() {
+    }
+
+    /**
+     * Constructor for given source and destination ports.
+     *
+     * @param srcPort the source port to use.
+     * @param dstPort the destination port to use.
+     */
+    public DataPathEndpoints(SwitchPort srcPort, SwitchPort dstPort) {
+	this.srcPort = srcPort;
+	this.dstPort = dstPort;
+    }
+
+    /**
+     * Get the data path source port.
+     *
+     * @return the data path source port.
+     */
+    public SwitchPort srcPort() { return srcPort; }
+
+    /**
+     * Set the data path source port.
+     *
+     * @param srcPort the data path source port to set.
+     */
+    public void setSrcPort(SwitchPort srcPort) {
+	this.srcPort = srcPort;
+    }
+
+    /**
+     * Get the data path destination port.
+     *
+     * @return the data path destination port.
+     */
+    public SwitchPort dstPort() { return dstPort; }
+
+    /**
+     * Set the data path destination port.
+     *
+     * @param dstPort the data path destination port to set.
+     */
+    public void setDstPort(SwitchPort dstPort) {
+	this.dstPort = dstPort;
+    }
+
+    /**
+     * Convert the data path endpoints to a string.
+     *
+     * @return the data path endpoints as a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/Dpid.java b/src/main/java/net/floodlightcontroller/util/Dpid.java
new file mode 100644
index 0000000..3a8d1e8
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/Dpid.java
@@ -0,0 +1,54 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The class representing a network switch DPID.
+ */
+public class Dpid {
+    static public long UNKNOWN = 0;
+
+    private long value;
+
+    /**
+     * Default constructor.
+     */
+    public Dpid() {
+	this.value = Dpid.UNKNOWN;
+    }
+
+    /**
+     * Constructor from a long value.
+     *
+     * @param value the value to use.
+     */
+    public Dpid(long value) {
+	this.value = value;
+    }
+
+    /**
+     * Get the value of the DPID.
+     *
+     * @return the value of the DPID.
+     */
+    public long value() { return value; }
+
+    /**
+     * Set the value of the DPID.
+     *
+     * @param value the value to set.
+     */
+    public void setValue(long value) {
+	this.value = value;
+    }
+
+    /**
+     * Convert the DPID value to a ':' separated hex string.
+     *
+     * @return the DPID value as a ':' separated hex string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntry.java b/src/main/java/net/floodlightcontroller/util/FlowEntry.java
new file mode 100644
index 0000000..e9c4bbe
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/FlowEntry.java
@@ -0,0 +1,224 @@
+package net.floodlightcontroller.util;
+
+import net.floodlightcontroller.util.Dpid;
+import net.floodlightcontroller.util.FlowEntryActions;
+import net.floodlightcontroller.util.FlowEntryId;
+import net.floodlightcontroller.util.FlowEntryMatch;
+import net.floodlightcontroller.util.Port;
+
+/**
+ * The Flow Entry state as set by the user (via the ONOS API).
+ */
+enum FlowEntryUserState {
+	FE_USER_UNKNOWN,		// Initialization value: state unknown
+	FE_USER_ADD,			// Flow entry that is added
+	FE_USER_MODIFY,			// Flow entry that is modified
+	FE_USER_DELETE			// Flow entry that is deleted
+}
+
+/**
+ * The Flow Entry state as set by the controller.
+ */
+enum FlowEntrySwitchState {
+	FE_SWITCH_UNKNOWN,		// Initialization value: state unknown
+	FE_SWITCH_NOT_UPDATED,		// Switch not updated with this entry
+	FE_SWITCH_UPDATE_IN_PROGRESS,	// Switch update in progress
+	FE_SWITCH_UPDATED,		// Switch updated with this entry
+	FE_SWITCH_UPDATE_FAILED	// Error updating the switch with this entry
+}
+
+
+/**
+ * The class representing the Flow Entry.
+ *
+ * NOTE: The specification is incomplete. E.g., the entry needs to
+ * support multiple in-ports and multiple out-ports.
+ */
+public class FlowEntry {
+    private FlowEntryId flowEntryId;		// The Flow Entry ID
+    private FlowEntryMatch flowEntryMatch;	// The Flow Entry Match
+    private FlowEntryActions flowEntryActions;	// The Flow Entry Actions
+    private Dpid dpid;				// The Switch DPID
+    private Port inPort;			// The Switch incoming port
+    private Port outPort;			// The Switch outgoing port
+    private FlowEntryUserState flowEntryUserState; // The Flow Entry User state
+    private FlowEntrySwitchState flowEntrySwitchState; // The Flow Entry Switch state
+    // The Flow Entry Error state (if FlowEntrySwitchState is FE_SWITCH_FAILED)
+    private FlowEntryErrorState flowEntryErrorState;
+
+    /**
+     * Default constructor.
+     */
+    public FlowEntry() {
+	flowEntryUserState = FlowEntryUserState.FE_USER_UNKNOWN;
+	flowEntrySwitchState = FlowEntrySwitchState.FE_SWITCH_UNKNOWN;
+    }
+
+    /**
+     * Get the Flow Entry ID.
+     *
+     * @return the Flow Entry ID.
+     */
+    public FlowEntryId flowEntryId() { return flowEntryId; }
+
+    /**
+     * Set the Flow Entry ID.
+     *
+     * @param flowEntryId the Flow Entry ID to set.
+     */
+    public void setFlowEntryId(FlowEntryId flowEntryId) {
+	this.flowEntryId = flowEntryId;
+    }
+
+    /**
+     * Get the Flow Entry Match.
+     *
+     * @return the Flow Entry Match.
+     */
+    public FlowEntryMatch flowEntryMatch() { return flowEntryMatch; }
+
+    /**
+     * Set the Flow Entry Match.
+     *
+     * @param flowEntryMatch the Flow Entry Match to set.
+     */
+    public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
+	this.flowEntryMatch = flowEntryMatch;
+    }
+
+    /**
+     * Get the Flow Entry Actions.
+     *
+     * @return the Flow Entry Actions.
+     */
+    public FlowEntryActions flowEntryActions() { return flowEntryActions; }
+
+    /**
+     * Set the Flow Entry Actions.
+     *
+     * @param flowEntryActions the Flow Entry Actions to set.
+     */
+    public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
+	this.flowEntryActions = flowEntryActions;
+    }
+
+    /**
+     * Get the Switch DPID.
+     *
+     * @return the Switch DPID.
+     */
+    public Dpid dpid() { return dpid; }
+
+    /**
+     * Set the Switch DPID.
+     *
+     * @param dpid the Switch DPID to set.
+     */
+    public void setDpid(Dpid dpid) {
+	this.dpid = dpid;
+    }
+
+    /**
+     * Get the Switch incoming port.
+     *
+     * @return the Switch incoming port.
+     */
+    public Port inPort() { return inPort; }
+
+    /**
+     * Set the Switch incoming port.
+     *
+     * @param inPort the Switch incoming port to set.
+     */
+    public void setInPort(Port inPort) {
+	this.inPort = inPort;
+    }
+
+    /**
+     * Get the Switch outgoing port.
+     *
+     * @return the Switch outgoing port.
+     */
+    public Port outPort() { return outPort; }
+
+    /**
+     * Set the Switch outgoing port.
+     *
+     * @param outPort the Switch outgoing port to set.
+     */
+    public void setOutPort(Port outPort) {
+	this.outPort = outPort;
+    }
+
+    /**
+     * Get the Flow Entry User state.
+     *
+     * @return the Flow Entry User state.
+     */
+    public FlowEntryUserState flowEntryUserState() {
+	return flowEntryUserState;
+    }
+
+    /**
+     * Set the Flow Entry User state.
+     *
+     * @param flowEntryUserState the Flow Entry User state to set.
+     */
+    public void setFlowEntryUserState(FlowEntryUserState flowEntryUserState) {
+	this.flowEntryUserState = flowEntryUserState;
+    }
+
+    /**
+     * Get the Flow Entry Switch state.
+     *
+     * The Flow Entry Error state is used if FlowEntrySwitchState is
+     * FE_SWITCH_FAILED.
+     *
+     * @return the Flow Entry Switch state.
+     */
+    public FlowEntrySwitchState flowEntrySwitchState() {
+	return flowEntrySwitchState;
+    }
+
+    /**
+     * Set the Flow Entry Switch state.
+     *
+     * The Flow Entry Error state is used if FlowEntrySwitchState is
+     * FE_SWITCH_FAILED.
+     *
+     * @param flowEntrySwitchState the Flow Entry Switch state to set.
+     */
+    public void setFlowEntrySwitchState(FlowEntrySwitchState flowEntrySwitchState) {
+	this.flowEntrySwitchState = flowEntrySwitchState;
+    }
+
+    /**
+     * Get the Flow Entry Error state.
+     *
+     * @return the Flow Entry Error state.
+     */
+    public FlowEntryErrorState flowEntryErrorState() {
+	return flowEntryErrorState;
+    }
+
+    /**
+     * Set the Flow Entry Error state.
+     *
+     * @param flowEntryErrorState the Flow Entry Error state to set.
+     */
+    public void setFlowEntryErrorState(FlowEntryErrorState flowEntryErrorState) {
+	this.flowEntryErrorState = flowEntryErrorState;
+    }
+
+    /**
+     * Convert the flow entry to a string.
+     *
+     * @return the flow entry as a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryActions.java b/src/main/java/net/floodlightcontroller/util/FlowEntryActions.java
new file mode 100644
index 0000000..90f42fb
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/FlowEntryActions.java
@@ -0,0 +1,30 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The class representing the Flow Entry set of actions.
+ *
+ * The Flow Entry set of actions need to be applied to each packet.
+ *
+ * NOTE: This is just an empty placeholder (for now). The implied action is
+ * forwarding on a single port.
+ */
+public class FlowEntryActions {
+
+    /**
+     * Default constructor.
+     */
+    public FlowEntryActions() {
+    }
+
+    /**
+     * Convert the set of actions to a string.
+     *
+     * @return the set of actions as a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryErrorState.java b/src/main/java/net/floodlightcontroller/util/FlowEntryErrorState.java
new file mode 100644
index 0000000..63c103d
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/FlowEntryErrorState.java
@@ -0,0 +1,65 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The class representing the Flow Entry error state.
+ */
+public class FlowEntryErrorState {
+    private short type;	// The error type (e.g., see OF-1.3.1 spec, pp. 95)
+    private short code;	// The error code (e.g., see OF-1.3.1 spec, pp. 95)
+
+    /**
+     * Default constructor.
+     */
+    public FlowEntryErrorState() {
+	this.type = 0;
+	this.code = 0;
+    }
+
+    /**
+     * Constructor for a given error type and code.
+     *
+     * @param type the error type to use.
+     * @param code the error code to use.
+     */
+    public FlowEntryErrorState(short type, short code) {
+	this.type = type;
+	this.code = code;
+    }
+
+    /**
+     * Get the error type.
+     *
+     * @return the error type.
+     */
+    public short type() { return type; }
+
+    /**
+     * Get the error code.
+     *
+     * @return the error code.
+     */
+    public short code() { return code; }
+
+    /**
+     * Set the values of the error type and code.
+     *
+     * @param type the error type to use.
+     * @param code the error code to use.
+     */
+    public void setValue(short type, short code) {
+	this.type = type;
+	this.code = code;
+    }
+
+    /**
+     * Convert the error type and code to a string.
+     *
+     * @return the error type and code as a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryId.java b/src/main/java/net/floodlightcontroller/util/FlowEntryId.java
new file mode 100644
index 0000000..4736ed5
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/FlowEntryId.java
@@ -0,0 +1,52 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The class representing a Flow Entry ID.
+ */
+public class FlowEntryId {
+    private long value;
+
+    /**
+     * Default constructor.
+     */
+    public FlowEntryId() {
+	this.value = 0;
+    }
+
+    /**
+     * Constructor from an integer value.
+     *
+     * @param value the value to use.
+     */
+    public FlowEntryId(long value) {
+	this.value = value;
+    }
+
+    /**
+     * Get the value of the Flow Entry ID.
+     *
+     * @return the value of the Flow Entry ID.
+     */
+    public long value() { return value; }
+
+    /**
+     * Set the value of the Flow Entry ID.
+     *
+     * @param value the value to set.
+     */
+    public void setValue(long value) {
+	this.value = value;
+    }
+
+    /**
+     * Convert the Flow Entry ID value to a string.
+     *
+     * @return the Flow Entry ID value to a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryMatch.java b/src/main/java/net/floodlightcontroller/util/FlowEntryMatch.java
new file mode 100644
index 0000000..a8f43f5
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/FlowEntryMatch.java
@@ -0,0 +1,105 @@
+package net.floodlightcontroller.util;
+
+import net.floodlightcontroller.util.MACAddress;
+import net.floodlightcontroller.util.IPv4Net;
+
+/**
+ * The class representing the Flow Entry Matching filter.
+ *
+ * The Flow Entry matching filter that is used to specify
+ * the network data that would be forwarded on the data path from
+ * the source to the destination. Examples: MAC address (of the
+ * sender), IP prefix that includes the destination's IP address, etc.
+ *
+ * NOTE: The FlowEntryMatch specification below is incomplete: we need
+ * more matching fields, we need to indicate which fields need to be
+ * matched, etc.
+ */
+public class FlowEntryMatch {
+    private MACAddress srcMac;		// Matching source MAC address
+    private MACAddress dstMac;		// Matching destination MAC address
+    private IPv4Net srcIPv4Net;		// Matching source IPv4 prefix
+    private IPv4Net dstIPv4Net;		// Matching destination IPv4 prefix
+
+    /**
+     * Default constructor.
+     */
+    public FlowEntryMatch() {
+    }
+
+    /**
+     * Get the matching source MAC address.
+     *
+     * @return the matching source MAC address.
+     */
+    public MACAddress srcMac() { return srcMac; }
+
+    /**
+     * Set the matching source MAC address.
+     *
+     * @param srcMac the matching source MAC address to set.
+     */
+    public void setSrcMac(MACAddress srcMac) {
+	this.srcMac = srcMac;
+    }
+
+    /**
+     * Get the matching destination MAC address.
+     *
+     * @return the matching destination MAC address.
+     */
+    public MACAddress dstMac() { return dstMac; }
+
+    /**
+     * Set the matching destination MAC address.
+     *
+     * @param dstMac the matching destination MAC address to set.
+     */
+    public void setDstMac(MACAddress dstMac) {
+	this.dstMac = dstMac;
+    }
+
+    /**
+     * Get the matching source IPv4 prefix.
+     *
+     * @return the matching source IPv4 prefix.
+     */
+    public IPv4Net srcIPv4Net() { return srcIPv4Net; }
+
+    /**
+     * Set the matching source IPv4 prefix.
+     *
+     * @param srcIPv4Net the matching source IPv4 prefix to set.
+     */
+    public void setSrcIPv4Net(IPv4Net srcIPv4Net) {
+	this.srcIPv4Net = srcIPv4Net;
+    }
+
+    /**
+     * Get the matching destination IPv4 prefix.
+     *
+     * @return the matching destination IPv4 prefix.
+     */
+    public IPv4Net dstIPv4Net() { return dstIPv4Net; }
+
+    /**
+     * Set the matching destination IPv4 prefix.
+     *
+     * @param srcIPv4Net the matching destination IPv4 prefix to set.
+     */
+    public void setDstIPv4Net(IPv4Net dstIPv4Net) {
+	this.dstIPv4Net = dstIPv4Net;
+    }
+
+    /**
+     * Convert the matching filter to a string.
+     *
+     * @return the matching filter as a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowId.java b/src/main/java/net/floodlightcontroller/util/FlowId.java
new file mode 100644
index 0000000..827c1d9
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/FlowId.java
@@ -0,0 +1,52 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The class representing a Flow ID.
+ */
+public class FlowId {
+    private long value;
+
+    /**
+     * Default constructor.
+     */
+    public FlowId() {
+	this.value = 0;
+    }
+
+    /**
+     * Constructor from an integer value.
+     *
+     * @param value the value to use.
+     */
+    public FlowId(long value) {
+	this.value = value;
+    }
+
+    /**
+     * Get the value of the Flow ID.
+     *
+     * @return the value of the Flow ID.
+     */
+    public long value() { return value; }
+
+    /**
+     * Set the value of the Flow ID.
+     *
+     * @param value the value to set.
+     */
+    public void setValue(long value) {
+	this.value = value;
+    }
+
+    /**
+     * Convert the Flow ID value to a string.
+     *
+     * @return the Flow ID value to a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowPath.java b/src/main/java/net/floodlightcontroller/util/FlowPath.java
new file mode 100644
index 0000000..46a1f82
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/FlowPath.java
@@ -0,0 +1,80 @@
+package net.floodlightcontroller.util;
+
+import net.floodlightcontroller.util.CallerId;
+import net.floodlightcontroller.util.DataPath;
+import net.floodlightcontroller.util.FlowId;
+
+/**
+ * The class representing the Flow Path.
+ */
+public class FlowPath {
+    private FlowId flowId;		// The Flow ID
+    private CallerId installerId;	// The Caller ID of the path installer
+    private DataPath dataPath;		// The data path
+
+    /**
+     * Default constructor.
+     */
+    public FlowPath() {
+    }
+
+    /**
+     * Get the flow path Flow ID.
+     *
+     * @return the flow path Flow ID.
+     */
+    public FlowId flowId() { return flowId; }
+
+    /**
+     * Set the flow path Flow ID.
+     *
+     * @param flowId the flow path Flow ID to set.
+     */
+    public void setFlowId(FlowId flowId) {
+	this.flowId = flowId;
+    }
+
+    /**
+     * Get the Caller ID of the flow path installer.
+     *
+     * @return the Caller ID of the flow path installer.
+     */
+    public CallerId installerId() { return installerId; }
+
+    /**
+     * Set the Caller ID of the flow path installer.
+     *
+     * @param installerId the Caller ID of the flow path installer.
+     */
+    public void setInstallerId(CallerId installerId) {
+	this.installerId = installerId;
+    }
+
+    /**
+     * Get the flow path's data path.
+     *
+     * @return the flow path's data path.
+     */
+    public DataPath dataPath() { return dataPath; }
+
+    /**
+     * Set the flow path's data path.
+     *
+     * @param dataPath the flow path's data path to set.
+     */
+    public void setDataPath(DataPath dataPath) {
+	this.dataPath = dataPath;
+    }
+
+    /**
+     * Convert the flow path to a string.
+     *
+     * @return the flow path as a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/IPv4.java b/src/main/java/net/floodlightcontroller/util/IPv4.java
new file mode 100644
index 0000000..b4fc787
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/IPv4.java
@@ -0,0 +1,52 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The class representing an IPv4 address.
+ */
+public class IPv4 {
+    private int value;
+
+    /**
+     * Default constructor.
+     */
+    public IPv4() {
+	this.value = 0;
+    }
+
+    /**
+     * Constructor from an integer value.
+     *
+     * @param value the value to use.
+     */
+    public IPv4(int value) {
+	this.value = value;
+    }
+
+    /**
+     * Get the value of the IPv4 address.
+     *
+     * @return the value of the IPv4 address.
+     */
+    public int value() { return value; }
+
+    /**
+     * Set the value of the IPv4 address.
+     *
+     * @param value the value to set.
+     */
+    public void setValue(int value) {
+	this.value = value;
+    }
+
+    /**
+     * Convert the IPv4 value to a '.' separated string.
+     *
+     * @return the IPv4 value as a '.' separated string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/IPv4Net.java b/src/main/java/net/floodlightcontroller/util/IPv4Net.java
new file mode 100644
index 0000000..6c4c651
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/IPv4Net.java
@@ -0,0 +1,66 @@
+package net.floodlightcontroller.util;
+
+import net.floodlightcontroller.util.IPv4;
+
+/**
+ * The class representing an IPv4 network address.
+ */
+public class IPv4Net {
+    private IPv4 address;		// The IPv4 address
+    private short prefixLen;		// The prefix length
+
+    /**
+     * Default constructor.
+     */
+    public IPv4Net() {
+	this.prefixLen = 0;
+    }
+
+    /**
+     * Constructor for a given address and prefix length.
+     *
+     * @param address the address to use.
+     * @param prefixLen the prefix length to use.
+     */
+    public IPv4Net(IPv4 address, short prefixLen) {
+	this.address = address;
+	this.prefixLen = prefixLen;
+    }
+
+    /**
+     * Get the address value of the IPv4Net address.
+     *
+     * @return the address value of the IPv4Net address.
+     */
+    public IPv4 address() { return address; }
+
+    /**
+     * Get the prefix length value of the IPv4Net address.
+     *
+     * @return the prefix length value of the IPv4Net address.
+     */
+    public short prefixLen() { return prefixLen; }
+
+    /**
+     * Set the value of the IPv4Net address.
+     *
+     * @param address the address to use.
+     * @param prefixLen the prefix length to use.
+     */
+    public void setValue(IPv4 address, short prefixLen) {
+	this.address = address;
+	this.prefixLen = prefixLen;
+    }
+
+    /**
+     * Convert the IPv4Net value to an "address/prefixLen" string.
+     *
+     * @return the IPv4Net value as an "address/prefixLen" string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/IPv6.java b/src/main/java/net/floodlightcontroller/util/IPv6.java
new file mode 100644
index 0000000..dfa071b
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/IPv6.java
@@ -0,0 +1,67 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The class representing an IPv6 address.
+ */
+public class IPv6 {
+    private long valueHigh;	// The higher (more significant) 64 bits
+    private long valueLow;	// The lower (less significant) 64 bits
+
+    /**
+     * Default constructor.
+     */
+    public IPv6() {
+	this.valueHigh = 0;
+	this.valueLow = 0;
+    }
+
+    /**
+     * Constructor from integer values.
+     *
+     * @param valueHigh the higher (more significant) 64 bits of the address.
+     * @param valueLow the lower (less significant) 64 bits of the address.
+     */
+    public IPv6(long valueHigh, long valueLow) {
+	this.valueHigh = valueHigh;
+	this.valueLow = valueLow;
+    }
+
+    /**
+     * Get the value of the higher (more significant) 64 bits of the address.
+     *
+     * @return the value of the higher (more significant) 64 bits of the
+     * address.
+     */
+    public long valueHigh() { return valueHigh; }
+
+    /**
+     * Get the value of the lower (less significant) 64 bits of the address.
+     *
+     * @return the value of the lower (less significant) 64 bits of the
+     * address.
+     */
+    public long valueLow() { return valueLow; }
+
+    /**
+     * Set the value of the IPv6 address.
+     *
+     * @param valueHigh the higher (more significant) 64 bits of the address.
+     * @param valueLow the lower (less significant) 64 bits of the address.
+     */
+    public void setValue(long valueHigh, long valueLow) {
+	this.valueHigh = valueHigh;
+	this.valueLow = valueLow;
+    }
+
+    /**
+     * Convert the IPv6 value to a ':' separated string.
+     *
+     * @return the IPv6 value as a ':' separated string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/IPv6Net.java b/src/main/java/net/floodlightcontroller/util/IPv6Net.java
new file mode 100644
index 0000000..85de4f7
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/IPv6Net.java
@@ -0,0 +1,66 @@
+package net.floodlightcontroller.util;
+
+import net.floodlightcontroller.util.IPv6;
+
+/**
+ * The class representing an IPv6 network address.
+ */
+public class IPv6Net {
+    private IPv6 address;		// The IPv6 address
+    private short prefixLen;		// The prefix length
+
+    /**
+     * Default constructor.
+     */
+    public IPv6Net() {
+	this.prefixLen = 0;
+    }
+
+    /**
+     * Constructor for a given address and prefix length.
+     *
+     * @param address the address to use.
+     * @param prefixLen the prefix length to use.
+     */
+    public IPv6Net(IPv6 address, short prefixLen) {
+	this.address = address;
+	this.prefixLen = prefixLen;
+    }
+
+    /**
+     * Get the address value of the IPv6Net address.
+     *
+     * @return the address value of the IPv6Net address.
+     */
+    public IPv6 address() { return address; }
+
+    /**
+     * Get the prefix length value of the IPv6Net address.
+     *
+     * @return the prefix length value of the IPv6Net address.
+     */
+    public short prefixLen() { return prefixLen; }
+
+    /**
+     * Set the value of the IPv6Net address.
+     *
+     * @param address the address to use.
+     * @param prefixLen the prefix length to use.
+     */
+    public void setValue(IPv6 address, short prefixLen) {
+	this.address = address;
+	this.prefixLen = prefixLen;
+    }
+
+    /**
+     * Convert the IPv6Net value to an "address/prefixLen" string.
+     *
+     * @return the IPv6Net value as an "address/prefixLen" string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/Port.java b/src/main/java/net/floodlightcontroller/util/Port.java
new file mode 100644
index 0000000..8fbb727
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/Port.java
@@ -0,0 +1,52 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The class representing a network port of a switch.
+ */
+public class Port {
+    private short value;
+
+    /**
+     * Default constructor.
+     */
+    public Port() {
+	this.value = 0;
+    }
+
+    /**
+     * Constructor from a long value.
+     *
+     * @param value the value to use.
+     */
+    public Port(short value) {
+	this.value = value;
+    }
+
+    /**
+     * Get the value of the port.
+     *
+     * @return the value of the port.
+     */
+    public short value() { return value; }
+
+    /**
+     * Set the value of the port.
+     *
+     * @param value the value to set.
+     */
+    public void setValue(short value) {
+	this.value = value;
+    }
+
+    /**
+     * Convert the port value to a string.
+     *
+     * @return the port value as a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/util/SwitchPort.java b/src/main/java/net/floodlightcontroller/util/SwitchPort.java
new file mode 100644
index 0000000..31061bc
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/SwitchPort.java
@@ -0,0 +1,66 @@
+package net.floodlightcontroller.util;
+
+import net.floodlightcontroller.util.Dpid;
+import net.floodlightcontroller.util.Port;
+
+/**
+ * The class representing a Switch-Port.
+ */
+public class SwitchPort {
+    private Dpid dpid;		// The DPID of the switch
+    private Port port;		// The port of the switch
+
+    /**
+     * Default constructor.
+     */
+    public SwitchPort() {
+    }
+
+    /**
+     * Constructor for a given DPID and a port.
+     *
+     * @param dpid the DPID to use.
+     * @param port the port to use.
+     */
+    public SwitchPort(Dpid dpid, Port port) {
+	this.dpid = dpid;
+	this.port = port;
+    }
+
+    /**
+     * Get the DPID value of the Switch-Port.
+     *
+     * @return the DPID value of the Switch-Port.
+     */
+    public Dpid dpid() { return dpid; }
+
+    /**
+     * Get the port value of the Switch-Port.
+     *
+     * @return the port value of the Switch-Port.
+     */
+    public Port port() { return port; }
+
+    /**
+     * Set the DPID and port values of the Switch-Port.
+     *
+     * @param dpid the DPID to use.
+     * @param port the port to use.
+     */
+    public void setValue(Dpid dpid, Port port) {
+	this.dpid = dpid;
+	this.port = port;
+    }
+
+    /**
+     * Convert the Switch-Port value to a string.
+     *
+     * @return the Switch-Port value as a string.
+     */
+    @Override
+    public String toString() {
+	String ret = "";
+	// TODO: Implement it!
+	return ret;
+    }
+}
diff --git a/src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java b/src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java
index 177769b..b4a044f 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java
@@ -7,7 +7,6 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.List;
 
 import net.floodlightcontroller.core.ISwitchStorage;
 import net.floodlightcontroller.core.ISwitchStorage.SwitchState;
@@ -19,16 +18,10 @@
 import org.openflow.protocol.OFPhysicalPort;
 
 import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Direction;
 import com.tinkerpop.blueprints.Vertex;
-import com.tinkerpop.gremlin.groovy.Gremlin;
 import com.tinkerpop.gremlin.java.GremlinPipeline;
-import com.tinkerpop.pipes.Pipe;
 import com.tinkerpop.pipes.PipeFunction;
-import com.tinkerpop.pipes.branch.LoopPipe;
 import com.tinkerpop.pipes.branch.LoopPipe.LoopBundle;
-import com.tinkerpop.pipes.filter.FilterPipe.Filter;
-import com.tinkerpop.pipes.util.PipesFluentPipeline;
 
 import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
@@ -168,8 +161,7 @@
 	    }
 	    public Boolean compute(LoopBundle<Vertex> bundle) {
 		Boolean output = false;
-		if ((bundle.getObject().getProperty("dpid") != dpid) && 
-		    (bundle.getLoops() < 10)) {
+		if (bundle.getObject().getProperty("dpid") != dpid) {
 		    output = true;
 		}
 		return output;
@@ -183,11 +175,15 @@
 
 	    //
 	    // Implement the Shortest Path between two vertices by using
-	    // the following Gremlin code:
-	    //   results = []; v_src.as('x').out.out.in.has("type", "switch").dedup().loop('x'){it.object.dpid != v_dest.dpid & it.loops < 10}.path().fill(results)
+	    // the following Gremlin CLI code:
+	    //   v_src.as("x").out("on").out("link").in("on").dedup().loop("x"){it.object.dpid != v_dest.dpid}.path(){it.dpid}{it.number}{it.number}
+	    // The equivalent code used here is:
+	    //   results = []; v_src.as("x").out("on").out("link").in("on").dedup().loop("x"){it.object.dpid != v_dest.dpid}.path().fill(results)
 	    //
 
-	    String gremlin = "v_src.as(\"x\").out.out.in.has(\"type\", \"switch\").dedup().loop(\"x\"){it.object.dpid != v_dest.dpid & it.loops < 10}.path().fill(results)";
+	    String gremlin = "v_src.as(\"x\").out(\"on\").out(\"link\").in(\"on\").dedup().loop(\"x\"){it.object.dpid != v_dest.dpid}.path().fill(results)";
+
+	    String gremlin_nopath = "v_src.as(\"x\").out(\"on\").out(\"link\").in(\"on\").dedup().loop(\"x\"){it.object.dpid != \"NO-SUCH-DPID\"}.path().fill(results)";
 
 	    // Get the source vertex
 	    Iterator<Vertex> iter = titanGraph.getVertices("dpid", dpid_src).iterator();
@@ -255,11 +251,25 @@
 	    //
 	    // XXX: An alternative (faster?) solution that fails to compile
 	    //
-	    MyLoopFunction whileFunction = new MyLoopFunction(dpid_dest);
-	    GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
-	    // pipe.start(v_src).as("x").out().out().in().has("type", "switch").dedup().loop("x", whileFunction);
+	    // MyLoopFunction whileFunction = new MyLoopFunction(dpid_dest);
+	    // GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>();
+	    // ArrayList<ArrayList<Vertex>> results2 = new ArrayList<ArrayList<Vertex>>();
+	    // TODO: The statement below doesn't compile
+	    // pipe.start(v_src).as("x").out("on").out("link").in("on").dedup().loop("x", whileFunction).path().fill(results2);
 
 	    // Check the result
 	    assertEquals(results_str, expected_result);
+
+	    //
+	    // Test Shortest-Path computation to non-existing destination
+	    //
+	    results.clear();
+	    try {
+		engine.eval(gremlin_nopath);
+	    } catch (ScriptException e) {
+		System.err.println("Caught ScriptException running Gremlin script: " + e.getMessage());
+		return;
+	    }
+	    assertTrue(results.size() == 0);
 	}
 }