Optimized code
diff --git a/src/main/java/net/onrc/onos/graph/DBOperation.java b/src/main/java/net/onrc/onos/graph/DBOperation.java
index fdb6e38..f9b0e9f 100644
--- a/src/main/java/net/onrc/onos/graph/DBOperation.java
+++ b/src/main/java/net/onrc/onos/graph/DBOperation.java
@@ -43,7 +43,6 @@
@Override
public ISwitchObject newSwitch(final String dpid) {
- System.out.println("newSwitch: " + conn.getFramedGraph());
ISwitchObject obj = (ISwitchObject) conn.getFramedGraph().addVertex(null, ISwitchObject.class);
if (obj != null) {
obj.setType("switch");
@@ -85,7 +84,6 @@
@Override
public IPortObject newPort(String dpid, Short portNum) {
- System.out.println("newPort: " + conn.getFramedGraph());
IPortObject obj = (IPortObject) conn.getFramedGraph().addVertex(null, IPortObject.class);
if (obj != null) {
obj.setType("port");
@@ -95,6 +93,21 @@
}
return obj;
}
+
+ /**
+ * Create a port having specified port number.
+ *
+ * @param portNumber port number
+ */
+ @Deprecated
+ public IPortObject newPort(Short portNumber) {
+ IPortObject obj = (IPortObject) conn.getFramedGraph().addVertex(null, IPortObject.class);
+ if (obj != null) {
+ obj.setType("port");
+ obj.setNumber(portNumber);
+ }
+ return obj;
+ }
public IPortObject searchPort(String dpid, Short number, final FramedGraph fg) {
String id = dpid + number.toString();
@@ -105,7 +118,6 @@
@Override
public IDeviceObject newDevice() {
- System.out.println("newDevice: " + conn.getFramedGraph());
IDeviceObject obj = (IDeviceObject) conn.getFramedGraph().addVertex(null, IDeviceObject.class);
if (obj != null) {
obj.setType("device");
@@ -113,6 +125,10 @@
return obj;
}
+ /**
+ * Create and return a flow path object.
+ */
+
@Override
public IFlowPath newFlowPath() {
IFlowPath flowPath = (IFlowPath)conn.getFramedGraph().addVertex(null, IFlowPath.class);
@@ -180,8 +196,9 @@
return nonNullFlows;
}
- protected IFlowEntry newFlowEntry(final FramedGraph fg) {
- IFlowEntry flowEntry = (IFlowEntry) fg.addVertex(null, IFlowEntry.class);
+ @Override
+ public IFlowEntry newFlowEntry() {
+ IFlowEntry flowEntry = (IFlowEntry) conn.getFramedGraph().addVertex(null, IFlowEntry.class);
if (flowEntry != null) {
flowEntry.setType("flow_entry");
}