Add JavaDoc comment for test code.
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
index 015514e..2a4c2b9 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
@@ -84,55 +84,13 @@
}
if (currLinks.contains(vportDst)) {
+ // TODO: update linkinfo
if (op.equals(DM_OPERATION.INSERT) || op.equals(DM_OPERATION.CREATE)) {
log.debug("addOrUpdateLink(): failed link exists {} {} src {} dst {}",
new Object[]{op, lt, vportSrc, vportDst});
- } else if (op.equals(DM_OPERATION.UPDATE)) {
- // TODO: update linkinfo
- // GraphDB seems to have no KeyIndex for LinkInfo data
-
- // BEGIN: trial code (update implementation)
- if(linkinfo != null) {
- vportSrc.setPortState(linkinfo.getSrcPortState());
- vportDst.setPortState(linkinfo.getDstPortState());
-
- Vertex vsrc = vportSrc.asVertex();
- vsrc.setProperty("first_seen_time", linkinfo.getFirstSeenTime());
- vsrc.setProperty("last_lldp_received_time", linkinfo.getUnicastValidTime());
- vsrc.setProperty("last_bddp_received_time", linkinfo.getMulticastValidTime());
-
-// for(Edge e: vportSrc.asVertex().getEdges(Direction.OUT)) {
-// if(e.getVertex(Direction.OUT).equals(vportDst.asVertex())) {
-// e.setProperty("first_seen_time", linkinfo.getFirstSeenTime());
-// e.setProperty("last_lldp_received_time", linkinfo.getUnicastValidTime());
-// e.setProperty("last_bddp_received_time", linkinfo.getMulticastValidTime());
-// }
-// }
-
- conn.endTx(Transaction.COMMIT);
- log.debug("addOrUpdateLink(): link updated {} {} src {} dst {}", new Object[]{op, lt, vportSrc, vportDst});
- }
- // END: trial code
}
} else {
- if (op.equals(DM_OPERATION.UPDATE)) {
- log.debug("addOrUpdateLink(): failed link doesn't exist {} {} src {} dst {}",
- new Object[]{op, lt, vportSrc, vportDst});
- } else {
- vportSrc.setLinkPort(vportDst);
-
- // BEGIN: trial code (update implementation)
- if(linkinfo != null) {
- vportSrc.setPortState(linkinfo.getSrcPortState());
- vportDst.setPortState(linkinfo.getDstPortState());
-
- Vertex vsrc = vportSrc.asVertex();
- vsrc.setProperty("first_seen_time", linkinfo.getFirstSeenTime());
- vsrc.setProperty("last_lldp_received_time", linkinfo.getUnicastValidTime());
- vsrc.setProperty("last_bddp_received_time", linkinfo.getMulticastValidTime());
- }
- // END: trial code
- }
+ vportSrc.setLinkPort(vportDst);
conn.endTx(Transaction.COMMIT);
log.debug("updateLink(): link added {} {} src {} dst {}", new Object[]{op, lt, vportSrc, vportDst});
@@ -191,13 +149,6 @@
}*/
vportSrc.removeLink(vportDst);
- // BEGIN: trial code (update implementation)
- Vertex vsrc = vportSrc.asVertex();
- vsrc.removeProperty("first_seen_time");
- vsrc.removeProperty("last_lldp_received_time");
- vsrc.removeProperty("last_bddp_received_time");
- // END: trial code
-
conn.endTx(Transaction.COMMIT);
log.debug("deleteLink(): deleted edges src {} dst {}", new Object[]{
lt, vportSrc, vportDst});
@@ -264,19 +215,23 @@
}
}
+ // TODO: Fix me
@Override
public List<Link> getLinks(String dpid) {
GraphDBConnection conn = GraphDBConnection.getInstance(this.conf);
ISwitchObject vswitch;
List<Link> links = new ArrayList<Link>();
+ // BEGIN: Trial code
+ // author: Naoki Shiota
vswitch = conn.utils().searchSwitch(conn, dpid);
for(IPortObject vportSrc : vswitch.getPorts()) {
- // TODO array concatenation may be heavy
+ // array concatenation may be heavy...
List<Link> sublinks = getLinks(HexString.toLong(dpid), vportSrc.getNumber());
links.addAll(sublinks);
}
+ // END: Trial code
return links;
}
diff --git a/src/main/java/net/onrc/onos/util/GraphDBConnection.java b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
index 7041329..478763c 100644
--- a/src/main/java/net/onrc/onos/util/GraphDBConnection.java
+++ b/src/main/java/net/onrc/onos/util/GraphDBConnection.java
@@ -7,7 +7,6 @@
import com.thinkaurelius.titan.core.TitanFactory;
import com.thinkaurelius.titan.core.TitanGraph;
-import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.TransactionalGraph;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.util.wrappers.event.EventTransactionalGraph;
@@ -73,43 +72,6 @@
Vertex.class);
}
- // BEGIN: trial code
- /*
- * Trial to store link state information as properties of port.
- * Currently no need to be implemented. Just reference.
- */
- // These keys are assigned to port vertex with "OUT" direction link
-// if (!s_vertices.contains("first_seen_time")) {
-// graph.createKeyIndex("first_seen_time", Vertex.class);
-// }
-// if (!s_vertices.contains("last_lldp_received_time")) {
-// graph.createKeyIndex("last_lldp_received_time", Vertex.class);
-// }
-// if (!s_vertices.contains("last_bddp_received_time")) {
-// graph.createKeyIndex("last_bddp_received_time", Vertex.class);
-// }
-//
-//
-// Set<String> s_edges = graph.getIndexedKeys(Edge.class);
-// if (!s_edges.contains("src_port_state")) {
-// graph.createKeyIndex("src_port_state",
-// Edge.class);
-// }
-// if (!s_edges.contains("dst_port_state")) {
-// graph.createKeyIndex("dst_port_state",
-// Edge.class);
-// }
-// if (!s_edges.contains("first_seen_time")) {
-// graph.createKeyIndex("first_seen_time", Edge.class);
-// }
-// if (!s_edges.contains("last_lldp_received_time")) {
-// graph.createKeyIndex("last_lldp_received_time", Edge.class);
-// }
-// if (!s_edges.contains("last_bddp_received_time")) {
-// graph.createKeyIndex("last_bddp_received_time", Edge.class);
-// }
- // END: trial code
-
graph.commit();
eg = new EventTransactionalGraph<TitanGraph>(graph);
}