Revert LinkStorageImpl not to remove ExtractLink class.
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
index 766eae7..8187c06 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
@@ -16,6 +16,12 @@
import org.slf4j.LoggerFactory;
import com.thinkaurelius.titan.core.TitanException;
+import com.tinkerpop.blueprints.Direction;
+import com.tinkerpop.blueprints.Edge;
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.gremlin.java.GremlinPipeline;
+import com.tinkerpop.pipes.PipeFunction;
+import com.tinkerpop.pipes.transform.PathPipe;
public class LinkStorageImpl implements ILinkStorage {
@@ -139,6 +145,7 @@
@Override
public void deleteLink(Link lt) {
IPortObject vportSrc = null, vportDst = null;
+ int count = 0;
log.debug("deleteLink(): {}", lt);
@@ -295,6 +302,33 @@
return links;
}
+ // FIXME Scope changed to public to allow access from TopoLinkServiceImpl. Move class definition to appropriate place.
+ static public class ExtractLink implements PipeFunction<PathPipe<Vertex>, Link> {
+
+ @Override
+ public Link compute(PathPipe<Vertex> pipe ) {
+ // TODO Auto-generated method stub
+ long s_dpid = 0;
+ long d_dpid = 0;
+ short s_port = 0;
+ short d_port = 0;
+ List<Vertex> V = new ArrayList<Vertex>();
+ V = pipe.next();
+ Vertex src_sw = V.get(0);
+ Vertex dest_sw = V.get(3);
+ Vertex src_port = V.get(1);
+ Vertex dest_port = V.get(2);
+ s_dpid = HexString.toLong((String) src_sw.getProperty("dpid"));
+ d_dpid = HexString.toLong((String) dest_sw.getProperty("dpid"));
+ s_port = (Short) src_port.getProperty("number");
+ d_port = (Short) dest_port.getProperty("number");
+
+ Link l = new Link(s_dpid,s_port,d_dpid,d_port);
+
+ return l;
+ }
+ }
+
/**
* Finalize the object.
*/