Merge branch 'master' into netgraphrefactor
Conflicts:
src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
src/test/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImplTest.java
diff --git a/README.md b/README.md
index 6e65f51..ea1553a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,45 @@
ONOS
====
-Open Networking Operating System
\ No newline at end of file
+Open Networking Operating System
+
+BELOW TO BE WRITTEN IN DETAIL
+
+
+Building ONOS
+-------------
+
+0. Install custom jars (Only need to be run only once)
+
+ $ ./setup-local-jar.sh
+
+1. Cleanly Build ONOS
+
+ $ mvn clean
+ $ mvn compile
+
+Running ONOS
+------------
+
+
+1. Start zookeeper
+
+ $ cd (ZOOKEEPER-INSTALL-DIR)/bin
+
+ $ ./zkServer.sh start
+
+2. Start cassandra
+
+ $ ./start-cassandra.sh start
+
+ 1. Confirm cassandra is running
+
+ $ ./start-cassandra.sh status
+
+3. Start ONOS instance
+
+ $ ./start-onos.sh start
+
+4. Start ONOS rest apis
+
+ $ ./start-rest.sh start
diff --git a/cluster-mgmt/common/onos.properties b/cluster-mgmt/common/onos.properties
index 9c3d557..13fca75 100644
--- a/cluster-mgmt/common/onos.properties
+++ b/cluster-mgmt/common/onos.properties
@@ -8,11 +8,11 @@
net.floodlightcontroller.counter.CounterStore,\
net.floodlightcontroller.perfmon.PktInProcessingTime,\
net.floodlightcontroller.ui.web.StaticWebRoutable,\
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher, \
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher, \
net.onrc.onos.registry.controller.ZookeeperRegistry
net.floodlightcontroller.restserver.RestApiServer.port = 8080
net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
net.floodlightcontroller.jython.JythonDebugInterface.port = 6655
net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher.dbconf = /tmp/cassandra.titan
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = /tmp/cassandra.titan
diff --git a/conf/onos-embedded.properties b/conf/onos-embedded.properties
index a328d2a..83e5ad3 100644
--- a/conf/onos-embedded.properties
+++ b/conf/onos-embedded.properties
@@ -6,12 +6,12 @@
net.floodlightcontroller.counter.CounterStore,\
net.floodlightcontroller.perfmon.PktInProcessingTime,\
net.floodlightcontroller.ui.web.StaticWebRoutable,\
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher, \
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher, \
net.onrc.onos.registry.controller.ZookeeperRegistry
net.floodlightcontroller.restserver.RestApiServer.port = 8080
net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
net.floodlightcontroller.core.FloodlightProvider.workerthreads = 48
net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher.dbconf = conf/titan-embedded.properties
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = conf/titan-embedded.properties
diff --git a/conf/onos.properties b/conf/onos.properties
index 7e060b7..c1e2d27 100644
--- a/conf/onos.properties
+++ b/conf/onos.properties
@@ -6,12 +6,12 @@
net.floodlightcontroller.counter.CounterStore,\
net.floodlightcontroller.perfmon.PktInProcessingTime,\
net.floodlightcontroller.ui.web.StaticWebRoutable,\
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher, \
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher, \
net.onrc.onos.registry.controller.ZookeeperRegistry
net.floodlightcontroller.restserver.RestApiServer.port = 8080
net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
net.floodlightcontroller.core.FloodlightProvider.workerthreads = 16
net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher.dbconf = /tmp/cassandra.titan
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = /tmp/cassandra.titan
diff --git a/pom.xml b/pom.xml
index 90043e7..98d0e61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
- <mainClass>net.floodlightcontroller.core.Main</mainClass>
+ <mainClass>net.onrc.onos.ofcontroller.core.Main</mainClass>
</configuration>
<executions>
</executions>
diff --git a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
index 16fdd19..c6d89a9 100644
--- a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
+++ b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
@@ -16,7 +16,7 @@
import net.floodlightcontroller.storage.IStorageSourceService;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.registry.controller.IControllerRegistryService;
public class FloodlightProvider implements IFloodlightModule {
@@ -52,6 +52,7 @@
dependencies.add(IRestApiService.class);
dependencies.add(ICounterStoreService.class);
dependencies.add(IThreadPoolService.class);
+ // Following added by ONOS
dependencies.add(IFlowService.class);
dependencies.add(ITopoRouteService.class);
dependencies.add(IControllerRegistryService.class);
@@ -71,6 +72,7 @@
context.getServiceImpl(IRestApiService.class));
controller.setThreadPoolService(
context.getServiceImpl(IThreadPoolService.class));
+ // Following added by ONOS
controller.setFlowService(context.getServiceImpl(IFlowService.class));
controller.setTopoRouteService(context.getServiceImpl(ITopoRouteService.class));
controller.setMastershipService(
diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
index df609e7..d63624c 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
@@ -338,12 +338,6 @@
Object removeAttribute(String name);
/**
- * Setup an unconnected switch with the info required.
- * @param dpid of the switch
- */
- public void setupRemoteSwitch(Long dpid);
-
- /**
* Clear all flowmods on this switch
*/
public void clearAllFlowMods();
diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java b/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java
index f8dd52c..1bc258b 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java
@@ -17,8 +17,6 @@
package net.floodlightcontroller.core;
-import org.openflow.protocol.OFPhysicalPort;
-
/**
*
*
@@ -46,16 +44,6 @@
public void switchPortChanged(Long switchId);
/**
- * Fired when ports on a switch area added
- */
- public void switchPortAdded(Long switchId, OFPhysicalPort port);
-
- /**
- * Fired when ports on a switch area removed
- */
- public void switchPortRemoved(Long switchId, OFPhysicalPort port);
-
- /**
* The name assigned to this listener
* @return
*/
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index 878427a..e40f24a 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -73,10 +73,9 @@
import net.floodlightcontroller.storage.OperatorPredicate;
import net.floodlightcontroller.storage.StorageException;
import net.floodlightcontroller.threadpool.IThreadPoolService;
-import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
+import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
-import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.registry.controller.IControllerRegistryService;
import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
import net.onrc.onos.registry.controller.RegistryException;
@@ -140,14 +139,20 @@
import org.slf4j.LoggerFactory;
-
/**
* The main controller class. Handles all setup and network listeners
+ *
+ * Extensions made by ONOS are:
+ * - Detailed Port event: PORTCHANGED -> {PORTCHANGED, PORTADDED, PORTREMOVED}
+ * Available as net.onrc.onos.ofcontroller.core.IOFSwitchPortListener
+ * - Distributed ownership control of switch through RegistryService(IControllerRegistryService)
+ * - Register ONOS services. (IFlowService, ITopoRouteService, IControllerRegistryService)
+ * - Additional DEBUG logs
+ * - Try using hostname as controller ID, when ID was not explicitly given.
*/
public class Controller implements IFloodlightProviderService,
IStorageSourceListener {
-
-
+
protected static Logger log = LoggerFactory.getLogger(Controller.class);
private static final String ERROR_DATABASE =
@@ -270,10 +275,11 @@
}
/**
* Update message indicating a switch was added or removed
+ * ONOS: This message extended to indicate Port add or removed event.
*/
protected class SwitchUpdate implements IUpdate {
public IOFSwitch sw;
- public OFPhysicalPort port;
+ public OFPhysicalPort port; // Added by ONOS
public SwitchUpdateType switchUpdateType;
public SwitchUpdate(IOFSwitch sw, SwitchUpdateType switchUpdateType) {
this.sw = sw;
@@ -302,10 +308,14 @@
listener.switchPortChanged(sw.getId());
break;
case PORTADDED:
- listener.switchPortAdded(sw.getId(), port);
+ if (listener instanceof IOFSwitchPortListener) {
+ ((IOFSwitchPortListener) listener).switchPortAdded(sw.getId(), port);
+ }
break;
case PORTREMOVED:
- listener.switchPortRemoved(sw.getId(), port);
+ if (listener instanceof IOFSwitchPortListener) {
+ ((IOFSwitchPortListener) listener).switchPortRemoved(sw.getId(), port);
+ }
break;
default:
break;
@@ -804,10 +814,9 @@
dfuture);
}
-
+
volatile Boolean controlRequested = Boolean.FALSE;
protected void checkSwitchReady() {
-
if (state.hsState == HandshakeState.FEATURES_REPLY &&
state.hasDescription && state.hasGetConfigReply) {
@@ -1143,7 +1152,7 @@
}
state.firstRoleReplyReceived = true;
Role requestedRole =
- sw.deliverRoleRequestNotSupported(error.getXid());
+ sw.deliverRoleRequestNotSupportedEx(error.getXid());
synchronized(roleChanger) {
if (sw.role == null && Controller.this.role==Role.SLAVE) {
//This will now never happen. The Controller's role
@@ -1622,7 +1631,6 @@
// from slave controllers. Then we need to move this cancelation
// to switch disconnect
sw.cancelAllStatisticsReplies();
-
// FIXME: I think there's a race condition if we call updateInactiveSwitchInfo
// here if role support is enabled. In that case if the switch is being
@@ -1634,7 +1642,6 @@
// of the switch state that's written to storage.
updateInactiveSwitchInfo(sw);
-
SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.REMOVED);
try {
this.updates.put(update);
@@ -2228,13 +2235,11 @@
this.updates = new LinkedBlockingQueue<IUpdate>();
this.factory = new BasicFactory();
this.providerMap = new HashMap<String, List<IInfoProvider>>();
-
setConfigParams(configParams);
//this.role = getInitialRole(configParams);
//Set the controller's role to MASTER so it always tries to do role requests.
this.role = Role.MASTER;
this.roleChanger = new RoleChanger();
-
initVendorMessages();
this.systemStartTime = System.currentTimeMillis();
}
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
index e0ff8c3..0eca19c 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
@@ -44,6 +44,7 @@
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.floodlightcontroller.util.TimedCache;
+import net.onrc.onos.ofcontroller.core.IOnosRemoteSwitch;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
@@ -75,7 +76,7 @@
/**
* This is the internal representation of an openflow switch.
*/
-public class OFSwitchImpl implements IOFSwitch {
+public class OFSwitchImpl implements IOFSwitch, IOnosRemoteSwitch {
// TODO: should we really do logging in the class or should we throw
// exception that can then be handled by callers?
protected static Logger log = LoggerFactory.getLogger(OFSwitchImpl.class);
@@ -268,7 +269,7 @@
public void disconnectOutputStream() {
channel.close();
}
-
+
@Override
@JsonIgnore
public void setFeaturesReply(OFFeaturesReply featuresReply) {
@@ -787,7 +788,18 @@
* Otherwise we ignore it.
* @param xid
*/
- protected Role deliverRoleRequestNotSupported(int xid) {
+ protected void deliverRoleRequestNotSupported(int xid) {
+ deliverRoleRequestNotSupportedEx(xid);
+ }
+
+ /**
+ * ONOS Extension to deliverRoleRequestNotSupported().
+ * This version return the Roll request made.
+ * @see deliverRoleRequestNotSupported
+ * @param xid
+ * @return Role of attempted RoleRequest.
+ */
+ protected Role deliverRoleRequestNotSupportedEx(int xid) {
synchronized(pendingRoleRequests) {
PendingRoleRequestEntry head = pendingRoleRequests.poll();
this.role = null;
diff --git a/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java b/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
index b2de649..4924fbc 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
@@ -277,8 +277,9 @@
// Handle cases #1 and #2
log.debug("Sending NxRoleRequest to {}", sw);
sw.sendNxRoleRequest(role, cookie);
- } else {
+ } else {
if (role == Role.MASTER) {
+ // ONOS extension:
log.debug("Switch {} doesn't support NxRoleRequests, but sending " +
"{} request anyway", sw, role);
//Send the role request anyway, even though we know the switch
diff --git a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
index 95053bd..7604d7c 100644
--- a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
+++ b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
@@ -20,9 +20,9 @@
import net.floodlightcontroller.core.module.ModuleLoaderResource;
import net.floodlightcontroller.restserver.RestletRoutable;
import net.onrc.onos.ofcontroller.core.web.ClearFlowTableResource;
+import net.onrc.onos.ofcontroller.core.web.TopoLinksResource;
import net.onrc.onos.ofcontroller.core.web.TopoSwitchesResource;
import net.onrc.onos.ofcontroller.devicemanager.web.TopoDevicesResource;
-import net.onrc.onos.ofcontroller.linkdiscovery.web.TopoLinksResource;
import org.restlet.Context;
import org.restlet.Restlet;
@@ -63,6 +63,7 @@
router.attach("/role/json", ControllerRoleResource.class);
router.attach("/health/json", HealthCheckResource.class);
router.attach("/system/uptime/json", SystemUptimeResource.class);
+ // Following added by ONOS
router.attach("/topology/switches/{filter}/json", TopoSwitchesResource.class);
router.attach("/topology/links/json", TopoLinksResource.class);
router.attach("/topology/devices/json", TopoDevicesResource.class);
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
index 1be942c..648866f 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
@@ -1,9 +1,9 @@
package net.floodlightcontroller.core.web;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.internal.EventHistoryTopologyCluster;
-import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import net.floodlightcontroller.util.EventHistory;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.EventHistoryTopologyCluster;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
index 4a21070..79c4006 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
@@ -1,9 +1,9 @@
package net.floodlightcontroller.core.web;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.internal.EventHistoryTopologyLink;
-import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import net.floodlightcontroller.util.EventHistory;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.EventHistoryTopologyLink;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
index 1c95e2c..4a81db4 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
@@ -1,9 +1,9 @@
package net.floodlightcontroller.core.web;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.internal.EventHistoryTopologySwitch;
-import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import net.floodlightcontroller.util.EventHistory;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.EventHistoryTopologySwitch;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
index feccdc4..04543ac 100755
--- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
@@ -59,7 +59,6 @@
import net.floodlightcontroller.flowcache.IFlowReconcileListener;
import net.floodlightcontroller.flowcache.IFlowReconcileService;
import net.floodlightcontroller.flowcache.OFMatchReconcile;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
import net.floodlightcontroller.packet.ARP;
import net.floodlightcontroller.packet.DHCP;
import net.floodlightcontroller.packet.Ethernet;
@@ -71,6 +70,7 @@
import net.floodlightcontroller.topology.ITopologyListener;
import net.floodlightcontroller.topology.ITopologyService;
import net.floodlightcontroller.util.MultiIterator;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
import static net.floodlightcontroller.devicemanager.internal.
DeviceManagerImpl.DeviceUpdate.Change.*;
diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java
index 371a479..4ed59d7 100644
--- a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java
+++ b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java
@@ -39,7 +39,6 @@
import org.openflow.protocol.OFFlowRemoved;
import org.openflow.protocol.OFMatch;
import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPhysicalPort;
import org.openflow.protocol.OFType;
import org.openflow.protocol.factory.BasicFactory;
import org.openflow.util.HexString;
@@ -676,17 +675,5 @@
Map<String, String> removedControllerNodeIPs) {
// ignore
}
-
- @Override
- public void switchPortAdded(Long switchId, OFPhysicalPort port) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
- // TODO Auto-generated method stub
-
- }
}
diff --git a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java
index cc62e82..31032c9 100644
--- a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java
+++ b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java
@@ -5,7 +5,7 @@
import java.util.Set;
import net.floodlightcontroller.core.module.IFloodlightService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
public interface ITopologyService extends IFloodlightService {
diff --git a/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java b/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java
index 6ac8f29..4983529 100644
--- a/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java
+++ b/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java
@@ -18,16 +18,6 @@
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/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
index 27f4df2..a47a5f2 100644
--- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
+++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java
@@ -28,8 +28,6 @@
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.core.util.SingletonTask;
import net.floodlightcontroller.counter.ICounterStoreService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
import net.floodlightcontroller.packet.BSN;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.packet.LLDP;
@@ -39,7 +37,8 @@
import net.floodlightcontroller.routing.Route;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.floodlightcontroller.topology.web.TopologyWebRoutable;
-import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketIn;
diff --git a/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java b/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java
index 7989413..4f844b2 100644
--- a/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java
+++ b/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java
@@ -3,8 +3,9 @@
import org.restlet.Context;
import org.restlet.routing.Router;
-import net.floodlightcontroller.linkdiscovery.web.LinksResource;
import net.floodlightcontroller.restserver.RestletRoutable;
+import net.onrc.onos.ofcontroller.linkdiscovery.web.LinksResource;
+import net.onrc.onos.ofcontroller.topology.web.RouteResource;
public class TopologyWebRoutable implements RestletRoutable {
/**
diff --git a/src/main/java/net/floodlightcontroller/util/MACAddress.java b/src/main/java/net/floodlightcontroller/util/MACAddress.java
index 1bc137c..88dbda2 100644
--- a/src/main/java/net/floodlightcontroller/util/MACAddress.java
+++ b/src/main/java/net/floodlightcontroller/util/MACAddress.java
@@ -5,7 +5,6 @@
import net.onrc.onos.ofcontroller.util.serializers.MACAddressDeserializer;
import net.onrc.onos.ofcontroller.util.serializers.MACAddressSerializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
diff --git a/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java b/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java
index dafbf32..9e69115 100644
--- a/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java
+++ b/src/main/java/net/onrc/onos/flow/FlowManagerImpl.java
@@ -30,10 +30,8 @@
import net.onrc.onos.ofcontroller.util.FlowPath;
import net.onrc.onos.ofcontroller.util.Port;
import net.onrc.onos.ofcontroller.util.SwitchPort;
-import net.onrc.onos.util.GraphDBConnection;
import net.onrc.onos.util.GraphDBOperation;
import net.onrc.onos.util.LocalTopologyEventListener;
-import net.onrc.onos.util.GraphDBConnection.Transaction;
public class FlowManagerImpl implements IFlowManager {
diff --git a/src/main/java/net/onrc/onos/flow/IFlowManager.java b/src/main/java/net/onrc/onos/flow/IFlowManager.java
index 4063a7a..598da85 100644
--- a/src/main/java/net/onrc/onos/flow/IFlowManager.java
+++ b/src/main/java/net/onrc/onos/flow/IFlowManager.java
@@ -1,7 +1,5 @@
package net.onrc.onos.flow;
-import java.util.Map;
-
import net.floodlightcontroller.core.IOFSwitch;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
import net.onrc.onos.ofcontroller.util.FlowEntry;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
index 1f3939a..4b6e328 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -20,13 +20,13 @@
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.devicemanager.IDeviceService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.restserver.IRestApiService;
import net.floodlightcontroller.topology.ITopologyListener;
import net.floodlightcontroller.topology.ITopologyService;
import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
import net.onrc.onos.ofcontroller.util.DataPath;
import net.onrc.onos.ofcontroller.util.FlowEntry;
import net.onrc.onos.ofcontroller.util.Port;
@@ -42,7 +42,6 @@
import org.openflow.protocol.OFMatch;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketOut;
-import org.openflow.protocol.OFPhysicalPort;
import org.openflow.protocol.OFType;
import org.openflow.protocol.action.OFAction;
import org.openflow.protocol.action.OFActionDataLayerDestination;
@@ -761,10 +760,6 @@
@Override
public void switchPortChanged(Long switchId) {}
- @Override
- public void switchPortAdded(Long switchId, OFPhysicalPort port) {}
- @Override
- public void switchPortRemoved(Long switchId, OFPhysicalPort port) {}
@Override
public String getName() {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/IDeviceStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/IDeviceStorage.java
similarity index 83%
rename from src/main/java/net/onrc/onos/ofcontroller/devicemanager/IDeviceStorage.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/IDeviceStorage.java
index d4355c6..7310d8c 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/IDeviceStorage.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/IDeviceStorage.java
@@ -1,7 +1,6 @@
-package net.onrc.onos.ofcontroller.devicemanager;
+package net.onrc.onos.ofcontroller.core;
import net.floodlightcontroller.devicemanager.IDevice;
-import net.onrc.onos.ofcontroller.core.INetMapStorage;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
public interface IDeviceStorage extends INetMapStorage {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkStorage.java b/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
similarity index 88%
rename from src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkStorage.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
index 5150668..b56cfef 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkStorage.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/ILinkStorage.java
@@ -1,10 +1,9 @@
-package net.onrc.onos.ofcontroller.linkdiscovery;
+package net.onrc.onos.ofcontroller.core;
import java.util.List;
-import net.floodlightcontroller.linkdiscovery.LinkInfo;
import net.floodlightcontroller.routing.Link;
-import net.onrc.onos.ofcontroller.core.INetMapStorage;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
public interface ILinkStorage extends INetMapStorage {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
index 94bf0e0..fc1c32f 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/INetMapTopologyObjects.java
@@ -1,6 +1,6 @@
package net.onrc.onos.ofcontroller.core;
-import net.onrc.onos.ofcontroller.flowcache.web.DatapathSummarySerializer;
+import net.onrc.onos.ofcontroller.flowmanager.web.DatapathSummarySerializer;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/IOFSwitchPortListener.java b/src/main/java/net/onrc/onos/ofcontroller/core/IOFSwitchPortListener.java
new file mode 100644
index 0000000..5deae69
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/IOFSwitchPortListener.java
@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package net.onrc.onos.ofcontroller.core;
+
+import org.openflow.protocol.OFPhysicalPort;
+
+import net.floodlightcontroller.core.IOFSwitchListener;
+
+/**
+ * @author y-higuchi
+ *
+ */
+public interface IOFSwitchPortListener extends IOFSwitchListener {
+
+ /**
+ * Fired when ports on a switch area added
+ */
+ public void switchPortAdded(Long switchId, OFPhysicalPort port);
+
+ /**
+ * Fired when ports on a switch area removed
+ */
+ public void switchPortRemoved(Long switchId, OFPhysicalPort port);
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/IOnosRemoteSwitch.java b/src/main/java/net/onrc/onos/ofcontroller/core/IOnosRemoteSwitch.java
new file mode 100644
index 0000000..c9b0e2f
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/IOnosRemoteSwitch.java
@@ -0,0 +1,20 @@
+/**
+ *
+ */
+package net.onrc.onos.ofcontroller.core;
+
+import net.floodlightcontroller.core.IOFSwitch;
+
+/**
+ * @author y-higuchi
+ *
+ */
+public interface IOnosRemoteSwitch extends IOFSwitch {
+
+ /**
+ * Setup an unconnected switch with the info required.
+ * @param dpid of the switch
+ */
+ public void setupRemoteSwitch(Long dpid);
+
+}
diff --git a/src/main/java/net/floodlightcontroller/core/Main.java b/src/main/java/net/onrc/onos/ofcontroller/core/Main.java
similarity index 92%
rename from src/main/java/net/floodlightcontroller/core/Main.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/Main.java
index 91b317a..a80ac36 100644
--- a/src/main/java/net/floodlightcontroller/core/Main.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/Main.java
@@ -1,8 +1,9 @@
-package net.floodlightcontroller.core;
+package net.onrc.onos.ofcontroller.core;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
+import net.floodlightcontroller.core.IFloodlightProviderService;
import net.floodlightcontroller.core.internal.CmdLineSettings;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.FloodlightModuleLoader;
@@ -10,7 +11,7 @@
import net.floodlightcontroller.restserver.IRestApiService;
/**
- * Host for the Floodlight main method
+ * Host for the ONOS main method
* @author alexreimers
*/
public class Main {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
similarity index 97%
rename from src/main/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImpl.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
index 98b4a88..5b3ed74 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/devicemanager/internal/DeviceStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/DeviceStorageImpl.java
@@ -1,4 +1,4 @@
-package net.onrc.onos.ofcontroller.devicemanager.internal;
+package net.onrc.onos.ofcontroller.core.internal;
import java.util.ArrayList;
import java.util.List;
@@ -11,10 +11,9 @@
import net.floodlightcontroller.devicemanager.IDevice;
import net.floodlightcontroller.devicemanager.SwitchPort;
import net.floodlightcontroller.packet.IPv4;
+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.internal.SwitchStorageImpl;
-import net.onrc.onos.ofcontroller.devicemanager.IDeviceStorage;
import net.onrc.onos.util.GraphDBConnection;
import net.onrc.onos.util.GraphDBConnection.Transaction;
import net.onrc.onos.util.GraphDBOperation;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
similarity index 96%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
index 8187c06..2eaf535 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImpl.java
@@ -1,13 +1,13 @@
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.core.internal;
import java.util.ArrayList;
import java.util.List;
-import net.floodlightcontroller.linkdiscovery.LinkInfo;
import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.ofcontroller.core.ILinkStorage;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
-import net.onrc.onos.ofcontroller.linkdiscovery.ILinkStorage;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
import net.onrc.onos.util.GraphDBConnection;
import net.onrc.onos.util.GraphDBOperation;
@@ -302,8 +302,7 @@
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> {
+ static class ExtractLink implements PipeFunction<PathPipe<Vertex>, Link> {
@Override
public Link compute(PathPipe<Vertex> pipe ) {
diff --git a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
similarity index 90%
rename from src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
index 1fe12c4..4a0c35c 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/internal/TopoLinkServiceImpl.java
@@ -1,13 +1,12 @@
-package net.onrc.onos.ofcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.core.internal;
import java.util.ArrayList;
import java.util.List;
-import net.floodlightcontroller.linkdiscovery.internal.LinkStorageImpl;
-import net.floodlightcontroller.linkdiscovery.internal.LinkStorageImpl.ExtractLink;
import net.floodlightcontroller.routing.Link;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoLinkService;
+import net.onrc.onos.ofcontroller.core.internal.LinkStorageImpl.ExtractLink;
import net.onrc.onos.util.GraphDBConnection;
import net.onrc.onos.util.GraphDBOperation;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/TopoLinksResource.java b/src/main/java/net/onrc/onos/ofcontroller/core/web/TopoLinksResource.java
similarity index 74%
rename from src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/TopoLinksResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/core/web/TopoLinksResource.java
index b692517..327c110 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/TopoLinksResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/web/TopoLinksResource.java
@@ -1,8 +1,8 @@
-package net.onrc.onos.ofcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.core.web;
import java.util.List;
import net.floodlightcontroller.routing.Link;
-import net.onrc.onos.ofcontroller.linkdiscovery.internal.TopoLinkServiceImpl;
+import net.onrc.onos.ofcontroller.core.internal.TopoLinkServiceImpl;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/onoslistener/OnosPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
similarity index 91%
rename from src/main/java/net/onrc/onos/ofcontroller/onoslistener/OnosPublisher.java
rename to src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
index 6a9d433..9a382f2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/onoslistener/OnosPublisher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/NetworkGraphPublisher.java
@@ -1,4 +1,4 @@
-package net.onrc.onos.ofcontroller.onoslistener;
+package net.onrc.onos.ofcontroller.floodlightlistener;
import java.util.ArrayList;
import java.util.Collection;
@@ -22,21 +22,20 @@
import net.floodlightcontroller.devicemanager.IDevice;
import net.floodlightcontroller.devicemanager.IDeviceListener;
import net.floodlightcontroller.devicemanager.IDeviceService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.internal.LinkStorageImpl;
import net.floodlightcontroller.routing.Link;
import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.onrc.onos.ofcontroller.core.IDeviceStorage;
+import net.onrc.onos.ofcontroller.core.ILinkStorage;
+import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
import net.onrc.onos.ofcontroller.core.ISwitchStorage;
import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
+import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.LinkStorageImpl;
import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
-import net.onrc.onos.ofcontroller.core.internal.TopoSwitchServiceImpl;
-import net.onrc.onos.ofcontroller.devicemanager.IDeviceStorage;
-import net.onrc.onos.ofcontroller.devicemanager.internal.DeviceStorageImpl;
-import net.onrc.onos.ofcontroller.linkdiscovery.ILinkStorage;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
import net.onrc.onos.registry.controller.IControllerRegistryService;
import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
import net.onrc.onos.registry.controller.RegistryException;
@@ -45,7 +44,7 @@
import net.onrc.onos.util.IDBConnection;
import net.onrc.onos.util.LocalTopologyEventListener;
-public class OnosPublisher implements IDeviceListener, IOFSwitchListener,
+public class NetworkGraphPublisher implements IDeviceListener, IOFSwitchListener, IOFSwitchPortListener,
ILinkDiscoveryListener, IFloodlightModule {
protected IDeviceStorage devStore;
@@ -189,7 +188,7 @@
@Override
public String getName() {
- return "OnosPublisher";
+ return "NetworkGraphPublisher";
}
@Override
@@ -255,7 +254,7 @@
String conf = configMap.get(DBConfigFile);
op = new GraphDBOperation(GraphDBConnection.getInstance(conf));
- log = LoggerFactory.getLogger(OnosPublisher.class);
+ log = LoggerFactory.getLogger(NetworkGraphPublisher.class);
floodlightProvider =
context.getServiceImpl(IFloodlightProviderService.class);
deviceService = context.getServiceImpl(IDeviceService.class);
@@ -272,7 +271,7 @@
linkStore = new LinkStorageImpl();
linkStore.init(conf);
- log.debug("Initializing OnosPublisher module with {}", conf);
+ log.debug("Initializing NetworkGraphPublisher module with {}", conf);
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/FlowManager.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
similarity index 99%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/FlowManager.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
index 125acf3..3b566d1 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/FlowManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/FlowManager.java
@@ -1,4 +1,4 @@
-package net.onrc.onos.ofcontroller.flowcache;
+package net.onrc.onos.ofcontroller.flowmanager;
import java.io.IOException;
import java.io.PrintWriter;
@@ -33,7 +33,7 @@
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
-import net.onrc.onos.ofcontroller.flowcache.web.FlowWebRoutable;
+import net.onrc.onos.ofcontroller.flowmanager.web.FlowWebRoutable;
import net.onrc.onos.ofcontroller.util.CallerId;
import net.onrc.onos.ofcontroller.util.DataPath;
import net.onrc.onos.ofcontroller.util.DataPathEndpoints;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/IFlowService.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
similarity index 98%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/IFlowService.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
index 06566d4..ba9cd1b 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/IFlowService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/IFlowService.java
@@ -1,4 +1,4 @@
-package net.onrc.onos.ofcontroller.flowcache;
+package net.onrc.onos.ofcontroller.flowmanager;
import java.util.ArrayList;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/AddFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java
similarity index 91%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/AddFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java
index 0763b8a..2800305 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/AddFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddFlowResource.java
@@ -1,15 +1,14 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.io.IOException;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.FlowId;
import net.onrc.onos.ofcontroller.util.FlowPath;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/AddShortestPathFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
similarity index 91%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/AddShortestPathFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
index 59a8972..9d2e0c9 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/AddShortestPathFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/AddShortestPathFlowResource.java
@@ -1,13 +1,12 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.io.IOException;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.FlowId;
import net.onrc.onos.ofcontroller.util.FlowPath;
import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.restlet.resource.Post;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/ClearFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/ClearFlowResource.java
similarity index 87%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/ClearFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/ClearFlowResource.java
index e51bc9d..1daa2ab 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/ClearFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/ClearFlowResource.java
@@ -1,9 +1,8 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.FlowId;
-import org.openflow.util.HexString;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/DatapathSummarySerializer.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DatapathSummarySerializer.java
similarity index 97%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/DatapathSummarySerializer.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DatapathSummarySerializer.java
index 2022966..9133077 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/DatapathSummarySerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DatapathSummarySerializer.java
@@ -1,4 +1,4 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.io.IOException;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/DeleteFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DeleteFlowResource.java
similarity index 88%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/DeleteFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DeleteFlowResource.java
index fb3d100..393ff44 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/DeleteFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/DeleteFlowResource.java
@@ -1,9 +1,8 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.FlowId;
-import org.openflow.util.HexString;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/FlowWebRoutable.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/FlowWebRoutable.java
similarity index 97%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/FlowWebRoutable.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/FlowWebRoutable.java
index a2a3e54..954c84d 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/FlowWebRoutable.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/FlowWebRoutable.java
@@ -1,4 +1,4 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import net.floodlightcontroller.restserver.RestletRoutable;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetAllFlowsByEndpointsResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsByEndpointsResource.java
similarity index 94%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetAllFlowsByEndpointsResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsByEndpointsResource.java
index c284a9c..6142096 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetAllFlowsByEndpointsResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsByEndpointsResource.java
@@ -1,8 +1,8 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.util.ArrayList;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.DataPathEndpoints;
import net.onrc.onos.ofcontroller.util.Dpid;
import net.onrc.onos.ofcontroller.util.FlowPath;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetAllFlowsByInstallerIdResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsByInstallerIdResource.java
similarity index 94%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetAllFlowsByInstallerIdResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsByInstallerIdResource.java
index 8247422..498108f 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetAllFlowsByInstallerIdResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsByInstallerIdResource.java
@@ -1,8 +1,8 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.util.ArrayList;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.CallerId;
import net.onrc.onos.ofcontroller.util.DataPathEndpoints;
import net.onrc.onos.ofcontroller.util.Dpid;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetAllFlowsResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsResource.java
similarity index 88%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetAllFlowsResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsResource.java
index 5ffbefa..61eaf27 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetAllFlowsResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetAllFlowsResource.java
@@ -1,8 +1,8 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.util.ArrayList;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.FlowPath;
import org.restlet.resource.Get;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetFlowByIdResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetFlowByIdResource.java
similarity index 89%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetFlowByIdResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetFlowByIdResource.java
index 2f0f712..48e7369 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetFlowByIdResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetFlowByIdResource.java
@@ -1,6 +1,6 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.FlowId;
import net.onrc.onos.ofcontroller.util.FlowPath;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetSummaryFlowsResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetSummaryFlowsResource.java
similarity index 89%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetSummaryFlowsResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetSummaryFlowsResource.java
index 54c75f2..4b3c00f 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/GetSummaryFlowsResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/GetSummaryFlowsResource.java
@@ -1,11 +1,10 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.util.ArrayList;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.FlowId;
-import net.onrc.onos.ofcontroller.util.FlowPath;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementClearAllPathsFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementClearAllPathsFlowResource.java
similarity index 81%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementClearAllPathsFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementClearAllPathsFlowResource.java
index d0c013e..07d9fb2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementClearAllPathsFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementClearAllPathsFlowResource.java
@@ -1,9 +1,7 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
-import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
-import org.openflow.util.HexString;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementGetInstallPathsTimeNsecFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementGetInstallPathsTimeNsecFlowResource.java
similarity index 81%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementGetInstallPathsTimeNsecFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementGetInstallPathsTimeNsecFlowResource.java
index 2d2fbf6..467afca 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementGetInstallPathsTimeNsecFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementGetInstallPathsTimeNsecFlowResource.java
@@ -1,9 +1,7 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
-import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
-import org.openflow.util.HexString;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementGetPerFlowInstallTimeFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementGetPerFlowInstallTimeFlowResource.java
similarity index 81%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementGetPerFlowInstallTimeFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementGetPerFlowInstallTimeFlowResource.java
index 981c12c..92d84ab 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementGetPerFlowInstallTimeFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementGetPerFlowInstallTimeFlowResource.java
@@ -1,9 +1,7 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
-import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
-import org.openflow.util.HexString;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementInstallPathsFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementInstallPathsFlowResource.java
similarity index 83%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementInstallPathsFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementInstallPathsFlowResource.java
index 911de89..074dfb4 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementInstallPathsFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementInstallPathsFlowResource.java
@@ -1,9 +1,7 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
-import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
-import org.openflow.util.HexString;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementStorePathFlowResource.java b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementStorePathFlowResource.java
similarity index 91%
rename from src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementStorePathFlowResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementStorePathFlowResource.java
index 5eb8af0..0f23663 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowcache/web/MeasurementStorePathFlowResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowmanager/web/MeasurementStorePathFlowResource.java
@@ -1,13 +1,12 @@
-package net.onrc.onos.ofcontroller.flowcache.web;
+package net.onrc.onos.ofcontroller.flowmanager.web;
import java.io.IOException;
-import net.onrc.onos.ofcontroller.flowcache.IFlowService;
+import net.onrc.onos.ofcontroller.flowmanager.IFlowService;
import net.onrc.onos.ofcontroller.util.FlowId;
import net.onrc.onos.ofcontroller.util.FlowPath;
import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.restlet.resource.Post;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscovery.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscovery.java
similarity index 96%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscovery.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscovery.java
index 1df7eb5..6113ea8 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscovery.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscovery.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery;
+package net.onrc.onos.ofcontroller.linkdiscovery;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.map.ser.std.ToStringSerializer;
@@ -8,7 +8,7 @@
@JsonSerialize(using=ToStringSerializer.class)
public enum UpdateOperation {
- LINK_ADDED("Link Added"),
+ LINK_ADDED("Link Added"), // Operation Added by ONOS
LINK_UPDATED("Link Updated"),
LINK_REMOVED("Link Removed"),
SWITCH_UPDATED("Switch Updated"),
@@ -107,6 +107,7 @@
@Override
public String toString() {
switch (operation) {
+ case LINK_ADDED:
case LINK_REMOVED:
case LINK_UPDATED:
return "LDUpdate [operation=" + operation +
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryListener.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryListener.java
similarity index 94%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryListener.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryListener.java
index 35779a2..9ca114f 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryListener.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryListener.java
@@ -15,7 +15,7 @@
* under the License.
**/
-package net.floodlightcontroller.linkdiscovery;
+package net.onrc.onos.ofcontroller.linkdiscovery;
public interface ILinkDiscoveryListener extends ILinkDiscovery{
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryService.java
similarity index 97%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryService.java
index 4145592..99438ab 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/ILinkDiscoveryService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/ILinkDiscoveryService.java
@@ -15,7 +15,7 @@
* under the License.
**/
-package net.floodlightcontroller.linkdiscovery;
+package net.onrc.onos.ofcontroller.linkdiscovery;
import java.util.Map;
import java.util.Set;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/LinkInfo.java
similarity index 97%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/LinkInfo.java
index 9c0dd1a..825b0a2 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/LinkInfo.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/LinkInfo.java
@@ -13,9 +13,9 @@
* under the License.
**/
-package net.floodlightcontroller.linkdiscovery;
+package net.onrc.onos.ofcontroller.linkdiscovery;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LinkType;
import org.openflow.protocol.OFPhysicalPort.OFPortState;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/README b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/README
new file mode 100644
index 0000000..3cec58d
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/README
@@ -0,0 +1,8 @@
+Note about this directory
+=========================
+
+This directory contains link discovery manager and it's related module derived from Flood Light v0.9.0.
+Many of the code is unmodified from it's original state, but they had to be moved due to package visibility etc.
+
+Compare with floodlight's linkdiscovery directory to see what was modified from it's original code.
+
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
similarity index 95%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
index d57e987..696c63e 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyCluster.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
similarity index 96%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
index 98796ed..5d2e955 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologyLink.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
similarity index 94%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
index 001942b..d6afd7a 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/EventHistoryTopologySwitch.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
import net.floodlightcontroller.core.web.serializers.IPv4Serializer;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
similarity index 97%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index ac44eeb..f057a29 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -15,7 +15,7 @@
* under the License.
**/
-package net.floodlightcontroller.linkdiscovery.internal;
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
import java.io.IOException;
import java.net.InetAddress;
@@ -56,15 +56,6 @@
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.core.util.SingletonTask;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.SwitchType;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.UpdateOperation;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.LinkInfo;
-import net.floodlightcontroller.linkdiscovery.web.LinkDiscoveryWebRoutable;
import net.floodlightcontroller.packet.BSN;
import net.floodlightcontroller.packet.Ethernet;
import net.floodlightcontroller.packet.IPv4;
@@ -81,6 +72,16 @@
import net.floodlightcontroller.topology.NodePortTuple;
import net.floodlightcontroller.util.EventHistory;
import net.floodlightcontroller.util.EventHistory.EvAction;
+import net.onrc.onos.ofcontroller.core.IOnosRemoteSwitch;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LDUpdate;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LinkType;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.SwitchType;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.UpdateOperation;
+import net.onrc.onos.ofcontroller.linkdiscovery.web.LinkDiscoveryWebRoutable;
import net.onrc.onos.registry.controller.IControllerRegistryService;
import org.openflow.protocol.OFMessage;
@@ -126,12 +127,6 @@
IStorageSourceListener, ILinkDiscoveryService,
IFloodlightModule, IInfoProvider, IHAListener {
protected static Logger log = LoggerFactory.getLogger(LinkDiscoveryManager.class);
-
- protected enum NetworkMapOperation {
- NONE,
- INSERT,
- UPDATE
- }
// Names of table/fields for links in the storage API
private static final String LINK_TABLE_NAME = "controller_link";
@@ -151,8 +146,10 @@
protected IStorageSourceService storageSource;
protected IThreadPoolService threadPool;
protected IRestApiService restApi;
+ // Registry Service for ONOS
protected IControllerRegistryService registryService;
+
// LLDP and BDDP fields
private static final byte[] LLDP_STANDARD_DST_MAC_STRING =
HexString.fromHexString("01:80:c2:00:00:0e");
@@ -196,7 +193,7 @@
protected LLDPTLV controllerTLV;
protected ReentrantReadWriteLock lock;
int lldpTimeCount = 0;
-
+
/**
* Flag to indicate if automatic port fast is enabled or not.
* Default is set to false -- Initialized in the init method as well.
@@ -205,10 +202,10 @@
/**
* Map of remote switches that are not connected to this controller. This
- * is used to learn remote switches in a distributed controller.
+ * is used to learn remote switches in a distributed controller ONOS.
*/
- protected Map<Long, IOFSwitch> remoteSwitches;
-
+ protected Map<Long, IOnosRemoteSwitch> remoteSwitches;
+
/**
* Map from link to the most recent time it was verified functioning
*/
@@ -519,10 +516,10 @@
}
/**
- * Learn remote switches when running as a distributed controller
+ * Learn remote switches when running as a distributed controller ONOS
*/
protected IOFSwitch addRemoteSwitch(long sw, short port) {
- IOFSwitch remotesw = null;
+ IOnosRemoteSwitch remotesw = null;
// add a switch if we have not seen it before
remotesw = remoteSwitches.get(sw);
@@ -810,6 +807,7 @@
ByteBuffer dpidBB = ByteBuffer.wrap(lldptlv.getValue());
remoteSwitch = floodlightProvider.getSwitches().get(dpidBB.getLong(4));
if (remoteSwitch == null) {
+ // Added by ONOS
// floodlight LLDP coming from a remote switch connected to a different controller
// add it to our cache of unconnected remote switches
remoteSwitch = addRemoteSwitch(dpidBB.getLong(4), remotePort);
@@ -842,7 +840,7 @@
log.trace("Getting BDDP packets from a different controller" +
"and letting it go through normal processing chain.");
}
- //XXX Fix the BDDP broadcast issue
+ //XXX ONOS: Fix the BDDP broadcast issue
//return Command.CONTINUE;
return Command.STOP;
}
@@ -963,7 +961,6 @@
if (bsn.getPayload() instanceof LLDP == false)
return Command.CONTINUE;
return handleLldp((LLDP) bsn.getPayload(), sw, pi, false, cntx);
- //return Command.STOP;
} else if (eth.getEtherType() == Ethernet.TYPE_LLDP) {
return handleLldp((LLDP) eth.getPayload(), sw, pi, true, cntx);
} else if (eth.getEtherType() < 1500) {
@@ -1013,7 +1010,6 @@
NodePortTuple srcNpt, dstNpt;
boolean linkChanged = false;
- NetworkMapOperation operation = NetworkMapOperation.NONE;
lock.writeLock().lock();
try {
@@ -1061,6 +1057,7 @@
writeLinkToStorage(lt, newInfo);
+ // ONOS: Distinguish added event separately from updated event
updateOperation = UpdateOperation.LINK_ADDED;
linkChanged = true;
@@ -1116,7 +1113,7 @@
// valid time, plus the port states if they've changed (i.e. if
// they weren't set to null in the previous block of code.
writeLinkToStorage(lt, newInfo);
-
+
if (linkChanged) {
updateOperation = getUpdateOperation(newInfo.getSrcPortState(),
newInfo.getDstPortState());
@@ -1145,7 +1142,6 @@
} finally {
lock.writeLock().unlock();
}
-
return linkChanged;
}
@@ -1159,14 +1155,6 @@
* @param links The List of @LinkTuple to delete.
*/
protected void deleteLinks(List<Link> links, String reason) {
- deleteLinks(links, reason, Boolean.TRUE);
- }
-
- /**
- * Removes links from memory and storage.
- * @param links The List of @LinkTuple to delete.
- */
- protected void deleteLinks(List<Link> links, String reason, Boolean hasControl) {
NodePortTuple srcNpt, dstNpt;
lock.writeLock().lock();
@@ -1212,7 +1200,7 @@
// remove link from storage.
removeLinkFromStorage(lt);
-
+
// TODO Whenever link is removed, it has to checked if
// the switchports must be added to quarantine.
@@ -1236,8 +1224,8 @@
IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw);
if (iofSwitch == null) return Command.CONTINUE;
-
- // If we do not control this switch, then we should not process its port status messages
+
+ // ONOS: If we do not control this switch, then we should not process its port status messages
if (!registryService.hasControl(iofSwitch.getId())) return Command.CONTINUE;
if (log.isTraceEnabled()) {
@@ -1263,7 +1251,6 @@
((byte)OFPortReason.OFPPR_MODIFY.ordinal() ==
ps.getReason() && !portEnabled(ps.getDesc()))) {
deleteLinksOnPort(npt, "Port Status Changed");
-
LDUpdate update = new LDUpdate(sw, port, UpdateOperation.PORT_DOWN);
updates.add(update);
linkDeleted = true;
@@ -1306,7 +1293,6 @@
getLinkType(lt, linkInfo),
operation));
writeLinkToStorage(lt, linkInfo);
-
linkInfoChanged = true;
}
}
@@ -1410,11 +1396,7 @@
}
// add all tuples with an endpoint on this switch to erase list
eraseList.addAll(switchLinks.get(sw));
-
- // We can get called to delete links when we lose mastership. To avoid clearing the network map in that case,
- // figure out if we have control of the switch
- boolean hasControl = registryService.hasControl(sw);
- deleteLinks(eraseList, "Switch Removed", hasControl);
+ deleteLinks(eraseList, "Switch Removed");
// Send a switch removed update
LDUpdate update = new LDUpdate(sw, null, UpdateOperation.SWITCH_REMOVED);
@@ -1844,6 +1826,7 @@
l.add(IStorageSourceService.class);
l.add(IThreadPoolService.class);
l.add(IRestApiService.class);
+ // Added by ONOS
l.add(IControllerRegistryService.class);
return l;
}
@@ -1855,6 +1838,7 @@
storageSource = context.getServiceImpl(IStorageSourceService.class);
threadPool = context.getServiceImpl(IThreadPoolService.class);
restApi = context.getServiceImpl(IRestApiService.class);
+ // Added by ONOS
registryService = context.getServiceImpl(IControllerRegistryService.class);
// Set the autoportfast feature to false.
@@ -1872,7 +1856,8 @@
this.switchLinks = new HashMap<Long, Set<Link>>();
this.quarantineQueue = new LinkedBlockingQueue<NodePortTuple>();
this.maintenanceQueue = new LinkedBlockingQueue<NodePortTuple>();
- this.remoteSwitches = new HashMap<Long, IOFSwitch>();
+ // Added by ONOS
+ this.remoteSwitches = new HashMap<Long, IOnosRemoteSwitch>();
this.evHistTopologySwitch =
new EventHistory<EventHistoryTopologySwitch>("Topology: Switch");
@@ -1923,7 +1908,7 @@
log.error("Error in installing listener for " +
"switch table {}", SWITCH_CONFIG_TABLE_NAME);
}
-
+
ScheduledExecutorService ses = threadPool.getScheduledExecutor();
// To be started by the first switch connection
@@ -2134,16 +2119,4 @@
public void setAutoPortFastFeature(boolean autoPortFastFeature) {
this.autoPortFastFeature = autoPortFastFeature;
}
-
- @Override
- public void switchPortAdded(Long switchId, OFPhysicalPort port) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
- // TODO Auto-generated method stub
-
- }
}
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/AutoPortFast.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/AutoPortFast.java
similarity index 89%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/web/AutoPortFast.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/AutoPortFast.java
index 8f4f4ad..29dc890 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/AutoPortFast.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/AutoPortFast.java
@@ -1,6 +1,6 @@
-package net.floodlightcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.linkdiscovery.web;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
import org.restlet.data.Status;
import org.restlet.resource.Get;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
similarity index 92%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
index 3990fba..8eae558 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkDiscoveryWebRoutable.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.linkdiscovery.web;
import net.floodlightcontroller.restserver.RestletRoutable;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkWithType.java
similarity index 94%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkWithType.java
index 893e4ad..3e5a5e7 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinkWithType.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinkWithType.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.linkdiscovery.web;
import java.io.IOException;
@@ -9,8 +9,8 @@
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.openflow.util.HexString;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery.LinkType;
import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery.LinkType;
/**
* This class is both the datastructure and the serializer
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java
similarity index 86%
rename from src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java
index 4cad18e..c522a05 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/LinksResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/linkdiscovery/web/LinksResource.java
@@ -1,13 +1,13 @@
-package net.floodlightcontroller.linkdiscovery.web;
+package net.onrc.onos.ofcontroller.linkdiscovery.web;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService;
-import net.floodlightcontroller.linkdiscovery.LinkInfo;
import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java b/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
index a051d4c..864bb74 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
@@ -24,7 +24,6 @@
import net.onrc.onos.ofcontroller.util.Port;
import net.onrc.onos.ofcontroller.util.SwitchPort;
import net.onrc.onos.util.GraphDBConnection;
-import net.onrc.onos.util.GraphDBConnection.Transaction;
import net.onrc.onos.util.GraphDBOperation;
import org.openflow.util.HexString;
@@ -32,7 +31,6 @@
import org.slf4j.LoggerFactory;
import com.tinkerpop.blueprints.Direction;
-import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.pipes.PipeFunction;
import com.tinkerpop.pipes.branch.LoopPipe.LoopBundle;
diff --git a/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
similarity index 86%
rename from src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
rename to src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
index 906a579..5ad892b 100644
--- a/src/main/java/net/floodlightcontroller/topology/web/RouteResource.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/topology/web/RouteResource.java
@@ -1,17 +1,11 @@
-package net.floodlightcontroller.topology.web;
+package net.onrc.onos.ofcontroller.topology.web;
-import java.util.List;
-
-import net.floodlightcontroller.routing.IRoutingService;
-import net.floodlightcontroller.routing.Route;
-import net.floodlightcontroller.topology.NodePortTuple;
import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
import net.onrc.onos.ofcontroller.util.DataPath;
import net.onrc.onos.ofcontroller.util.Dpid;
import net.onrc.onos.ofcontroller.util.Port;
import net.onrc.onos.ofcontroller.util.SwitchPort;
-import org.openflow.util.HexString;
import org.restlet.resource.Get;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
index f02552b..5f96414 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/DataPath.java
@@ -2,7 +2,6 @@
import java.util.ArrayList;
-
import org.codehaus.jackson.annotate.JsonProperty;
/**
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/Dpid.java b/src/main/java/net/onrc/onos/ofcontroller/util/Dpid.java
index ce8a4f6..c3cf3aa 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/Dpid.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/Dpid.java
@@ -1,13 +1,11 @@
package net.onrc.onos.ofcontroller.util;
-import org.openflow.util.HexString;
-
import net.onrc.onos.ofcontroller.util.serializers.DpidDeserializer;
import net.onrc.onos.ofcontroller.util.serializers.DpidSerializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.openflow.util.HexString;
/**
* The class representing a network switch DPID.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java
index ac32d0b..7dd0699 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntry.java
@@ -2,15 +2,6 @@
import java.util.ArrayList;
-
-import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.ofcontroller.util.FlowEntryAction;
-import net.onrc.onos.ofcontroller.util.FlowEntryErrorState;
-import net.onrc.onos.ofcontroller.util.FlowEntryId;
-import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
-import net.onrc.onos.ofcontroller.util.FlowEntrySwitchState;
-import net.onrc.onos.ofcontroller.util.FlowEntryUserState;
-
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java
index 858272c..22aef98 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryAction.java
@@ -1,7 +1,6 @@
package net.onrc.onos.ofcontroller.util;
import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.ofcontroller.util.Port.PortValues;
import org.codehaus.jackson.annotate.JsonProperty;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java
index 7a8f67b..c4e75a5 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowEntryId.java
@@ -5,7 +5,6 @@
import net.onrc.onos.ofcontroller.util.serializers.FlowEntryIdDeserializer;
import net.onrc.onos.ofcontroller.util.serializers.FlowEntryIdSerializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowId.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowId.java
index b9652b8..2310972 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowId.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowId.java
@@ -5,7 +5,6 @@
import net.onrc.onos.ofcontroller.util.serializers.FlowIdDeserializer;
import net.onrc.onos.ofcontroller.util.serializers.FlowIdSerializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
index 29898e6..f9385e7 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/FlowPath.java
@@ -5,8 +5,6 @@
import net.floodlightcontroller.util.MACAddress;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
-import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
-import net.onrc.onos.ofcontroller.util.FlowId;
import org.codehaus.jackson.annotate.JsonProperty;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/IPv4.java b/src/main/java/net/onrc/onos/ofcontroller/util/IPv4.java
index a9d7d85..2081bbe 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/IPv4.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/IPv4.java
@@ -3,7 +3,6 @@
import net.onrc.onos.ofcontroller.util.serializers.IPv4Deserializer;
import net.onrc.onos.ofcontroller.util.serializers.IPv4Serializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/IPv4Net.java b/src/main/java/net/onrc/onos/ofcontroller/util/IPv4Net.java
index fdc6dca..52e6535 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/IPv4Net.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/IPv4Net.java
@@ -1,10 +1,8 @@
package net.onrc.onos.ofcontroller.util;
-import net.onrc.onos.ofcontroller.util.IPv4;
import net.onrc.onos.ofcontroller.util.serializers.IPv4NetDeserializer;
import net.onrc.onos.ofcontroller.util.serializers.IPv4NetSerializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/IPv6.java b/src/main/java/net/onrc/onos/ofcontroller/util/IPv6.java
index 82d1db5..2d28db8 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/IPv6.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/IPv6.java
@@ -1,13 +1,11 @@
package net.onrc.onos.ofcontroller.util;
-import org.openflow.util.HexString;
-
import net.onrc.onos.ofcontroller.util.serializers.IPv6Deserializer;
import net.onrc.onos.ofcontroller.util.serializers.IPv6Serializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.openflow.util.HexString;
/**
* The class representing an IPv6 address.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/IPv6Net.java b/src/main/java/net/onrc/onos/ofcontroller/util/IPv6Net.java
index aacb648..bafff24 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/IPv6Net.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/IPv6Net.java
@@ -1,10 +1,8 @@
package net.onrc.onos.ofcontroller.util;
-import net.onrc.onos.ofcontroller.util.IPv6;
import net.onrc.onos.ofcontroller.util.serializers.IPv6NetDeserializer;
import net.onrc.onos.ofcontroller.util.serializers.IPv6NetSerializer;
-import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/SwitchPort.java b/src/main/java/net/onrc/onos/ofcontroller/util/SwitchPort.java
index afc2af3..95a934f 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/SwitchPort.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/SwitchPort.java
@@ -1,7 +1,5 @@
package net.onrc.onos.ofcontroller.util;
-import net.onrc.onos.ofcontroller.util.Port;
-
import org.codehaus.jackson.annotate.JsonProperty;
/**
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidDeserializer.java
index f6b1ea0..9075f96 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidDeserializer.java
@@ -2,16 +2,13 @@
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.codehaus.jackson.map.DeserializationContext;
-
import net.onrc.onos.ofcontroller.util.Dpid;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidSerializer.java
index 0da74d4..7ece4d3 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/DpidSerializer.java
@@ -2,13 +2,13 @@
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.Dpid;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.onrc.onos.ofcontroller.util.Dpid;
-
/**
* Serialize a DPID as a string.
*/
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdDeserializer.java
index 7a15ddc..72ddfea 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdDeserializer.java
@@ -2,16 +2,13 @@
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.codehaus.jackson.map.DeserializationContext;
-
import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdSerializer.java
index 00f4d61..bf73265 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowEntryIdSerializer.java
@@ -2,13 +2,13 @@
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.onrc.onos.ofcontroller.util.FlowEntryId;
-
/**
* Serialize a Flow Entry ID as a hexadecimal string.
*/
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdDeserializer.java
index 6e04108..eb93a23 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdDeserializer.java
@@ -2,16 +2,13 @@
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.codehaus.jackson.map.DeserializationContext;
-
import net.onrc.onos.ofcontroller.util.FlowId;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdSerializer.java
index 575126f..34f6e05 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/FlowIdSerializer.java
@@ -2,13 +2,13 @@
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.FlowId;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.onrc.onos.ofcontroller.util.FlowId;
-
/**
* Serialize a Flow ID as a hexadecimal string.
*/
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Deserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Deserializer.java
index 13ddc0d..daf90af 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Deserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Deserializer.java
@@ -2,16 +2,13 @@
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.codehaus.jackson.map.DeserializationContext;
-
import net.onrc.onos.ofcontroller.util.IPv4;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetDeserializer.java
index 1f30e91..f67ab38 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetDeserializer.java
@@ -2,16 +2,13 @@
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.codehaus.jackson.map.DeserializationContext;
-
import net.onrc.onos.ofcontroller.util.IPv4Net;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetSerializer.java
index 2580550..0454a58 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4NetSerializer.java
@@ -2,13 +2,13 @@
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.IPv4Net;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.onrc.onos.ofcontroller.util.IPv4Net;
-
/**
* Serialize an IPv4Net address as a string.
*/
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Serializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Serializer.java
index 49dc140..aefc8a0 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Serializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv4Serializer.java
@@ -2,13 +2,13 @@
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.IPv4;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.onrc.onos.ofcontroller.util.IPv4;
-
/**
* Serialize an IPv4 address as a string.
*/
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Deserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Deserializer.java
index 36109e8..7e3e5f6 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Deserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Deserializer.java
@@ -2,16 +2,13 @@
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.codehaus.jackson.map.DeserializationContext;
-
import net.onrc.onos.ofcontroller.util.IPv6;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetDeserializer.java
index ff3a0ee..d7631b3 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetDeserializer.java
@@ -2,16 +2,13 @@
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.codehaus.jackson.map.DeserializationContext;
-
import net.onrc.onos.ofcontroller.util.IPv6Net;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetSerializer.java
index e0837d5..06dc6cf 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6NetSerializer.java
@@ -2,13 +2,13 @@
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.IPv6Net;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.onrc.onos.ofcontroller.util.IPv6Net;
-
/**
* Serialize an IPv6Net address as a string.
*/
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Serializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Serializer.java
index b4ac122..b6709b8 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Serializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/IPv6Serializer.java
@@ -2,13 +2,13 @@
import java.io.IOException;
+import net.onrc.onos.ofcontroller.util.IPv6;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.onrc.onos.ofcontroller.util.IPv6;
-
/**
* Serialize an IPv6 address as a string.
*/
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressDeserializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressDeserializer.java
index 86ed2a7..dc4a0e2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressDeserializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressDeserializer.java
@@ -2,16 +2,13 @@
import java.io.IOException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParser;
-import org.codehaus.jackson.JsonToken;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.ObjectCodec;
-import org.codehaus.jackson.map.JsonDeserializer;
-import org.codehaus.jackson.map.DeserializationContext;
-
import net.floodlightcontroller.util.MACAddress;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonProcessingException;
+import org.codehaus.jackson.JsonToken;
+import org.codehaus.jackson.map.DeserializationContext;
+import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressSerializer.java b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressSerializer.java
index 85c8dc4..9c0e225 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressSerializer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/util/serializers/MACAddressSerializer.java
@@ -2,13 +2,13 @@
import java.io.IOException;
+import net.floodlightcontroller.util.MACAddress;
+
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
-import net.floodlightcontroller.util.MACAddress;
-
/**
* Serialize a MAC address as a string.
*/
diff --git a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
index 3e11180..a9ff0b8 100644
--- a/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
+++ b/src/main/resources/META-INF/services/net.floodlightcontroller.core.module.IFloodlightModule
@@ -1,7 +1,7 @@
net.floodlightcontroller.core.FloodlightProvider
net.floodlightcontroller.storage.memory.MemoryStorageSource
net.floodlightcontroller.devicemanager.internal.DeviceManagerImpl
-net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager
+net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager
net.floodlightcontroller.topology.TopologyManager
net.floodlightcontroller.forwarding.Forwarding
net.floodlightcontroller.flowcache.FlowReconcileManager
@@ -17,8 +17,8 @@
net.floodlightcontroller.devicemanager.test.MockDeviceManager
net.floodlightcontroller.core.test.MockFloodlightProvider
net.floodlightcontroller.core.test.MockThreadPoolService
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher
-net.onrc.onos.ofcontroller.flowcache.FlowManager
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher
+net.onrc.onos.ofcontroller.flowmanager.FlowManager
net.onrc.onos.ofcontroller.routing.TopoRouteService
net.onrc.onos.ofcontroller.bgproute.BgpRoute
net.onrc.onos.registry.controller.ZookeeperRegistry
diff --git a/src/main/resources/floodlightdefault.properties b/src/main/resources/floodlightdefault.properties
index bf5bad9..8decafb 100644
--- a/src/main/resources/floodlightdefault.properties
+++ b/src/main/resources/floodlightdefault.properties
@@ -6,12 +6,12 @@
net.floodlightcontroller.counter.CounterStore,\
net.floodlightcontroller.perfmon.PktInProcessingTime,\
net.floodlightcontroller.ui.web.StaticWebRoutable,\
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher, \
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher, \
net.onrc.onos.registry.controller.ZookeeperRegistry
net.floodlightcontroller.restserver.RestApiServer.port = 8080
net.floodlightcontroller.core.FloodlightProvider.openflowport = 6633
net.floodlightcontroller.jython.JythonDebugInterface.port = 6655
net.floodlightcontroller.forwarding.Forwarding.idletimeout = 5
net.floodlightcontroller.forwarding.Forwarding.hardtimeout = 0
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher.dbconf = /tmp/cassandra.titan
-net.onrc.onos.ofcontroller.onoslistener.OnosPublisher.EnableCleanup = True
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.dbconf = /tmp/cassandra.titan
+net.onrc.onos.ofcontroller.floodlightlistener.NetworkGraphPublisher.EnableCleanup = True
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index 05e01a3..88e2d35 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -69,6 +69,7 @@
import net.floodlightcontroller.storage.memory.MemoryStorageSource;
import net.floodlightcontroller.test.FloodlightTestCase;
import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
import org.easymock.Capture;
import org.easymock.EasyMock;
@@ -404,7 +405,7 @@
@Test
public void testUpdateQueue() throws Exception {
- class DummySwitchListener implements IOFSwitchListener {
+ class DummySwitchListener implements IOFSwitchListener, IOFSwitchPortListener {
public int nAdded;
public int nRemoved;
public int nPortChanged;
@@ -824,7 +825,7 @@
state.firstRoleReplyReceived = false;
controller.role = Role.SLAVE;
expect(chdlr.sw.checkFirstPendingRoleRequestXid(xid)).andReturn(true);
- chdlr.sw.deliverRoleRequestNotSupported(xid);
+ chdlr.sw.deliverRoleRequestNotSupportedEx(xid);
expect(chdlr.sw.getChannel()).andReturn(ch).anyTimes();
expect(ch.close()).andReturn(null);
@@ -844,7 +845,7 @@
state.firstRoleReplyReceived = false;
controller.role = Role.SLAVE;
expect(chdlr.sw.checkFirstPendingRoleRequestXid(xid)).andReturn(true);
- chdlr.sw.deliverRoleRequestNotSupported(xid);
+ chdlr.sw.deliverRoleRequestNotSupportedEx(xid);
expect(chdlr.sw.getChannel()).andReturn(ch).anyTimes();
expect(ch.close()).andReturn(null);
replay(ch, chdlr.sw);
@@ -863,7 +864,7 @@
state.firstRoleReplyReceived = false;
controller.role = Role.MASTER;
expect(chdlr.sw.checkFirstPendingRoleRequestXid(xid)).andReturn(true);
- chdlr.sw.deliverRoleRequestNotSupported(xid);
+ chdlr.sw.deliverRoleRequestNotSupportedEx(xid);
setupSwitchForAddSwitch(chdlr.sw, 0L);
chdlr.sw.clearAllFlowMods();
replay(ch, chdlr.sw);
diff --git a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java
index 758cd05..128c09f 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/OFSwitchImplTest.java
@@ -197,7 +197,7 @@
sw.role = Role.SLAVE;
sw.pendingRoleRequests.add(pending);
replay(sw.channel);
- sw.deliverRoleRequestNotSupported(pending.xid);
+ sw.deliverRoleRequestNotSupportedEx(pending.xid);
verify(sw.channel);
assertEquals(false, sw.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE));
assertEquals(null, sw.role);
@@ -210,7 +210,7 @@
sw.role = Role.SLAVE;
expect(sw.channel.close()).andReturn(null);
replay(sw.channel);
- sw.deliverRoleRequestNotSupported(1);
+ sw.deliverRoleRequestNotSupportedEx(1);
verify(sw.channel);
assertEquals(null, sw.role);
assertEquals(0, sw.pendingRoleRequests.size());
@@ -228,7 +228,7 @@
sw.pendingRoleRequests.add(pending);
expect(sw.channel.close()).andReturn(null);
replay(sw.channel);
- sw.deliverRoleRequestNotSupported(pending.xid+1);
+ sw.deliverRoleRequestNotSupportedEx(pending.xid+1);
verify(sw.channel);
assertEquals(null, sw.role);
assertEquals(0, sw.pendingRoleRequests.size());
diff --git a/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java b/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
index 5195b88..3d5e03b 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/TestDatabaseManager.java
@@ -61,7 +61,6 @@
Integer portNum = (Integer) port.getProperty("number");
port.setProperty("number", portNum.shortValue());
}
-
titanGraph.stopTransaction(Conclusion.SUCCESS);
}
diff --git a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceStorageImplTest.java b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceStorageImplTest.java
index cd1651f..fc37016 100644
--- a/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceStorageImplTest.java
+++ b/src/test/java/net/floodlightcontroller/devicemanager/internal/DeviceStorageImplTest.java
@@ -1,20 +1,26 @@
package net.floodlightcontroller.devicemanager.internal;
-import static org.junit.Assert.*;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.List;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
-import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
-import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
-import net.onrc.onos.ofcontroller.devicemanager.internal.DeviceStorageImpl;
-import net.onrc.onos.util.GraphDBConnection;
-import net.onrc.onos.util.GraphDBOperation;
import net.floodlightcontroller.devicemanager.IDevice;
import net.floodlightcontroller.devicemanager.SwitchPort;
import net.floodlightcontroller.packet.IPv4;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.internal.DeviceStorageImpl;
+import net.onrc.onos.ofcontroller.core.internal.SwitchStorageImpl;
+import net.onrc.onos.util.GraphDBConnection;
+import net.onrc.onos.util.GraphDBOperation;
+
import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
diff --git a/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java b/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java
index e72179d..9232bb5 100644
--- a/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java
+++ b/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java
@@ -11,11 +11,11 @@
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.test.MockFloodlightProvider;
import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.floodlightcontroller.topology.NodePortTuple;
import net.floodlightcontroller.topology.TopologyInstance;
import net.floodlightcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
import org.junit.Before;
import org.junit.Test;
diff --git a/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java b/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java
index 113cecb..1cf344d 100644
--- a/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java
+++ b/src/test/java/net/floodlightcontroller/topology/TopologyManagerTest.java
@@ -4,10 +4,10 @@
import net.floodlightcontroller.core.IFloodlightProviderService.Role;
import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.test.MockThreadPoolService;
-import net.floodlightcontroller.linkdiscovery.ILinkDiscovery;
import net.floodlightcontroller.test.FloodlightTestCase;
import net.floodlightcontroller.threadpool.IThreadPoolService;
import net.floodlightcontroller.topology.TopologyManager;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscovery;
import org.junit.Before;
import org.junit.Test;
diff --git a/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java b/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java
index ffabf6f..59e0a51 100644
--- a/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java
+++ b/src/test/java/net/floodlightcontroller/util/OFMessageDamperMockSwitch.java
@@ -346,10 +346,4 @@
return 0;
}
- @Override
- public void setupRemoteSwitch(Long dpid) {
- // TODO Auto-generated method stub
-
- }
-
}
\ No newline at end of file
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImplTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImplTest.java
new file mode 100644
index 0000000..7bf2b1a
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/LinkStorageImplTest.java
@@ -0,0 +1,536 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import net.floodlightcontroller.routing.Link;
+import net.onrc.onos.ofcontroller.core.ILinkStorage;
+import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
+import net.onrc.onos.ofcontroller.core.internal.TestableGraphDBOperation.TestPortObject;
+import net.onrc.onos.util.GraphDBConnection;
+import net.onrc.onos.util.GraphDBOperation;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
+
+import org.easymock.EasyMock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openflow.protocol.OFPhysicalPort;
+import org.openflow.util.HexString;
+import org.powermock.api.easymock.PowerMock;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({LinkStorageImpl.class, GraphDBConnection.class, GraphDBOperation.class})
+public class LinkStorageImplTest {
+ protected static Logger log = LoggerFactory.getLogger(LinkStorageImplTest.class);
+
+ private static ILinkStorage linkStorage;
+
+ // Mock GraphDBConnection (do nothing)
+ private static GraphDBConnection conn;
+
+ // Mock GraphDBOperation (mocks port-related methods only)
+ private static TestableGraphDBOperation ope;
+
+ /**
+ * Setup code called before each tests.
+ * Read test graph data and replace DB access by test graph data.
+ * @throws Exception
+ */
+ @Before
+ public void setUp() throws Exception{
+ PowerMock.mockStatic(GraphDBConnection.class);
+ PowerMock.suppress(PowerMock.constructor(GraphDBConnection.class));
+ conn = PowerMock.createNiceMock(GraphDBConnection.class);
+ EasyMock.expect(GraphDBConnection.getInstance((String)EasyMock.anyObject())).andReturn(conn).anyTimes();
+ PowerMock.replay(GraphDBConnection.class);
+
+ ope = new TestableGraphDBOperation();
+ PowerMock.expectNew(GraphDBOperation.class, (GraphDBConnection)EasyMock.anyObject()).andReturn(ope).anyTimes();
+ PowerMock.replay(GraphDBOperation.class);
+
+ linkStorage = new LinkStorageImpl();
+ linkStorage.init("/dummy/path/to/conf");
+
+ initLinks();
+ }
+
+ /**
+ * Closing code called after each tests.
+ * Discard test graph data.
+ * @throws Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ // finish code
+ linkStorage.close();
+ ope.close();
+ }
+
+ // TODO: remove @Ignore after UPDATE method is implemented
+ /**
+ * Test if update() can correctly updates LinkInfo for a Link.
+ */
+ @Ignore @Test
+ public void testUpdate_UpdateSingleLink() {
+ Link linkToUpdate= createExistingLink();
+ long currentTime = System.currentTimeMillis();
+ LinkInfo infoToUpdate = createFeasibleLinkInfo(currentTime);
+ LinkInfo infoToVerify = createFeasibleLinkInfo(currentTime);
+
+ linkStorage.update(linkToUpdate, infoToUpdate, ILinkStorage.DM_OPERATION.UPDATE);
+
+ doTestLinkHasStateOf(linkToUpdate, infoToVerify);
+ }
+
+ /**
+ * Test if update() can correctly creates a Link.
+ */
+ @Test
+ public void testUpdate_CreateSingleLink() {
+ Link linkToCreate = createFeasibleLink();
+ Link linkToVerify = createFeasibleLink();
+
+ //Use the link storage API to add the link
+ linkStorage.update(linkToCreate, ILinkStorage.DM_OPERATION.CREATE);
+ doTestLinkExist(linkToVerify);
+ }
+
+ /**
+ * Test if update() can correctly inserts a Link.
+ */
+ @Test
+ public void testUpdate_InsertSingleLink(){
+ Link linkToInsert = createFeasibleLink();
+ Link linkToVerify = createFeasibleLink();
+
+ //Use the link storage API to add the link
+ linkStorage.update(linkToInsert, ILinkStorage.DM_OPERATION.INSERT);
+ doTestLinkExist(linkToVerify);
+ }
+
+ /**
+ * Test if update() can correctly deletes a Link.
+ */
+ @Test
+ public void testUpdate_DeleteSingleLink(){
+ Link linkToDelete = createExistingLink();
+ Link linkToVerify = createExistingLink();
+
+ // Test deletion of existing link
+ linkStorage.update(linkToDelete, DM_OPERATION.DELETE);
+ doTestLinkNotExist(linkToVerify);
+ }
+
+ /**
+ * Test if update() can correctly creates multiple Links.
+ */
+ @Test
+ public void testUpdate_CreateLinks(){
+ List<Link> linksToCreate = createFeasibleLinks();
+ List<Link> linksToVerify = createFeasibleLinks();
+
+ // Test creation of new links
+ linkStorage.update(linksToCreate, ILinkStorage.DM_OPERATION.CREATE);
+ for(Link l : linksToVerify) {
+ doTestLinkExist(l);
+ }
+ }
+
+ /**
+ * Test if update() can handle mixture of normal/abnormal input for creation of Links.
+ * Deprecated: DBOperation is responsible.
+ */
+ @Ignore @Test
+ public void testUpdate_CreateLinks_Mixuture(){
+ List<Link> linksToCreate = new ArrayList<Link>();
+ linksToCreate.add(createFeasibleLink());
+ linksToCreate.add(createExistingLink());
+
+ // Test creation of mixture of new/existing links
+ linkStorage.update(linksToCreate, ILinkStorage.DM_OPERATION.CREATE);
+ doTestLinkExist(createFeasibleLink());
+ doTestLinkExist(createExistingLink());
+ }
+
+ /**
+ * Test if update() can correctly inserts multiple Links.
+ */
+ @Test
+ public void testUpdate_InsertLinks(){
+ List<Link> linksToInsert = createFeasibleLinks();
+ List<Link> linksToVerify = createFeasibleLinks();
+
+ // Test insertion of new links
+ linkStorage.update(linksToInsert, ILinkStorage.DM_OPERATION.INSERT);
+ for(Link l : linksToVerify) {
+ doTestLinkExist(l);
+ }
+ }
+
+ /**
+ * Test if update() can handle mixture of normal/abnormal input for creation of Links.
+ */
+ @Ignore @Test
+ public void testUpdate_InsertLinks_Mixuture(){
+ List<Link> linksToInsert = new ArrayList<Link>();
+ linksToInsert.add(createFeasibleLink());
+ linksToInsert.add(createExistingLink());
+
+ // Test insertion of mixture of new/existing links
+ linkStorage.update(linksToInsert, ILinkStorage.DM_OPERATION.INSERT);
+ doTestLinkExist(createFeasibleLink());
+ doTestLinkExist(createExistingLink());
+ }
+
+ /**
+ * Test if update() can correctly deletes multiple Links.
+ */
+ @Test
+ public void testUpdate_DeleteLinks(){
+ List<Link> linksToDelete = createExistingLinks();
+ List<Link> linksToVerify = createExistingLinks();
+
+ // Test deletion of existing links
+ linkStorage.update(linksToDelete, ILinkStorage.DM_OPERATION.DELETE);
+ for(Link l : linksToVerify) {
+ doTestLinkNotExist(l);
+ }
+ }
+
+ /**
+ * Test if update() can handle mixture of normal/abnormal input for deletion of Links.
+ */
+ @Ignore @Test
+ public void testUpdate_DeleteLinks_Mixuture(){
+ List<Link> linksToDelete = new ArrayList<Link>();
+ linksToDelete.add(createFeasibleLink());
+ linksToDelete.add(createExistingLink());
+
+ // Test deletion of mixture of new/existing links
+ linkStorage.update(linksToDelete, ILinkStorage.DM_OPERATION.DELETE);
+ doTestLinkNotExist(createFeasibleLink());
+ doTestLinkNotExist(createExistingLink());
+ }
+
+ // TODO: remove @Ignore after UPDATE method is implemented
+ /**
+ * Test if updateLink() can correctly updates LinkInfo for a Link.
+ */
+ @Ignore @Test
+ public void testUpdateLink_Update() {
+ Link linkToUpdate= createExistingLink();
+ long currentTime = System.currentTimeMillis();
+ LinkInfo infoToUpdate = createFeasibleLinkInfo(currentTime);
+ LinkInfo infoToVerify = createFeasibleLinkInfo(currentTime);
+
+ linkStorage.updateLink(linkToUpdate, infoToUpdate, ILinkStorage.DM_OPERATION.UPDATE);
+
+ doTestLinkHasStateOf(linkToUpdate, infoToVerify);
+ }
+
+ /**
+ * Test if updateLink() can correctly creates a Link.
+ */
+ @Test
+ public void testUpdateLink_Create() {
+ Link linkToCreate = createFeasibleLink();
+ Link linkToVerify = createFeasibleLink();
+
+ //Use the link storage API to add the link
+ linkStorage.updateLink(linkToCreate, null, ILinkStorage.DM_OPERATION.CREATE);
+ doTestLinkExist(linkToVerify);
+ }
+
+ /**
+ * Test if updateLink() can correctly inserts a Link.
+ */
+ @Test
+ public void testUpdateLink_Insert() {
+ Link linkToInsert = createFeasibleLink();
+ Link linkToVerify = createFeasibleLink();
+
+ //Use the link storage API to add the link
+ linkStorage.updateLink(linkToInsert, null, ILinkStorage.DM_OPERATION.INSERT);
+
+ doTestLinkExist(linkToVerify);
+ }
+
+ // TODO: Check if addOrUpdateLink() should accept DELETE operation. If not, remove this test.
+ /**
+ * Test if updateLink() can correctly deletes a Link.
+ */
+ @Ignore @Test
+ public void testUpdateLink_Delete() {
+ Link linkToDelete = createExistingLink();
+ Link linkToVerify = createExistingLink();
+
+ // Test deletion of existing link
+ linkStorage.updateLink(linkToDelete, null, DM_OPERATION.DELETE);
+ doTestLinkNotExist(linkToVerify);
+
+ linkToDelete = createFeasibleLink();
+ linkToVerify = createFeasibleLink();
+
+ // Test deletion of not-existing link
+ linkStorage.updateLink(linkToDelete, null, DM_OPERATION.DELETE);
+ doTestLinkNotExist(linkToVerify);
+ }
+
+ /**
+ * Test if getLinks() can correctly return Links connected to specific DPID and port.
+ */
+ @Test
+ public void testGetLinks_ByDpidPort(){
+ Link linkToVerify = createExistingLink();
+ Long dpid = linkToVerify.getSrc();
+ short port = (short)linkToVerify.getSrcPort();
+
+ List<Link> list = linkStorage.getLinks(dpid, port);
+
+ assertEquals(list.size(), 1);
+
+ Link l = list.get(0);
+ assertEquals(l.getSrc(), linkToVerify.getSrc());
+ assertEquals(l.getSrcPort(), linkToVerify.getSrcPort());
+ assertEquals(l.getDst(), linkToVerify.getDst());
+ assertEquals(l.getDstPort(), linkToVerify.getDstPort());
+
+ Link linkToVerifyNot = createFeasibleLink();
+
+ List<Link> list2 = linkStorage.getLinks(linkToVerifyNot.getSrc(), (short)linkToVerifyNot.getSrcPort());
+
+ assertEquals(list2.size(), 0);
+ }
+
+ /**
+ * Test if getLinks() can correctly return Links connected to specific MAC address.
+ */
+ @Test
+ public void testGetLinks_ByString() {
+ Link linkToVeryfy = createExistingLink();
+ String dpid = HexString.toHexString(linkToVeryfy.getSrc());
+
+ List<Link> links = linkStorage.getLinks(dpid);
+ assertTrue(links.contains(linkToVeryfy));
+
+ Link linkToVerifyNot = createFeasibleLink();
+ assertFalse(links.contains(linkToVerifyNot));
+ }
+
+ /**
+ * Test if deleteLink() can correctly delete a Link.
+ */
+ @Test
+ public void testDeleteLink() {
+ // Deletion of existing link
+ Link linkToDelete = createExistingLink();
+ Link linkToVerify = createExistingLink();
+
+ linkStorage.deleteLink(linkToDelete);
+ doTestLinkNotExist(linkToVerify);
+ }
+
+ /**
+ * Test if deleteLinks() can correctly delete Links.
+ */
+ @Test
+ public void testDeleteLinks(){
+ List<Link> linksToDelete = createExistingLinks();
+ List<Link> linksToVerify = createExistingLinks();
+
+ linkStorage.deleteLinks(linksToDelete);
+ for(Link l : linksToVerify) {
+ doTestLinkNotExist(l);
+ }
+ }
+
+ /**
+ * Test if deleteLinks() can handle mixture of normal/abnormal input.
+ */
+ @Ignore @Test
+ public void testDeleteLinks_Mixture(){
+ List<Link> linksToDelete = new ArrayList<Link>();
+ linksToDelete.add(createFeasibleLink());
+ linksToDelete.add(createExistingLink());
+
+ // Test deletion of mixture of new/existing links
+ linkStorage.deleteLinks(linksToDelete);
+ doTestLinkNotExist(createFeasibleLink());
+ doTestLinkNotExist(createExistingLink());
+ }
+
+ /**
+ * Test if getActiveLinks() can correctly return active Links.
+ */
+ @Test
+ public void testGetActiveLinks() {
+ Link existingLink = createExistingLink();
+ Link notExistingLink = createFeasibleLink();
+
+ List<Link> links = linkStorage.getActiveLinks();
+
+ assertTrue(links.contains(existingLink));
+ assertFalse(links.contains(notExistingLink));
+ }
+
+ /**
+ * Test if deleteLinksOnPort() can delete Links.
+ */
+ @Test
+ public void testDeleteLinksOnPort() {
+ Link linkToDelete = createExistingLink();
+ Link linkToVerify = createExistingLink();
+
+ linkStorage.deleteLinksOnPort(linkToDelete.getSrc(), linkToDelete.getSrcPort());
+
+ doTestLinkNotExist(linkToVerify);
+ }
+
+ /**
+ * Test if specific link is existing
+ * @param link
+ */
+ private void doTestLinkExist(Link link) {
+ assertTrue(ope.hasLinkBetween(HexString.toHexString(link.getSrc()),
+ link.getSrcPort(),
+ HexString.toHexString(link.getDst()),
+ link.getDstPort()));
+ }
+
+ /**
+ * Test if titanGraph doesn't have specific link
+ * @param link
+ */
+ private void doTestLinkNotExist(Link link) {
+ assertFalse(ope.hasLinkBetween(HexString.toHexString(link.getSrc()),
+ link.getSrcPort(),
+ HexString.toHexString(link.getDst()),
+ link.getDstPort()));
+ }
+
+ /**
+ * Test if titanGraph has specific Link with specific LinkInfo
+ * @param link
+ */
+ private void doTestLinkHasStateOf(Link link, LinkInfo info) {
+ }
+
+ //----------------- Creation of test data -----------------------
+ // Assume a network shown below.
+ //
+ // [dpid1]--+--[port:1]----[port:1]--+--[dpid2]
+ // | |
+ // +--[port:2] [port:2]--+
+ // |
+ // +--[port:3] [port:1]--+--[dpid3]
+ // | |
+ // +--[port:4]----[port:2]--+
+ //
+ // dpid1 : 00:00:00:00:0a:01
+ // dpid2 : 00:00:00:00:0a:02
+ // dpid3 : 00:00:00:00:0a:03
+
+ private void initLinks() {
+ final String dpid1 = "00:00:00:00:0a:01";
+ final String dpid2 = "00:00:00:00:0a:02";
+ final String dpid3 = "00:00:00:00:0a:03";
+
+ ope.createNewSwitchForTest(dpid1).setStateForTest("ACTIVE");
+ ope.createNewSwitchForTest(dpid2).setStateForTest("ACTIVE");
+ ope.createNewSwitchForTest(dpid3).setStateForTest("ACTIVE");
+
+ TestPortObject ports1 [] = {
+ ope.createNewPortForTest(dpid1, (short)1),
+ ope.createNewPortForTest(dpid1, (short)2),
+ ope.createNewPortForTest(dpid1, (short)3),
+ ope.createNewPortForTest(dpid1, (short)4),
+ };
+
+ TestPortObject ports2 [] = {
+ ope.createNewPortForTest(dpid2, (short)1),
+ ope.createNewPortForTest(dpid2, (short)2),
+ };
+
+ TestPortObject ports3 [] = {
+ ope.createNewPortForTest(dpid3, (short)1),
+ ope.createNewPortForTest(dpid3, (short)2),
+ };
+
+ ope.setLinkBetweenPortsForTest(ports1[0], ports2[0]);
+ ope.setLinkBetweenPortsForTest(ports1[3], ports3[1]);
+ }
+
+ /**
+ * Returns new Link object of existing link
+ * @return new Link object
+ */
+ private Link createExistingLink() {
+ return new Link(Long.decode("0x0000000000000a01"), 1, Long.decode("0x0000000000000a02"), 1);
+ }
+
+ /**
+ * Returns new Link object of not-existing but feasible link
+ * @return new Link object
+ */
+ private Link createFeasibleLink() {
+ return new Link(Long.decode("0x0000000000000a01"), 3, Long.decode("0x0000000000000a03"), 1);
+ }
+
+ // make NO sense while test-network data doesn't define physical network (i.e. any link is feasible)
+ @SuppressWarnings("unused")
+ private Link createInfeasibleLink() {
+ return new Link(Long.decode("0x0000000000000a01"), 1, Long.decode("0x0000000000000a03"), 3);
+ }
+
+ /**
+ * Returns list of Link objects which all has information of existing link in titanGraph
+ * @return ArrayList of new Link objects
+ */
+ private List<Link> createExistingLinks() {
+ List<Link> links = new ArrayList<Link>();
+ links.add(new Link(Long.decode("0x0000000000000a01"), 1, Long.decode("0x0000000000000a02"), 1));
+ links.add(new Link(Long.decode("0x0000000000000a01"), 4, Long.decode("0x0000000000000a03"), 2));
+ return links;
+ }
+
+ /**
+ * Returns list of Link objects which all has information of not-existing but feasible link
+ * @return ArrayList of new Link objects
+ */
+ private List<Link> createFeasibleLinks() {
+ List<Link> links = new ArrayList<Link>();
+ links.add(new Link(Long.decode("0x0000000000000a01"), 2, Long.decode("0x0000000000000a02"), 2));
+ links.add(new Link(Long.decode("0x0000000000000a01"), 3, Long.decode("0x0000000000000a03"), 1));
+ return links;
+ }
+
+ /**
+ * Returns new LinkInfo object with convenient values.
+ * @return LinkInfo object
+ */
+ private LinkInfo createFeasibleLinkInfo(long time) {
+ long time_first = time;
+ long time_last_lldp = time + 50;
+ long time_last_bddp = time + 100;
+ int state_src = OFPhysicalPort.OFPortState.OFPPS_STP_FORWARD.getValue();
+ int state_dst = OFPhysicalPort.OFPortState.OFPPS_STP_LISTEN.getValue();
+
+ return new LinkInfo(time_first,
+ time_last_lldp,
+ time_last_bddp,
+ state_src,
+ state_dst);
+ }
+ //---------------------------------------------------------------
+}
diff --git a/src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java
similarity index 99%
rename from src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java
rename to src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java
index fb6b086..ebfb532 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/SwitchStorageImplTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/SwitchStorageImplTest.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.core.internal;
+package net.onrc.onos.ofcontroller.core.internal;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
new file mode 100644
index 0000000..b4cfc31
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestDatabaseManager.java
@@ -0,0 +1,76 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.apache.commons.io.FileUtils;
+
+import com.thinkaurelius.titan.core.TitanFactory;
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.blueprints.util.io.graphml.GraphMLReader;
+
+public class TestDatabaseManager {
+ private static final String testDbLocation = "/tmp/onos-testdb";
+
+ //private static final String testDbGraphML = "<?xml version=\"1.0\" ?><graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"> <key id=\"id\" for=\"node\" attr.name=\"id\" attr.type=\"string\"></key> <key id=\"type\" for=\"node\" attr.name=\"type\" attr.type=\"string\"></key> <key id=\"dpid\" for=\"node\" attr.name=\"dpid\" attr.type=\"string\"></key> <key id=\"desc\" for=\"node\" attr.name=\"desc\" attr.type=\"string\"></key> <key id=\"number\" for=\"node\" attr.name=\"number\" attr.type=\"int\"></key> <key id=\"dl_addr\" for=\"node\" attr.name=\"dl_addr\" attr.type=\"string\"></key> <key id=\"nw_addr\" for=\"node\" attr.name=\"nw_addr\" attr.type=\"string\"></key> <key id=\"id\" for=\"edge\" attr.name=\"id\" attr.type=\"string\"></key> <key id=\"source\" for=\"edge\" attr.name=\"source\" attr.type=\"string\"></key> <key id=\"target\" for=\"edge\" attr.name=\"target\" attr.type=\"string\"></key> <key id=\"label\" for=\"edge\" attr.name=\"label\" attr.type=\"string\"></key> <graph id=\"G\" edgedefault=\"directed\"> <node id=\"1\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:01</data> <data key=\"desc\">OpenFlow Switch at SEA</data> </node> <node id=\"2\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:02</data> <data key=\"desc\">OpenFlow Switch at LAX</data> </node> <node id=\"3\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:03</data> <data key=\"desc\">OpenFlow Switch at CHI</data> </node> <node id=\"4\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:04</data> <data key=\"desc\">OpenFlow Switch at IAH</data> </node> <node id=\"5\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:05</data> <data key=\"desc\">OpenFlow Switch at NYC</data> </node> <node id=\"6\"> <data key=\"type\">switch</data> <data key=\"dpid\">00:00:00:00:00:00:0a:06</data> <data key=\"desc\">OpenFlow Switch at ATL</data> </node> <node id=\"100\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at SEA Switch</data> </node> <node id=\"101\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at SEA Switch</data> </node> <node id=\"102\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at SEA Switch</data> </node> <node id=\"103\"> <data key=\"type\">port</data> <data key=\"number\">4</data> <data key=\"desc\">port 4 at SEA Switch</data> </node> <node id=\"104\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at LAX Switch</data> </node> <node id=\"105\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at LAX Switch</data> </node> <node id=\"106\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at LAX Switch</data> </node> <node id=\"107\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at CHI Switch</data> </node> <node id=\"108\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at CHI Switch</data> </node> <node id=\"109\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at CHI Switch</data> </node> <node id=\"110\"> <data key=\"type\">port</data> <data key=\"number\">4</data> <data key=\"desc\">port 4 at CHI Switch</data> </node> <node id=\"111\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at IAH Switch</data> </node> <node id=\"112\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at IAH Switch</data> </node> <node id=\"113\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at IAH Switch</data> </node> <node id=\"114\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at NYC Switch</data> </node> <node id=\"115\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at NYC Switch</data> </node> <node id=\"116\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at NYC Switch</data> </node> <node id=\"117\"> <data key=\"type\">port</data> <data key=\"number\">1</data> <data key=\"desc\">port 1 at ATL Switch</data> </node> <node id=\"118\"> <data key=\"type\">port</data> <data key=\"number\">2</data> <data key=\"desc\">port 2 at ATL Switch</data> </node> <node id=\"119\"> <data key=\"type\">port</data> <data key=\"number\">3</data> <data key=\"desc\">port 3 at ATL Switch</data> </node> <node id=\"1000\"> <data key=\"type\">device</data> <data key=\"dl_addr\">20:c9:d0:4a:e1:73</data> <data key=\"nw_addr\">192.168.10.101</data> </node> <node id=\"1001\"> <data key=\"type\">device</data> <data key=\"dl_addr\">20:c9:d0:4a:e1:62</data> <data key=\"nw_addr\">192.168.20.101</data> </node> <node id=\"1002\"> <data key=\"type\">device</data> <data key=\"dl_addr\">10:40:f3:e6:8d:55</data> <data key=\"nw_addr\">192.168.10.1</data> </node> <node id=\"1003\"> <data key=\"type\">device</data> <data key=\"dl_addr\">a0:b3:cc:9c:c6:88</data> <data key=\"nw_addr\">192.168.20.1</data> </node> <node id=\"1004\"> <data key=\"type\">device</data> <data key=\"dl_addr\">00:04:20:e2:50:a2</data> <data key=\"nw_addr\">192.168.30.1</data> </node> <node id=\"1005\"> <data key=\"type\">device</data> <data key=\"dl_addr\">58:55:ca:c4:1b:a0</data> <data key=\"nw_addr\">192.168.40.1</data> </node> <edge id=\"10000\" source=\"1\" target=\"101\" label=\"on\"></edge> <edge id=\"10001\" source=\"1\" target=\"102\" label=\"on\"></edge> <edge id=\"10002\" source=\"1\" target=\"103\" label=\"on\"></edge> <edge id=\"10003\" source=\"2\" target=\"104\" label=\"on\"></edge> <edge id=\"10004\" source=\"2\" target=\"105\" label=\"on\"></edge> <edge id=\"10005\" source=\"2\" target=\"106\" label=\"on\"></edge> <edge id=\"10006\" source=\"3\" target=\"107\" label=\"on\"></edge> <edge id=\"10007\" source=\"3\" target=\"108\" label=\"on\"></edge> <edge id=\"10008\" source=\"3\" target=\"109\" label=\"on\"></edge> <edge id=\"10009\" source=\"3\" target=\"110\" label=\"on\"></edge> <edge id=\"10010\" source=\"4\" target=\"111\" label=\"on\"></edge> <edge id=\"10011\" source=\"4\" target=\"112\" label=\"on\"></edge> <edge id=\"10012\" source=\"4\" target=\"113\" label=\"on\"></edge> <edge id=\"10013\" source=\"5\" target=\"114\" label=\"on\"></edge> <edge id=\"10014\" source=\"5\" target=\"115\" label=\"on\"></edge> <edge id=\"10015\" source=\"5\" target=\"116\" label=\"on\"></edge> <edge id=\"10016\" source=\"6\" target=\"117\" label=\"on\"></edge> <edge id=\"10017\" source=\"6\" target=\"118\" label=\"on\"></edge> <edge id=\"10018\" source=\"6\" target=\"119\" label=\"on\"></edge> <edge id=\"11000\" source=\"101\" target=\"107\" label=\"link\"></edge> <edge id=\"11003\" source=\"105\" target=\"111\" label=\"link\"></edge> <edge id=\"11004\" source=\"107\" target=\"101\" label=\"link\"></edge> <edge id=\"11005\" source=\"108\" target=\"112\" label=\"link\"></edge> <edge id=\"11006\" source=\"109\" target=\"114\" label=\"link\"></edge> <edge id=\"11007\" source=\"111\" target=\"105\" label=\"link\"></edge> <edge id=\"11008\" source=\"112\" target=\"108\" label=\"link\"></edge> <edge id=\"11009\" source=\"113\" target=\"117\" label=\"link\"></edge> <edge id=\"11010\" source=\"114\" target=\"109\" label=\"link\"></edge> <edge id=\"11011\" source=\"115\" target=\"118\" label=\"link\"></edge> <edge id=\"11012\" source=\"117\" target=\"113\" label=\"link\"></edge> <edge id=\"11013\" source=\"118\" target=\"115\" label=\"link\"></edge> <edge id=\"12000\" source=\"103\" target=\"1000\" label=\"host\"></edge> <edge id=\"12001\" source=\"103\" target=\"1001\" label=\"host\"></edge> <edge id=\"12002\" source=\"110\" target=\"1002\" label=\"host\"></edge> <edge id=\"12003\" source=\"116\" target=\"1003\" label=\"host\"></edge> <edge id=\"12004\" source=\"106\" target=\"1004\" label=\"host\"></edge> <edge id=\"12005\" source=\"119\" target=\"1005\" label=\"host\"></edge> </graph> </graphml>";
+
+ private static final String testDataLocation = "titan/schema/test-network.xml";
+
+ public static TitanGraph getTestDatabase(){
+ //return TitanFactory.open(testDbLocation);
+// return TitanFactory.openInMemoryGraph();
+ return TitanFactory.open(testDbLocation);
+ }
+
+ public static void populateTestData(TitanGraph titanGraph){
+ Set<String> s = titanGraph.getIndexedKeys(Vertex.class);
+ if (!s.contains("dpid")) {
+ titanGraph.createKeyIndex("dpid", Vertex.class);
+ titanGraph.stopTransaction(Conclusion.SUCCESS);
+ }
+ if (!s.contains("type")) {
+ titanGraph.createKeyIndex("type", Vertex.class);
+ titanGraph.stopTransaction(Conclusion.SUCCESS);
+ }
+
+ //InputStream graphMLStream = new ByteArrayInputStream(testDbGraphML.getBytes());
+
+ try {
+ InputStream graphMLStream = new FileInputStream(testDataLocation);
+ GraphMLReader.inputGraph(titanGraph, graphMLStream);
+ } catch (FileNotFoundException e) {
+ Assert.fail("Test data file not found: " + testDataLocation);
+ } catch (IOException e) {
+ e.printStackTrace();
+ Assert.fail("IOException thrown");
+ }
+
+ //Change the type of all port numbers to short in the database
+ Iterator<Vertex> it = titanGraph.getVertices("type", "port").iterator();
+ while (it.hasNext()){
+ Vertex port = it.next();
+ Integer portNum = (Integer) port.getProperty("number");
+ port.setProperty("number", portNum.shortValue());
+ }
+ titanGraph.stopTransaction(Conclusion.SUCCESS);
+ }
+
+ public static void deleteTestDatabase(){
+ try {
+ FileUtils.deleteDirectory(new File(testDbLocation));
+ } catch (IOException e) {
+ System.out.println("delete failed");
+ e.printStackTrace();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
new file mode 100644
index 0000000..31a4bb0
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableGraphDBOperation.java
@@ -0,0 +1,1331 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.easymock.EasyMock;
+import org.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.tinkerpop.blueprints.Vertex;
+import com.tinkerpop.frames.annotations.gremlin.GremlinParam;
+
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
+import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
+import net.onrc.onos.ofcontroller.util.FlowEntryId;
+import net.onrc.onos.ofcontroller.util.FlowId;
+import net.onrc.onos.util.GraphDBConnection;
+import net.onrc.onos.util.GraphDBOperation;
+import net.onrc.onos.util.IDBConnection;
+
+/**
+ * Mock class of GraphDBOperation which provides additional setter to construct a graph for test.
+ * This object simply caches parameters set up by override interfaces and reflect them when commit().
+ * *ForTest() methods are exempt from cache, parameters through those methods are reflected soon.
+ * @author Naoki Shiota
+ *
+ */
+public class TestableGraphDBOperation extends GraphDBOperation {
+ protected static Logger log = LoggerFactory.getLogger(TestableGraphDBOperation.class);
+
+ protected List<TestSwitchObject> switches;
+ protected List<TestPortObject> ports;
+ protected List<TestDeviceObject> devices;
+ protected List<TestFlowPath> paths;
+ protected List<TestFlowEntry> entries;
+
+ protected List<TestSwitchObject> switchesToAdd;
+ protected List<TestPortObject> portsToAdd;
+ protected List<TestDeviceObject> devicesToAdd;
+ protected List<TestFlowPath> pathsToAdd;
+ protected List<TestFlowEntry> entriesToAdd;
+
+ protected List<TestSwitchObject> switchesToRemove;
+ protected List<TestPortObject> portsToRemove;
+ protected List<TestDeviceObject> devicesToRemove;
+ protected List<TestFlowPath> pathsToRemove;
+ protected List<TestFlowEntry> entriesToRemove;
+
+ // Testable implementations of INetMapTopologyObject interfaces
+
+ public static class TestSwitchObject implements ISwitchObject {
+ private String state,type,dpid;
+ private List<IPortObject> ports;
+ private List<IDeviceObject> devices;
+ private List<IFlowEntry> entries;
+
+ private String stateToUpdate, typeToUpdate, dpidToUpdate;
+ private List<IPortObject> portsToAdd;
+ private List<IPortObject> portsToRemove;
+
+ public TestSwitchObject() {
+ type = "switch";
+
+ ports = new ArrayList<IPortObject>();
+ portsToAdd = new ArrayList<IPortObject>();
+ portsToRemove = new ArrayList<IPortObject>();
+ devices = new ArrayList<IDeviceObject>();
+ entries = new ArrayList<IFlowEntry>();
+
+ clearUncommitedData();
+ }
+
+ public void commit() {
+ for(IPortObject port : portsToAdd) {
+ ports.add(port);
+ }
+ for(IPortObject port : portsToRemove) {
+ ports.remove(port);
+ }
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(dpidToUpdate != null) { dpid = dpidToUpdate; }
+
+ clearUncommitedData();
+ }
+
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ public void clearUncommitedData() {
+ portsToAdd.clear();
+ portsToRemove.clear();
+ stateToUpdate = typeToUpdate = dpidToUpdate = null;
+ }
+
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setDpidForTest(String dpid) { this.dpid = dpid; }
+ public void addPortForTest(TestPortObject port) { ports.add(port); }
+ public void addDeviceForTest(TestDeviceObject dev) { devices.add(dev); }
+ public void addEntryForTest(TestFlowEntry entry) { entries.add(entry); }
+
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { this.stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type ; }
+
+ @Override
+ public void setType(String type) { this.typeToUpdate = type; }
+
+ // Not support for test
+ @Override
+ public Vertex asVertex() { return null; }
+
+ @Override
+ public String getDPID() { return dpid; }
+
+ @Override
+ public void setDPID(String dpid) { this.dpidToUpdate = dpid; }
+
+ @Override
+ public Iterable<IPortObject> getPorts() { return ports; }
+
+ @Override
+ public IPortObject getPort(@GremlinParam("port_num") short port_num) {
+ for(IPortObject port : ports) {
+ if(port.getNumber() == port_num) {
+ return port;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void addPort(IPortObject port) { portsToAdd.add(port); }
+
+ @Override
+ public void removePort(IPortObject port) { portsToRemove.add(port); }
+
+ @Override
+ public Iterable<IDeviceObject> getDevices() { return devices; }
+
+ @Override
+ public Iterable<IFlowEntry> getFlowEntries() { return entries; }
+ }
+
+ public static class TestPortObject implements IPortObject {
+ private String state,type,desc;
+ private Short number;
+ private Integer port_state;
+ private ISwitchObject sw;
+
+ private List<IPortObject> linkedPorts;
+ private List<IDeviceObject> devices;
+ private List<IFlowEntry> inflows,outflows;
+
+ private String stateToUpdate,typeToUpdate,descToUpdate;
+ private Short numberToUpdate;
+ private Integer port_stateToUpdate;
+
+ private List<IPortObject> linkedPortsToAdd;
+ private List<IPortObject> linkedPortsToRemove;
+ private List<IDeviceObject> devicesToAdd;
+ private List<IDeviceObject> devicesToRemove;
+
+
+ public TestPortObject() {
+ type = "port";
+
+ linkedPorts = new ArrayList<IPortObject>();
+ linkedPortsToAdd = new ArrayList<IPortObject>();
+ linkedPortsToRemove = new ArrayList<IPortObject>();
+ devices = new ArrayList<IDeviceObject>();
+ devicesToAdd = new ArrayList<IDeviceObject>();
+ devicesToRemove = new ArrayList<IDeviceObject>();
+ inflows = new ArrayList<IFlowEntry>();
+ outflows = new ArrayList<IFlowEntry>();
+
+ clearUncommitedData();
+ }
+
+ public void commit() {
+ for(IPortObject port : linkedPortsToAdd) { linkedPorts.add(port); }
+ for(IPortObject port : linkedPortsToRemove) { linkedPorts.remove(port); }
+ for(IDeviceObject dev : devicesToAdd) { devices.add(dev); }
+ for(IDeviceObject dev : devicesToRemove) { devices.remove(dev); }
+
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(descToUpdate != null) { desc = descToUpdate; }
+ if(numberToUpdate != null) { number = numberToUpdate; }
+ if(port_stateToUpdate != null) { port_state = port_stateToUpdate; }
+
+ clearUncommitedData();
+ }
+
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ public void clearUncommitedData() {
+ linkedPortsToAdd.clear();
+ linkedPortsToRemove.clear();
+ devicesToAdd.clear();
+ devicesToRemove.clear();
+ stateToUpdate = typeToUpdate = descToUpdate = null;
+ port_stateToUpdate = null;
+ numberToUpdate = null;
+ }
+
+ // Setter methods for test
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setDescForTest(String desc) { this.desc = desc; }
+ public void setNumberForTest(Short number) { this.number = number; }
+ public void setPortStateForTest(Integer state) { this.port_state = state; }
+ public void setSwitchForTest(ISwitchObject sw) { this.sw = sw; }
+ public void addLinkedPortForTest(TestPortObject port) { this.linkedPorts.add(port); }
+ public void addInflowForTest(TestFlowEntry entry) { inflows.add(entry); }
+ public void addOutflowForTest(TestFlowEntry entry) { outflows.add(entry); }
+
+ // Override methods for mock IPortObject
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { this.stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type; }
+
+ @Override
+ public void setType(String type) { this.typeToUpdate = type; }
+
+ // not support for test
+ @Override
+ public Vertex asVertex() {
+ return null;
+ }
+
+ @Override
+ public Short getNumber() { return number; }
+
+ @Override
+ public void setNumber(Short n) { this.numberToUpdate = n; }
+
+ @Override
+ public String getDesc() { return desc; }
+
+ @Override
+ public void setDesc(String s) { this.descToUpdate = s; }
+
+ @Override
+ public Integer getPortState() { return port_state; }
+
+ @Override
+ public void setPortState(Integer s) { this.port_stateToUpdate = s; }
+
+ @Override
+ public ISwitchObject getSwitch() { return sw; }
+
+ @Override
+ public Iterable<IDeviceObject> getDevices() { return devices; }
+
+ @Override
+ public void setDevice(IDeviceObject device) { devicesToAdd.add(device); }
+
+ @Override
+ public void removeDevice(IDeviceObject device) { devicesToRemove.add(device); }
+
+ @Override
+ public Iterable<IFlowEntry> getInFlowEntries() { return inflows; }
+
+ @Override
+ public Iterable<IFlowEntry> getOutFlowEntries() { return outflows; }
+
+ @Override
+ public Iterable<IPortObject> getLinkedPorts() { return linkedPorts; }
+
+ @Override
+ public void removeLink(IPortObject dest_port) { linkedPortsToRemove.add(dest_port); }
+
+ @Override
+ public void setLinkPort(IPortObject dest_port) { linkedPortsToAdd.add(dest_port); }
+ }
+
+ public static class TestDeviceObject implements IDeviceObject {
+ private String state,type,mac,ipaddr;
+ private List<IPortObject> ports;
+ private List<ISwitchObject> switches;
+
+ private String stateToUpdate,typeToUpdate,macToUpdate,ipaddrToUpdate;
+ private List<IPortObject> portsToAdd;
+ private List<IPortObject> portsToRemove;
+
+ public TestDeviceObject() {
+ type = "device";
+
+ ports = new ArrayList<IPortObject>();
+ portsToAdd = new ArrayList<IPortObject>();
+ portsToRemove = new ArrayList<IPortObject>();
+ switches = new ArrayList<ISwitchObject>();
+
+ clearUncommitedData();
+ }
+
+ public void commit() {
+ for(IPortObject port : portsToAdd) {
+ ports.add(port);
+ }
+ for(IPortObject port : portsToRemove) {
+ ports.remove(port);
+ }
+
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(macToUpdate != null) { mac = macToUpdate; }
+ if(ipaddrToUpdate != null) { ipaddr = ipaddrToUpdate; }
+
+ clearUncommitedData();
+ }
+
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ public void clearUncommitedData() {
+ ports.clear();
+ portsToAdd.clear();
+ portsToRemove.clear();
+
+ stateToUpdate = typeToUpdate = macToUpdate = ipaddrToUpdate = null;
+ }
+
+ // Setter methods for test
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setMacForTest(String mac) { this.mac = mac; }
+ public void setIpaddrForTest(String ipaddr) { this.ipaddr = ipaddr; }
+ public void addSwitchForTest(ISwitchObject sw) { switches.add(sw); }
+ public void addPortForTest(IPortObject port) { ports.add(port); }
+
+
+ // Override methods
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type; }
+
+ @Override
+ public void setType(String type) { typeToUpdate = type; }
+
+ @Override
+ public Vertex asVertex() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getMACAddress() { return mac; }
+
+ @Override
+ public void setMACAddress(String macaddr) { macToUpdate = macaddr; }
+
+ @Override
+ public String getIPAddress() { return ipaddr; }
+
+ @Override
+ public void setIPAddress(String ipaddr) { ipaddrToUpdate = ipaddr; }
+
+ @Override
+ public Iterable<IPortObject> getAttachedPorts() {
+ return ports; }
+
+ @Override
+ public void setHostPort(IPortObject port) { portsToAdd.add(port); }
+
+ @Override
+ public void removeHostPort(IPortObject port) { portsToRemove.add(port); }
+
+ @Override
+ public Iterable<ISwitchObject> getSwitch() { return switches; }
+ }
+
+ public static class TestFlowPath implements IFlowPath {
+ private String state,type,flowId,installerId,srcSw,dstSw;
+ private String dataPathSummary,userState;
+ private String matchSrcMac,matchDstMac,matchSrcIpaddr,matchDstIpaddr;
+ private Short srcPort,dstPort,matchEthernetFrameType;
+
+ private List<IFlowEntry> entries;
+ private List<ISwitchObject> switches;
+
+ private String stateToUpdate,typeToUpdate,flowIdToUpdate,installerIdToUpdate,srcSwToUpdate,dstSwToUpdate;
+ private String dataPathSummaryToUpdate,userStateToUpdate;
+ private String matchSrcMacToUpdate,matchDstMacToUpdate,matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
+ private Short srcPortToUpdate,dstPortToUpdate,matchEthernetFrameTypeToUpdate;
+
+ private List<IFlowEntry> flowsToAdd;
+ private List<IFlowEntry> flowsToRemove;
+
+ public TestFlowPath() {
+ type = "flow";
+
+ entries = new ArrayList<IFlowEntry>();
+ flowsToAdd = new ArrayList<IFlowEntry>();
+ flowsToRemove = new ArrayList<IFlowEntry>();
+
+ switches = new ArrayList<ISwitchObject>();
+
+ clear();
+ }
+
+ public void commit() {
+ for(IFlowEntry flow : flowsToAdd) {
+ entries.add(flow);
+ }
+ for(IFlowEntry flow : flowsToRemove) {
+ entries.remove(flow);
+ }
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(flowIdToUpdate != null) { flowId = flowIdToUpdate; }
+ if(installerIdToUpdate != null) { installerId = installerIdToUpdate; }
+ if(srcSwToUpdate != null) { srcSw = srcSwToUpdate; }
+ if(dstSwToUpdate != null) { dstSw = dstSwToUpdate; }
+ if(dataPathSummaryToUpdate != null) { dataPathSummary = dataPathSummaryToUpdate; }
+ if(userStateToUpdate != null) { userState = userStateToUpdate; }
+ if(matchSrcMacToUpdate != null) { matchSrcMac = matchSrcMacToUpdate; }
+ if(matchDstMacToUpdate != null) { matchDstMac = matchDstMacToUpdate; }
+ if(matchSrcIpaddrToUpdate != null) { matchSrcIpaddr = matchSrcIpaddrToUpdate; }
+ if(matchDstIpaddrToUpdate != null) { matchDstIpaddr = matchDstIpaddrToUpdate; }
+ if(srcPortToUpdate != null) { srcPort = srcPortToUpdate; }
+ if(dstPortToUpdate != null) { dstPort = dstPortToUpdate; }
+ if(matchEthernetFrameTypeToUpdate != null) { matchEthernetFrameType = matchEthernetFrameTypeToUpdate; }
+ }
+
+ public void rollback() {
+ clear();
+ }
+
+ public void clear() {
+ flowsToAdd.clear();
+ flowsToRemove.clear();
+
+ stateToUpdate = typeToUpdate = flowIdToUpdate = installerIdToUpdate = null;
+ srcSwToUpdate = dstSwToUpdate = dataPathSummaryToUpdate = userStateToUpdate = null;
+ matchSrcMacToUpdate = matchDstMacToUpdate = matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
+ srcPortToUpdate = dstPortToUpdate = matchEthernetFrameTypeToUpdate = null;
+ }
+
+ // Setter methods for test
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setFlowIdForTest(String flowId) { this.flowId = flowId; }
+ public void setInstallerIdForTest(String installerId) { this.installerId = installerId; }
+ public void setSrcSwForTest(String srcSw) { this.srcSw = srcSw; }
+ public void setDstSwForTest(String dstSw) { this.dstSw = dstSw; }
+ public void setDataPathSummaryForTest(String dataPathSummary) { this.dataPathSummary = dataPathSummary; }
+ public void setUserStateForTest(String userState) { this.userState = userState; }
+ public void setMatchSrcMacForTest(String matchSrcMac) { this.matchSrcMac = matchSrcMac; }
+ public void setMatchDstMacForTest(String matchDstMac) { this.matchDstMac = matchDstMac; }
+ public void setMatchSrcIpaddrForTest(String matchSrcIpaddr) { this.matchSrcIpaddr = matchSrcIpaddr; }
+ public void setMatchDstIpaddrForTest(String matchDstIpaddr) { this.matchDstIpaddr = matchDstIpaddr; }
+ public void setSrcPortForTest(Short srcPort) { this.srcPort = srcPort; }
+ public void setDstPortForTest(Short dstPort) { this.dstPort = dstPort; }
+ public void setMatchEthernetFrameTypeForTest(Short matchEthernetFrameType) { this.matchEthernetFrameType = matchEthernetFrameType; }
+ public void addFlowEntryForTest(IFlowEntry entry) { entries.add(entry); }
+ public void addSwitchForTest(ISwitchObject sw) { switches.add(sw); }
+
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type; }
+
+ @Override
+ public void setType(String type) { typeToUpdate = type; }
+
+ @Override
+ public Vertex asVertex() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFlowId() { return flowId; }
+
+ @Override
+ public void setFlowId(String flowId) { flowIdToUpdate = flowId; }
+
+ @Override
+ public String getInstallerId() { return installerId; }
+
+ @Override
+ public void setInstallerId(String installerId) { installerIdToUpdate = installerId; }
+
+ @Override
+ public String getSrcSwitch() { return srcSw; }
+
+ @Override
+ public void setSrcSwitch(String srcSwitch) { srcSwToUpdate = srcSwitch; }
+
+ @Override
+ public Short getSrcPort() { return srcPort; }
+
+ @Override
+ public void setSrcPort(Short srcPort) { srcPortToUpdate = srcPort; }
+
+ @Override
+ public String getDstSwitch() { return dstSw; }
+
+ @Override
+ public void setDstSwitch(String dstSwitch) { dstSwToUpdate = dstSwitch; }
+
+ @Override
+ public Short getDstPort() { return dstPort; }
+
+ @Override
+ public void setDstPort(Short dstPort) { dstPortToUpdate = dstPort; }
+
+ @Override
+ public String getDataPathSummary() { return dataPathSummary; }
+
+ @Override
+ public void setDataPathSummary(String dataPathSummary) { dataPathSummaryToUpdate = dataPathSummary; }
+
+ @Override
+ public Iterable<IFlowEntry> getFlowEntries() { return entries; }
+
+ @Override
+ public void addFlowEntry(IFlowEntry flowEntry) {
+ if(! entries.contains(flowEntry)) {
+ flowsToAdd.add(flowEntry);
+ }
+ }
+
+ @Override
+ public void removeFlowEntry(IFlowEntry flowEntry) {
+ if(entries.contains(flowEntry)) {
+ flowsToAdd.add(flowEntry);
+ }
+ }
+
+ @Override
+ public Short getMatchEthernetFrameType() { return matchEthernetFrameType; }
+
+ @Override
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType) {
+ matchEthernetFrameTypeToUpdate = matchEthernetFrameType; }
+
+ @Override
+ public String getMatchSrcMac() { return matchSrcMac; }
+
+ @Override
+ public void setMatchSrcMac(String matchSrcMac) { matchSrcMacToUpdate = matchSrcMac; }
+
+ @Override
+ public String getMatchDstMac() { return matchDstMac; }
+
+ @Override
+ public void setMatchDstMac(String matchDstMac) { matchDstMacToUpdate = matchDstMac; }
+
+ @Override
+ public String getMatchSrcIPv4Net() { return matchSrcIpaddr; }
+
+ @Override
+ public void setMatchSrcIPv4Net(String matchSrcIPv4Net) {
+ matchSrcIpaddrToUpdate = matchSrcIPv4Net; }
+
+ @Override
+ public String getMatchDstIPv4Net() { return matchDstIpaddr; }
+
+ @Override
+ public void setMatchDstIPv4Net(String matchDstIPv4Net) {
+ matchDstIpaddrToUpdate = matchDstIPv4Net; }
+
+ @Override
+ public Iterable<ISwitchObject> getSwitches() { return switches; }
+
+ @Override
+ public String getUserState() { return userState; }
+
+ @Override
+ public void setUserState(String userState) { userStateToUpdate = userState; }
+ }
+
+ public static class TestFlowEntry implements IFlowEntry {
+ private String state,type,entryId,dpid,userState,switchState,errorStateType,errorStateCode;
+ private String matchSrcMac,matchDstMac,matchSrcIpaddr,matchDstIpaddr;
+ private Short matchInPort,matchEtherFrameType,actionOutput;
+
+ private IFlowPath flowPath;
+ private ISwitchObject sw;
+ private IPortObject inport,outport;
+
+ private String stateToUpdate,typeToUpdate,entryIdToUpdate,dpidToUpdate,
+ userStateToUpdate,switchStateToUpdate,errorStateTypeToUpdate,errorStateCodeToUpdate;
+ private String matchSrcMacToUpdate,matchDstMacToUpdate,matchSrcIpaddrToUpdate,matchDstIpaddrToUpdate;
+
+ private Short matchInPortToUpdate,matchEtherFrameTypeToUpdate,actionOutputToUpdate;
+
+ private IFlowPath flowPathToUpdate;
+ private ISwitchObject swToUpdate;
+ private IPortObject inportToUpdate,outportToUpdate;
+
+ public TestFlowEntry() {
+ type = "flow_entry";
+
+ clearUncommitedData();
+ }
+
+ public void commit() {
+ if(stateToUpdate != null) { state = stateToUpdate; }
+ if(typeToUpdate != null) { type = typeToUpdate; }
+ if(entryIdToUpdate != null) { entryId = entryIdToUpdate; }
+ if(dpidToUpdate != null) { dpid = dpidToUpdate; }
+ if(userStateToUpdate != null) { userState = userStateToUpdate; }
+ if(switchStateToUpdate != null) { switchState = switchStateToUpdate; }
+ if(errorStateTypeToUpdate != null) { errorStateType = errorStateTypeToUpdate; }
+ if(errorStateCodeToUpdate != null) { errorStateCode = errorStateCodeToUpdate; }
+ if(matchSrcMacToUpdate != null) { matchSrcMac = matchSrcMacToUpdate; }
+ if(matchDstMacToUpdate != null) { matchDstMac = matchDstMacToUpdate; }
+ if(matchSrcIpaddrToUpdate != null) { matchSrcIpaddr = matchSrcIpaddrToUpdate; }
+ if(matchDstIpaddrToUpdate != null) { matchDstIpaddr = matchDstIpaddrToUpdate; }
+ if(matchInPortToUpdate != null) { matchInPort = matchInPortToUpdate; }
+ if(matchEtherFrameTypeToUpdate != null) { matchEtherFrameType = matchEtherFrameTypeToUpdate; }
+ if(actionOutputToUpdate != null) { actionOutput = actionOutputToUpdate; }
+
+ if(flowPathToUpdate != null) { flowPath = flowPathToUpdate; }
+ if(swToUpdate != null) { sw = swToUpdate; }
+ if(inportToUpdate != null) { inport = inportToUpdate; }
+ if(outportToUpdate != null) { outport = outportToUpdate; }
+
+ clearUncommitedData();
+ }
+
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ public void clearUncommitedData() {
+ stateToUpdate = typeToUpdate = entryIdToUpdate = dpidToUpdate = null;
+ userStateToUpdate = switchStateToUpdate = errorStateTypeToUpdate = errorStateCodeToUpdate = null;
+ matchSrcMacToUpdate = matchDstMacToUpdate = matchSrcIpaddrToUpdate = matchDstIpaddrToUpdate = null;
+ matchInPortToUpdate = matchEtherFrameTypeToUpdate = actionOutputToUpdate = null;
+ flowPathToUpdate = null;
+ swToUpdate = null;
+ inportToUpdate = outportToUpdate = null;
+ }
+
+ // Setter methods for test
+ public void setStateForTest(String state) { this.state = state; }
+ public void setTypeForTest(String type) { this.type = type; }
+ public void setEntryIdForTest(String entryId) { this.entryId = entryId; }
+ public void setDpidForTest(String dpid) { this.dpid = dpid; }
+ public void setUserStateForTest(String userState) { this.userState = userState; }
+ public void setSwitchStateForTest(String switchState) { this.switchState = switchState; }
+ public void setErrorStateTypeForTest(String errorStateType) { this.errorStateType = errorStateType; }
+ public void setErrorStateCodeForTest(String errorStateCode) { this.errorStateCode = errorStateCode; }
+ public void setMatchSrcMacForTest(String matchSrcMac) { this.matchSrcMac = matchSrcMac; }
+ public void setMatchDstMacForTest(String matchDstMac) { this.matchDstMac = matchDstMac; }
+ public void setMatchSrcIpaddrForTest(String matchSrcIpaddr) { this.matchSrcIpaddr = matchSrcIpaddr; }
+ public void setMatchDstIpaddrForTest(String matchDstIpaddr) { this.matchDstIpaddr = matchDstIpaddr; }
+ public void setMatchInPortForTest(Short matchInPort) { this.matchInPort = matchInPort; }
+ public void setMatchEtherFrameTypeForTest(Short matchEtherFrameType) { this.matchEtherFrameType = matchEtherFrameType; }
+ public void setActionOutputForTest(Short actionOutput) { this.actionOutput = actionOutput; }
+ public void setFlowPathForTest(IFlowPath flowPath) { this.flowPath = flowPath; }
+ public void setSwitchForTest(ISwitchObject sw) { this.sw = sw; }
+ public void setInportForTest(IPortObject inport) { this.inport = inport; }
+ public void setOutportForTest(IPortObject outport) { this.outport = outport; }
+
+ @Override
+ public String getState() { return state; }
+
+ @Override
+ public void setState(String state) { stateToUpdate = state; }
+
+ @Override
+ public String getType() { return type; }
+
+ @Override
+ public void setType(String type) { typeToUpdate = type; }
+
+ @Override
+ public Vertex asVertex() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getFlowEntryId() { return entryId; }
+
+ @Override
+ public void setFlowEntryId(String flowEntryId) { entryIdToUpdate = flowEntryId; }
+
+ @Override
+ public String getSwitchDpid() { return dpid; }
+
+ @Override
+ public void setSwitchDpid(String switchDpid) { dpidToUpdate = switchDpid; }
+
+ @Override
+ public String getUserState() { return userState; }
+
+ @Override
+ public void setUserState(String userState) { userStateToUpdate = userState; }
+
+ @Override
+ public String getSwitchState() { return switchState; }
+
+ @Override
+ public void setSwitchState(String switchState) { switchStateToUpdate = switchState; }
+
+ @Override
+ public String getErrorStateType() { return errorStateType; }
+
+ @Override
+ public void setErrorStateType(String errorStateType) { errorStateTypeToUpdate = errorStateType; }
+
+ @Override
+ public String getErrorStateCode() { return errorStateCode; }
+
+ @Override
+ public void setErrorStateCode(String errorStateCode) { errorStateCodeToUpdate = errorStateCode; }
+
+ @Override
+ public Short getMatchInPort() { return matchInPort; }
+
+ @Override
+ public void setMatchInPort(Short matchInPort) { matchInPortToUpdate = matchInPort; }
+
+ @Override
+ public Short getMatchEthernetFrameType() {return matchEtherFrameType; }
+
+ @Override
+ public void setMatchEthernetFrameType(Short matchEthernetFrameType) { matchEtherFrameTypeToUpdate = matchEthernetFrameType; }
+
+ @Override
+ public String getMatchSrcMac() { return matchSrcMac; }
+
+ @Override
+ public void setMatchSrcMac(String matchSrcMac) { matchSrcMacToUpdate = matchSrcMac; }
+
+ @Override
+ public String getMatchDstMac() { return matchDstMac; }
+
+ @Override
+ public void setMatchDstMac(String matchDstMac) { matchDstMacToUpdate = matchDstMac; }
+
+ @Override
+ public String getMatchSrcIPv4Net() { return matchSrcIpaddr; }
+
+ @Override
+ public void setMatchSrcIPv4Net(String matchSrcIPv4Net) { matchSrcIpaddrToUpdate = matchSrcIPv4Net; }
+
+ @Override
+ public String getMatchDstIPv4Net() { return matchDstIpaddr; }
+
+ @Override
+ public void setMatchDstIPv4Net(String matchDstIPv4Net) { matchDstIpaddrToUpdate = matchDstIPv4Net; }
+
+ @Override
+ public Short getActionOutput() { return actionOutput; }
+
+ @Override
+ public void setActionOutput(Short actionOutput) { actionOutputToUpdate = actionOutput; }
+
+ @Override
+ public IFlowPath getFlow() { return flowPath; }
+
+ @Override
+ public void setFlow(IFlowPath flow) { flowPathToUpdate = flow; }
+
+ @Override
+ public ISwitchObject getSwitch() { return sw; }
+
+ @Override
+ public void setSwitch(ISwitchObject sw) { swToUpdate = sw; }
+
+ @Override
+ public IPortObject getInPort() { return inport; }
+
+ @Override
+ public void setInPort(IPortObject port) { inportToUpdate = port; }
+
+ @Override
+ public IPortObject getOutPort() { return outport; }
+
+ @Override
+ public void setOutPort(IPortObject port) { outportToUpdate = port; }
+ }
+
+
+ public TestableGraphDBOperation() {
+ super(EasyMock.createNiceMock(GraphDBConnection.class));
+
+ switches = new ArrayList<TestSwitchObject>();
+ ports = new ArrayList<TestPortObject>();
+ devices = new ArrayList<TestDeviceObject>();
+ paths = new ArrayList<TestFlowPath>();
+ entries = new ArrayList<TestFlowEntry>();
+
+ switchesToAdd = new ArrayList<TestSwitchObject>();
+ portsToAdd = new ArrayList<TestPortObject>();
+ devicesToAdd = new ArrayList<TestDeviceObject>();
+ pathsToAdd = new ArrayList<TestFlowPath>();
+ entriesToAdd = new ArrayList<TestFlowEntry>();
+
+ switchesToRemove = new ArrayList<TestSwitchObject>();
+ portsToRemove = new ArrayList<TestPortObject>();
+ devicesToRemove = new ArrayList<TestDeviceObject>();
+ pathsToRemove = new ArrayList<TestFlowPath>();
+ entriesToRemove = new ArrayList<TestFlowEntry>();
+
+ clearUncommitedData();
+ }
+
+ private void clearUncommitedData() {
+ for(TestFlowEntry flow : entries) {
+ flow.clearUncommitedData();
+ }
+ for(TestFlowEntry flow : entriesToAdd) {
+ flow.clearUncommitedData();
+ }
+
+ for(TestDeviceObject dev : devices) {
+ dev.clearUncommitedData();
+ }
+ for(TestDeviceObject dev : devicesToAdd) {
+ dev.clearUncommitedData();
+ }
+
+ for(TestSwitchObject sw : switches) {
+ sw.clearUncommitedData();
+ }
+ for(TestSwitchObject sw : switchesToAdd) {
+ sw.clearUncommitedData();
+ }
+
+ for(TestPortObject port : ports) {
+ port.clearUncommitedData();
+ }
+ for(TestPortObject port : portsToAdd) {
+ port.clearUncommitedData();
+ }
+
+ entriesToAdd.clear();
+ entriesToRemove.clear();
+ devicesToAdd.clear();
+ devicesToRemove.clear();
+ switchesToAdd.clear();
+ switchesToRemove.clear();
+ portsToAdd.clear();
+ portsToRemove.clear();
+ }
+
+
+ // this.*ForTest() methods below are supposed to be used for creation of test topology.
+ /**
+ * Create new empty TestSwitchObject.
+ * @return New TestSwitchObject
+ */
+ public TestSwitchObject createNewSwitchForTest() {
+ TestSwitchObject sw = new TestSwitchObject();
+ switches.add(sw);
+ return sw;
+ }
+
+ /**
+ * Create new TestSwitchObject with specific DPID.
+ * @param dpid DPID to be set
+ * @return New TestSwitchObject
+ */
+ public TestSwitchObject createNewSwitchForTest(String dpid) {
+ for(TestSwitchObject sw_loop : switches) {
+ if(sw_loop.getDPID().equals(dpid)) {
+ // Already created
+ log.error("switch already exists : " + dpid);
+ return sw_loop;
+ }
+ }
+
+ TestSwitchObject sw = new TestSwitchObject();
+
+ sw.setDpidForTest(dpid);
+ switches.add(sw);
+
+ return sw;
+ }
+
+ /**
+ * Create new empty TestPortObject.
+ * @return New TestPortObject
+ */
+ public TestPortObject createNewPortForTest() {
+ TestPortObject port = new TestPortObject();
+ ports.add(port);
+ return port;
+ }
+
+ /**
+ * Create new TestPortObject with specific DPID and port number.
+ * @param dpid DPID to be set
+ * @param number Port number to be set
+ * @return New TestPortObject
+ */
+ public TestPortObject createNewPortForTest(String dpid, Short number) {
+ TestSwitchObject sw = null;
+
+ for(TestSwitchObject sw_loop : switches) {
+ if(sw_loop.getDPID().equals(dpid)) {
+ sw = sw_loop;
+ }
+ }
+
+ if(sw != null) {
+ TestPortObject port = new TestPortObject();
+ port.setNumberForTest(number);
+ port.setSwitchForTest(sw);
+ sw.addPortForTest(port);
+
+ ports.add(port);
+
+ return port;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Link a TestPortObject to other TestPortObject.
+ * @param src TestPortObjecgt of source port.
+ * @param dst TestPortObjecgt of destination port.
+ */
+ public void setLinkBetweenPortsForTest(TestPortObject src, TestPortObject dst) {
+ src.addLinkedPortForTest(dst);
+ }
+
+ /**
+ * Create new empty TestDeviceObject.
+ * @return New TestDeviceObject
+ */
+ public TestDeviceObject createNewDeviceForTest() {
+ TestDeviceObject dev = new TestDeviceObject();
+
+ return dev;
+ }
+
+ /**
+ * Create new empty TestFlowPathObject.
+ * @return New TestFlowPathObject
+ */
+ public TestFlowPath createNewFlowPathForTest() {
+ TestFlowPath path = new TestFlowPath();
+ paths.add(path);
+ return path;
+ }
+
+ /**
+ * Create new empty TestFlowEntryObject.
+ * @return New TestFlowEntryObject
+ */
+ public TestFlowEntry createNewFlowEntryForTest() {
+ TestFlowEntry entry = new TestFlowEntry();
+ entries.add(entry);
+ return entry;
+ }
+
+
+ public boolean hasLinkBetween(String srcSw_str, Short srcNumber, String dstSw_str, Short dstNumber) {
+ IPortObject srcPort = null, dstPort = null;
+ long srcSw = HexString.toLong(srcSw_str);
+ long dstSw = HexString.toLong(dstSw_str);
+
+ for(TestSwitchObject sw : switches) {
+ long swLong = HexString.toLong(sw.getDPID());
+ if(swLong == srcSw) {
+ for(IPortObject port : sw.getPorts()) {
+ if(port.getNumber().equals(srcNumber)) {
+ srcPort = port;
+ }
+ }
+ } else if(swLong == dstSw) {
+ for(IPortObject port : sw.getPorts()) {
+ if(port.getNumber().equals(dstNumber)) {
+ dstPort = port;
+ }
+ }
+ }
+ }
+
+ if(srcPort != null && dstPort != null) {
+ for(IPortObject port : srcPort.getLinkedPorts()) {
+ if(port.equals(dstPort)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ // Overriding methods below are to mock GraphDBOperation class.
+ @Override
+ public ISwitchObject newSwitch(String dpid) {
+ TestSwitchObject sw = new TestSwitchObject();
+ sw.setDPID(dpid);
+ switchesToAdd.add(sw);
+
+ return sw;
+ }
+
+ @Override
+ public ISwitchObject searchSwitch(String dpid_str) {
+ Long dpid = HexString.toLong(dpid_str);
+
+ for(ISwitchObject sw : switches) {
+ if(HexString.toLong(sw.getDPID()) == dpid) {
+ return sw;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ISwitchObject searchActiveSwitch(String dpid_str) {
+ Long dpid = HexString.toLong(dpid_str);
+
+ for(ISwitchObject sw : switches) {
+ if(HexString.toLong(sw.getDPID()) == dpid && sw.getState().equals("ACTIVE")) {
+ return sw;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Iterable<ISwitchObject> getActiveSwitches() {
+ List<ISwitchObject> list = new ArrayList<ISwitchObject>();
+
+ for(ISwitchObject sw : switches) {
+ if(sw.getState() != null && sw.getState().equals("ACTIVE")) {
+ list.add(sw);
+ }
+ }
+ return list.isEmpty() ? null : list;
+ }
+
+ @Override
+ public Iterable<ISwitchObject> getAllSwitches() {
+ List<ISwitchObject> list = new ArrayList<ISwitchObject>();
+
+ for(ISwitchObject sw : switches) {
+ list.add(sw);
+ }
+
+ return list.isEmpty() ? null : list;
+ }
+
+ @Override
+ public Iterable<ISwitchObject> getInactiveSwitches() {
+ List<ISwitchObject> list = new ArrayList<ISwitchObject>();
+
+ for(ISwitchObject sw : switches) {
+ if(! sw.getState().equals("ACTIVE")) {
+ list.add(sw);
+ }
+ }
+ return list.isEmpty() ? null : list;
+ }
+
+ @Override
+ public Iterable<IFlowEntry> getAllSwitchNotUpdatedFlowEntries() {
+ List<IFlowEntry> list = new ArrayList<IFlowEntry>();
+
+ for(TestFlowEntry entry : entries) {
+ if(entry.getSwitchState().equals("FE_SWITCH_NOT_UPDATED")) {
+ list.add(entry);
+ }
+ }
+ return list;
+ }
+
+ @Override
+ public void removeSwitch(ISwitchObject sw) {
+ if(switches.contains(sw)) {
+ switchesToRemove.add((TestSwitchObject)sw);
+ }
+ }
+
+ @Override
+ public IPortObject newPort(Short portNumber) {
+ TestPortObject port = new TestPortObject();
+ port.setNumber(portNumber);
+
+ return port;
+ }
+
+ public IPortObject newPort(Long dpid, Short portNumber) {
+ TestPortObject port = null;
+ TestSwitchObject sw = (TestSwitchObject)searchSwitch(HexString.toHexString(dpid));
+
+ if(sw != null) {
+ port = (TestPortObject)newPort(portNumber);
+ portsToAdd.add(port);
+ sw.addPort(port);
+ }
+
+ return port;
+ }
+
+ @Override
+ public IPortObject searchPort(String dpid_str, short number) {
+ long dpid = HexString.toLong(dpid_str);
+
+ for(TestSwitchObject sw : switches) {
+ if(HexString.toLong(sw.getDPID()) == dpid) {
+ for(IPortObject port : sw.getPorts()) {
+ if(port.getNumber().equals(number)) {
+ return port;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void removePort(IPortObject port) {
+ for(TestSwitchObject sw : switches) {
+ for(IPortObject pt : sw.getPorts()) {
+ if(pt.equals(port)) {
+ sw.removePort(port);
+ }
+ }
+ }
+ portsToRemove.add((TestPortObject)port);
+ }
+
+ @Override
+ public IDeviceObject newDevice() {
+ TestDeviceObject dev = new TestDeviceObject();
+ devicesToAdd.add(dev);
+
+ return dev;
+ }
+
+ @Override
+ public IDeviceObject searchDevice(String macAddr) {
+ for(IDeviceObject dev : devices) {
+ if(dev.getMACAddress().equals(macAddr)) {
+ return dev;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Iterable<IDeviceObject> getDevices() {
+ List<IDeviceObject> list = new ArrayList<IDeviceObject>();
+
+ for(TestDeviceObject dev : devices) {
+ list.add(dev);
+ }
+
+ return list;
+ }
+
+ @Override
+ public void removeDevice(IDeviceObject dev) {
+ if(devices.contains((TestDeviceObject)dev)) {
+ devicesToRemove.add((TestDeviceObject)dev);
+ }
+ }
+
+ @Override
+ public IFlowPath newFlowPath() {
+ TestFlowPath path = new TestFlowPath();
+ pathsToAdd.add(path);
+
+ return path;
+ }
+
+ @Override
+ public IFlowPath searchFlowPath(FlowId flowId) {
+ for(IFlowPath path : paths) {
+ if(path.getFlowId().equals(flowId)) {
+ return path;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IFlowPath getFlowPathByFlowEntry(IFlowEntry flowEntry) {
+ for(IFlowPath path : paths) {
+ for(IFlowEntry entry : path.getFlowEntries()) {
+ if(entry.equals(flowEntry)) {
+ return path;
+ }
+ }
+
+ }
+ return null;
+ }
+
+ @Override
+ public Iterable<IFlowPath> getAllFlowPaths() {
+ List<IFlowPath> list = new ArrayList<IFlowPath>();
+
+ for(IFlowPath path : paths) {
+ list.add(path);
+ }
+
+ return list;
+ }
+
+ @Override
+ public void removeFlowPath(IFlowPath flowPath) {
+ if(paths.contains((TestFlowPath)flowPath)) {
+ pathsToRemove.add((TestFlowPath)flowPath);
+ }
+ }
+
+ @Override
+ public IFlowEntry newFlowEntry() {
+ TestFlowEntry entry = new TestFlowEntry();
+ entriesToAdd.add(entry);
+ return entry;
+ }
+
+ @Override
+ public IFlowEntry searchFlowEntry(FlowEntryId flowEntryId) {
+ for(TestFlowEntry entry : entries) {
+ // TODO check if this matching works
+ if(entry.getFlowEntryId().equals(flowEntryId)) {
+ return entry;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Iterable<IFlowEntry> getAllFlowEntries() {
+ List<IFlowEntry> list = new ArrayList<IFlowEntry>();
+
+ for(TestFlowEntry entry : entries) {
+ list.add(entry);
+ }
+
+ return list;
+ }
+
+ @Override
+ public void removeFlowEntry(IFlowEntry flowEntry) {
+ if(entries.contains((TestFlowEntry)flowEntry)) {
+ entriesToRemove.add((TestFlowEntry)flowEntry);
+ }
+ }
+
+ @Override
+ public IDBConnection getDBConnection() {
+ return super.getDBConnection();
+ }
+
+ @Override
+ public void commit() {
+ for(TestSwitchObject sw : switchesToAdd) {
+ switches.add(sw);
+ }
+ for(TestSwitchObject sw : switchesToRemove) {
+ sw.commit();
+ switches.remove(sw);
+ }
+ for(TestSwitchObject sw : switches) {
+ sw.commit();
+ }
+
+ for(TestPortObject port : portsToAdd) {
+ ports.add(port);
+ }
+ for(TestPortObject port : portsToRemove) {
+ port.commit();
+ ports.remove(port);
+ }
+ for(TestPortObject port : ports) {
+ port.commit();
+ }
+
+ for(TestDeviceObject dev : devicesToAdd) {
+ devices.add(dev);
+ }
+ for(TestDeviceObject dev : devicesToRemove) {
+ dev.commit();
+ devices.remove(dev);
+ }
+ for(TestDeviceObject dev : devices) {
+ dev.commit();
+ }
+
+ clearUncommitedData();
+ }
+
+ @Override
+ public void rollback() {
+ clearUncommitedData();
+ }
+
+ @Override
+ public void close() {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java
new file mode 100644
index 0000000..2f90d48
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableLinkStorageImpl.java
@@ -0,0 +1,41 @@
+package net.onrc.onos.ofcontroller.core.internal;
+
+import java.util.Set;
+
+import net.onrc.onos.ofcontroller.core.internal.LinkStorageImpl;
+
+import com.thinkaurelius.titan.core.TitanGraph;
+import com.tinkerpop.blueprints.TransactionalGraph.Conclusion;
+import com.tinkerpop.blueprints.Vertex;
+
+/**
+ * Seam that allows me to set up a testable instance of LinkStorageImpl that
+ * writes to a file database rather than a Cassandra cluster.
+ * It seems the init() API on LinkStorageImpl might change so I won't rely
+ * on it yet.
+ *
+ * @author jono
+ *
+ */
+
+public class TestableLinkStorageImpl extends LinkStorageImpl {
+ protected TitanGraph graph;
+
+ public TestableLinkStorageImpl(TitanGraph graph){
+ this.graph = graph;
+ }
+
+ @Override
+ public void init(String conf){
+ Set<String> s = graph.getIndexedKeys(Vertex.class);
+ if (!s.contains("dpid")) {
+ graph.createKeyIndex("dpid", Vertex.class);
+ graph.stopTransaction(Conclusion.SUCCESS);
+ }
+ if (!s.contains("type")) {
+ graph.createKeyIndex("type", Vertex.class);
+ graph.stopTransaction(Conclusion.SUCCESS);
+ }
+
+ }
+}
diff --git a/src/test/java/net/floodlightcontroller/core/internal/TestableSwitchStorageImpl.java b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableSwitchStorageImpl.java
similarity index 93%
rename from src/test/java/net/floodlightcontroller/core/internal/TestableSwitchStorageImpl.java
rename to src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableSwitchStorageImpl.java
index a73b90f..e78a1b6 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/TestableSwitchStorageImpl.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/core/internal/TestableSwitchStorageImpl.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.core.internal;
+package net.onrc.onos.ofcontroller.core.internal;
import java.util.Set;
diff --git a/src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
new file mode 100644
index 0000000..b780c2b
--- /dev/null
+++ b/src/test/java/net/onrc/onos/ofcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java
@@ -0,0 +1,440 @@
+/**
+* Copyright 2011, Big Switch Networks, Inc.
+* Originally created by David Erickson, Stanford University
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may
+* not use this file except in compliance with the License. You may obtain
+* a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations
+* under the License.
+**/
+
+package net.onrc.onos.ofcontroller.linkdiscovery.internal;
+
+import static org.easymock.EasyMock.*;
+
+import java.util.Collections;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.floodlightcontroller.core.IFloodlightProviderService;
+import net.floodlightcontroller.core.IFloodlightProviderService.Role;
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.test.MockThreadPoolService;
+import net.floodlightcontroller.restserver.IRestApiService;
+import net.floodlightcontroller.restserver.RestApiServer;
+import net.floodlightcontroller.routing.IRoutingService;
+import net.floodlightcontroller.routing.Link;
+import net.floodlightcontroller.storage.IStorageSourceService;
+import net.floodlightcontroller.storage.memory.MemoryStorageSource;
+import net.floodlightcontroller.test.FloodlightTestCase;
+import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.floodlightcontroller.topology.ITopologyService;
+import net.floodlightcontroller.topology.NodePortTuple;
+import net.floodlightcontroller.topology.TopologyManager;
+import net.onrc.onos.registry.controller.IControllerRegistryService;
+import net.onrc.onos.registry.controller.StandaloneRegistry;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryListener;
+import net.onrc.onos.ofcontroller.linkdiscovery.ILinkDiscoveryService;
+import net.onrc.onos.ofcontroller.linkdiscovery.LinkInfo;
+import net.onrc.onos.ofcontroller.linkdiscovery.internal.LinkDiscoveryManager;
+
+/**
+ *
+ * @author David Erickson (daviderickson@cs.stanford.edu)
+ */
+public class LinkDiscoveryManagerTest extends FloodlightTestCase {
+
+ private TestLinkDiscoveryManager ldm;
+ private StandaloneRegistry srs;
+ protected static Logger log = LoggerFactory.getLogger(LinkDiscoveryManagerTest.class);
+
+ public class TestLinkDiscoveryManager extends LinkDiscoveryManager {
+ public boolean isSendLLDPsCalled = false;
+ public boolean isClearLinksCalled = false;
+
+ @Override
+ protected void discoverOnAllPorts() {
+ isSendLLDPsCalled = true;
+ super.discoverOnAllPorts();
+ }
+
+ public void reset() {
+ isSendLLDPsCalled = false;
+ isClearLinksCalled = false;
+ }
+
+ @Override
+ protected void clearAllLinks() {
+ isClearLinksCalled = true;
+ super.clearAllLinks();
+ }
+ }
+
+ public LinkDiscoveryManager getTopology() {
+ return ldm;
+ }
+
+ public IOFSwitch createMockSwitch(Long id) {
+ IOFSwitch mockSwitch = createNiceMock(IOFSwitch.class);
+ expect(mockSwitch.getId()).andReturn(id).anyTimes();
+ return mockSwitch;
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ FloodlightModuleContext cntx = new FloodlightModuleContext();
+ ldm = new TestLinkDiscoveryManager();
+ TopologyManager routingEngine = new TopologyManager();
+ ldm.linkDiscoveryAware = new ArrayList<ILinkDiscoveryListener>();
+ srs = new StandaloneRegistry();
+ MockThreadPoolService tp = new MockThreadPoolService();
+ RestApiServer restApi = new RestApiServer();
+ cntx.addService(IRestApiService.class, restApi);
+ cntx.addService(IThreadPoolService.class, tp);
+ cntx.addService(IRoutingService.class, routingEngine);
+ cntx.addService(ILinkDiscoveryService.class, ldm);
+ cntx.addService(ITopologyService.class, ldm);
+ cntx.addService(IStorageSourceService.class, new MemoryStorageSource());
+ cntx.addService(IFloodlightProviderService.class, getMockFloodlightProvider());
+ cntx.addService(IControllerRegistryService.class, srs);
+
+ restApi.init(cntx);
+ tp.init(cntx);
+ routingEngine.init(cntx);
+ srs.init(cntx);
+ ldm.init(cntx);
+ restApi.startUp(cntx);
+ tp.startUp(cntx);
+ routingEngine.startUp(cntx);
+ srs.startUp(cntx);
+ ldm.startUp(cntx);
+
+ IOFSwitch sw1 = createMockSwitch(1L);
+ IOFSwitch sw2 = createMockSwitch(2L);
+ Map<Long, IOFSwitch> switches = new HashMap<Long, IOFSwitch>();
+ switches.put(1L, sw1);
+ switches.put(2L, sw2);
+ getMockFloodlightProvider().setSwitches(switches);
+ replay(sw1, sw2);
+ }
+
+ @Test
+ public void testAddOrUpdateLink() throws Exception {
+ LinkDiscoveryManager topology = getTopology();
+
+ Link lt = new Link(1L, 2, 2L, 1);
+ LinkInfo info = new LinkInfo(System.currentTimeMillis(),
+ System.currentTimeMillis(), null,
+ 0, 0);
+ topology.addOrUpdateLink(lt, info);
+
+
+ NodePortTuple srcNpt = new NodePortTuple(1L, 2);
+ NodePortTuple dstNpt = new NodePortTuple(2L, 1);
+
+ // check invariants hold
+ assertNotNull(topology.switchLinks.get(lt.getSrc()));
+ assertTrue(topology.switchLinks.get(lt.getSrc()).contains(lt));
+ assertNotNull(topology.portLinks.get(srcNpt));
+ assertTrue(topology.portLinks.get(srcNpt).contains(lt));
+ assertNotNull(topology.portLinks.get(dstNpt));
+ assertTrue(topology.portLinks.get(dstNpt).contains(lt));
+ assertTrue(topology.links.containsKey(lt));
+ }
+
+ @Test
+ public void testDeleteLink() throws Exception {
+ LinkDiscoveryManager topology = getTopology();
+
+ Link lt = new Link(1L, 2, 2L, 1);
+ LinkInfo info = new LinkInfo(System.currentTimeMillis(),
+ System.currentTimeMillis(), null,
+ 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ topology.deleteLinks(Collections.singletonList(lt), "Test");
+
+ // check invariants hold
+ assertNull(topology.switchLinks.get(lt.getSrc()));
+ assertNull(topology.switchLinks.get(lt.getDst()));
+ assertNull(topology.portLinks.get(lt.getSrc()));
+ assertNull(topology.portLinks.get(lt.getDst()));
+ assertTrue(topology.links.isEmpty());
+ }
+
+ @Test
+ public void testAddOrUpdateLinkToSelf() throws Exception {
+ LinkDiscoveryManager topology = getTopology();
+
+ Link lt = new Link(1L, 2, 2L, 3);
+ NodePortTuple srcNpt = new NodePortTuple(1L, 2);
+ NodePortTuple dstNpt = new NodePortTuple(2L, 3);
+
+ LinkInfo info = new LinkInfo(System.currentTimeMillis(),
+ System.currentTimeMillis(), null,
+ 0, 0);
+ topology.addOrUpdateLink(lt, info);
+
+ // check invariants hold
+ assertNotNull(topology.switchLinks.get(lt.getSrc()));
+ assertTrue(topology.switchLinks.get(lt.getSrc()).contains(lt));
+ assertNotNull(topology.portLinks.get(srcNpt));
+ assertTrue(topology.portLinks.get(srcNpt).contains(lt));
+ assertNotNull(topology.portLinks.get(dstNpt));
+ assertTrue(topology.portLinks.get(dstNpt).contains(lt));
+ assertTrue(topology.links.containsKey(lt));
+ }
+
+ @Test
+ public void testDeleteLinkToSelf() throws Exception {
+ LinkDiscoveryManager topology = getTopology();
+
+ Link lt = new Link(1L, 2, 1L, 3);
+ NodePortTuple srcNpt = new NodePortTuple(1L, 2);
+ NodePortTuple dstNpt = new NodePortTuple(2L, 3);
+
+ LinkInfo info = new LinkInfo(System.currentTimeMillis(),
+ System.currentTimeMillis(), null,
+ 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ topology.deleteLinks(Collections.singletonList(lt), "Test to self");
+
+ // check invariants hold
+ assertNull(topology.switchLinks.get(lt.getSrc()));
+ assertNull(topology.switchLinks.get(lt.getDst()));
+ assertNull(topology.portLinks.get(srcNpt));
+ assertNull(topology.portLinks.get(dstNpt));
+ assertTrue(topology.links.isEmpty());
+ }
+
+ @Test
+ public void testRemovedSwitch() {
+ LinkDiscoveryManager topology = getTopology();
+
+ Link lt = new Link(1L, 2, 2L, 1);
+ NodePortTuple srcNpt = new NodePortTuple(1L, 2);
+ NodePortTuple dstNpt = new NodePortTuple(2L, 1);
+ LinkInfo info = new LinkInfo(System.currentTimeMillis(),
+ System.currentTimeMillis(), null,
+ 0, 0);
+ topology.addOrUpdateLink(lt, info);
+
+ IOFSwitch sw1 = getMockFloodlightProvider().getSwitches().get(1L);
+ IOFSwitch sw2 = getMockFloodlightProvider().getSwitches().get(2L);
+ // Mock up our expected behavior
+ topology.removedSwitch(sw1);
+ verify(sw1, sw2);
+
+ // check invariants hold
+ assertNull(topology.switchLinks.get(lt.getSrc()));
+ assertNull(topology.switchLinks.get(lt.getDst()));
+ assertNull(topology.portLinks.get(srcNpt));
+ assertNull(topology.portLinks.get(dstNpt));
+ assertTrue(topology.links.isEmpty());
+ }
+
+ @Test
+ public void testRemovedSwitchSelf() {
+ LinkDiscoveryManager topology = getTopology();
+ IOFSwitch sw1 = createMockSwitch(1L);
+ replay(sw1);
+ Link lt = new Link(1L, 2, 1L, 3);
+ LinkInfo info = new LinkInfo(System.currentTimeMillis(),
+ System.currentTimeMillis(), null,
+ 0, 0);
+ topology.addOrUpdateLink(lt, info);
+
+ // Mock up our expected behavior
+ topology.removedSwitch(sw1);
+
+ verify(sw1);
+ // check invariants hold
+ assertNull(topology.switchLinks.get(lt.getSrc()));
+ assertNull(topology.portLinks.get(lt.getSrc()));
+ assertNull(topology.portLinks.get(lt.getDst()));
+ assertTrue(topology.links.isEmpty());
+ }
+
+ @Test
+ public void testAddUpdateLinks() throws Exception {
+ LinkDiscoveryManager topology = getTopology();
+
+ Link lt = new Link(1L, 1, 2L, 1);
+ NodePortTuple srcNpt = new NodePortTuple(1L, 1);
+ NodePortTuple dstNpt = new NodePortTuple(2L, 1);
+
+ LinkInfo info;
+
+ info = new LinkInfo(System.currentTimeMillis() - 40000,
+ System.currentTimeMillis() - 40000, null,
+ 0, 0);
+ topology.addOrUpdateLink(lt, info);
+
+ // check invariants hold
+ assertNotNull(topology.switchLinks.get(lt.getSrc()));
+ assertTrue(topology.switchLinks.get(lt.getSrc()).contains(lt));
+ assertNotNull(topology.portLinks.get(srcNpt));
+ assertTrue(topology.portLinks.get(srcNpt).contains(lt));
+ assertNotNull(topology.portLinks.get(dstNpt));
+ assertTrue(topology.portLinks.get(dstNpt).contains(lt));
+ assertTrue(topology.links.containsKey(lt));
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt) == null ||
+ topology.portBroadcastDomainLinks.get(srcNpt).contains(lt) == false);
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt) == null ||
+ topology.portBroadcastDomainLinks.get(dstNpt).contains(lt) == false);
+
+ topology.timeoutLinks();
+
+
+ info = new LinkInfo(System.currentTimeMillis(),/* firstseen */
+ null,/* unicast */
+ System.currentTimeMillis(), 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ assertTrue(topology.links.get(lt).getUnicastValidTime() == null);
+ assertTrue(topology.links.get(lt).getMulticastValidTime() != null);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
+
+
+ // Add a link info based on info that woudld be obtained from unicast LLDP
+ // Setting the unicast LLDP reception time to be 40 seconds old, so we can use
+ // this to test timeout after this test. Although the info is initialized
+ // with LT_OPENFLOW_LINK, the link property should be changed to LT_NON_OPENFLOW
+ // by the addOrUpdateLink method.
+ info = new LinkInfo(System.currentTimeMillis() - 40000,
+ System.currentTimeMillis() - 40000, null, 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt) == null ||
+ topology.portBroadcastDomainLinks.get(srcNpt).contains(lt) == false);
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt) == null ||
+ topology.portBroadcastDomainLinks.get(dstNpt).contains(lt) == false);
+
+ // Expect to timeout the unicast Valid Time, but not the multicast Valid time
+ // So the link type should go back to non-openflow link.
+ topology.timeoutLinks();
+ assertTrue(topology.links.get(lt).getUnicastValidTime() == null);
+ assertTrue(topology.links.get(lt).getMulticastValidTime() != null);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
+
+ // Set the multicastValidTime to be old and see if that also times out.
+ info = new LinkInfo(System.currentTimeMillis() - 40000,
+ null, System.currentTimeMillis() - 40000, 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ topology.timeoutLinks();
+ assertTrue(topology.links.get(lt) == null);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt) == null ||
+ topology.portBroadcastDomainLinks.get(srcNpt).contains(lt) == false);
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt) == null ||
+ topology.portBroadcastDomainLinks.get(dstNpt).contains(lt) == false);
+
+
+ // Test again only with multicast LLDP
+ info = new LinkInfo(System.currentTimeMillis() - 40000,
+ null, System.currentTimeMillis() - 40000, 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ assertTrue(topology.links.get(lt).getUnicastValidTime() == null);
+ assertTrue(topology.links.get(lt).getMulticastValidTime() != null);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
+
+ // Call timeout and check if link is no longer present.
+ topology.timeoutLinks();
+ assertTrue(topology.links.get(lt) == null);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt) == null ||
+ topology.portBroadcastDomainLinks.get(srcNpt).contains(lt) == false);
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt) == null ||
+ topology.portBroadcastDomainLinks.get(dstNpt).contains(lt) == false);
+
+ // Start clean and see if loops are also added.
+ lt = new Link(1L, 1, 1L, 2);
+ srcNpt = new NodePortTuple(1L, 1);
+ dstNpt = new NodePortTuple(1L, 2);
+ info = new LinkInfo(System.currentTimeMillis() - 40000,
+ null, System.currentTimeMillis() - 40000, 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
+
+
+ // Start clean and see if loops are also added.
+ lt = new Link(1L, 1, 1L, 3);
+ srcNpt = new NodePortTuple(1L, 1);
+ dstNpt = new NodePortTuple(1L, 3);
+ info = new LinkInfo(System.currentTimeMillis() - 40000,
+ null, System.currentTimeMillis() - 40000, 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
+
+
+ // Start clean and see if loops are also added.
+ lt = new Link(1L, 4, 1L, 5);
+ srcNpt = new NodePortTuple(1L, 4);
+ dstNpt = new NodePortTuple(1L, 5);
+ info = new LinkInfo(System.currentTimeMillis() - 40000,
+ null, System.currentTimeMillis() - 40000, 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
+
+
+ // Start clean and see if loops are also added.
+ lt = new Link(1L, 3, 1L, 5);
+ srcNpt = new NodePortTuple(1L, 3);
+ dstNpt = new NodePortTuple(1L, 5);
+ info = new LinkInfo(System.currentTimeMillis() - 40000,
+ null, System.currentTimeMillis() - 40000, 0, 0);
+ topology.addOrUpdateLink(lt, info);
+ assertTrue(topology.portBroadcastDomainLinks.get(srcNpt).contains(lt));
+ assertTrue(topology.portBroadcastDomainLinks.get(dstNpt).contains(lt));
+ }
+
+ @Test
+ public void testHARoleChange() throws Exception {
+ LinkDiscoveryManager topology = getTopology();
+ IOFSwitch sw1 = createMockSwitch(1L);
+ IOFSwitch sw2 = createMockSwitch(2L);
+ replay(sw1, sw2);
+ Link lt = new Link(1L, 2, 2L, 1);
+ NodePortTuple srcNpt = new NodePortTuple(1L, 2);
+ NodePortTuple dstNpt = new NodePortTuple(2L, 1);
+ LinkInfo info = new LinkInfo(System.currentTimeMillis(),
+ System.currentTimeMillis(), null,
+ 0, 0);
+ topology.addOrUpdateLink(lt, info);
+
+ // check invariants hold
+ assertNotNull(topology.switchLinks.get(lt.getSrc()));
+ assertTrue(topology.switchLinks.get(lt.getSrc()).contains(lt));
+ assertNotNull(topology.portLinks.get(srcNpt));
+ assertTrue(topology.portLinks.get(srcNpt).contains(lt));
+ assertNotNull(topology.portLinks.get(dstNpt));
+ assertTrue(topology.portLinks.get(dstNpt).contains(lt));
+ assertTrue(topology.links.containsKey(lt));
+
+ // check that it clears from memory
+ getMockFloodlightProvider().dispatchRoleChanged(null, Role.SLAVE);
+ assertTrue(topology.switchLinks.isEmpty());
+ getMockFloodlightProvider().dispatchRoleChanged(Role.SLAVE, Role.MASTER);
+ // check that lldps were sent
+ assertTrue(ldm.isSendLLDPsCalled);
+ assertTrue(ldm.isClearLinksCalled);
+ ldm.reset();
+ }
+}
diff --git a/src/test/java/net/onrc/onos/util/GraphDBOperationTest.java b/src/test/java/net/onrc/onos/util/GraphDBOperationTest.java
index 4bfcf14..294c043 100644
--- a/src/test/java/net/onrc/onos/util/GraphDBOperationTest.java
+++ b/src/test/java/net/onrc/onos/util/GraphDBOperationTest.java
@@ -15,9 +15,9 @@
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState;
+import net.onrc.onos.ofcontroller.core.internal.TestDatabaseManager;
import net.onrc.onos.ofcontroller.util.FlowEntryId;
import net.onrc.onos.ofcontroller.util.FlowId;
-import net.floodlightcontroller.core.internal.TestDatabaseManager;
import org.easymock.EasyMock;
import org.junit.After;
diff --git a/start-onos-embedded.sh b/start-onos-embedded.sh
index 2f1584e..b71d4d9 100755
--- a/start-onos-embedded.sh
+++ b/start-onos-embedded.sh
@@ -26,7 +26,7 @@
# Set classpath to include titan libs
#CLASSPATH=`echo ${FL_HOME}/lib/*.jar ${FL_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
CLASSPATH="${FL_ONLY_JAR}:${FL_HOME}/lib/*:${FL_HOME}/lib/titan/*"
-MAIN_CLASS="net.floodlightcontroller.core.Main"
+MAIN_CLASS="net.onrc.onos.ofcontroller.core.Main"
#<logger name="net.floodlightcontroller.linkdiscovery.internal" level="TRACE"/>
#<appender-ref ref="STDOUT" />
diff --git a/start-onos.sh b/start-onos.sh
index 0a59701..d4ea834 100755
--- a/start-onos.sh
+++ b/start-onos.sh
@@ -22,7 +22,7 @@
# Set classpath to include titan libs
#CLASSPATH=`echo ${FL_HOME}/lib/*.jar ${FL_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
CLASSPATH="${FL_ONLY_JAR}:${FL_HOME}/lib/*:${FL_HOME}/lib/titan/*"
-MAIN_CLASS="net.floodlightcontroller.core.Main"
+MAIN_CLASS="net.onrc.onos.ofcontroller.core.Main"
#<logger name="net.floodlightcontroller.linkdiscovery.internal" level="TRACE"/>
#<appender-ref ref="STDOUT" />