diff --git a/build.xml b/build.xml index 5883e9af0e5334244223421c47062ffb2f900338..58f4b71df0c067390cb53bc34c346cc70b3e432a 100644 --- a/build.xml +++ b/build.xml @@ -19,15 +19,15 @@ limitations under the License. --> - <project default="dist" name="Floodlight"> - <property name="target" location="target"/> <property name="build" location="${target}/bin"/> <property name="build-test" location="${target}/bin-test"/> + <property name="build-coverage" location="${target}/bin-coverage"/> <property name="test-output" location="${target}/test"/> + <property name="coverage-output" location="${target}/coverage"/> <property name="source" location="src/main/java"/> - <property name="resources" location="src/main/resources/"/> + <property name="resources" location="src/main/resources/"/> <property name="source-test" location="src/test/java"/> <property name="python-src" location="src/main/python"/> <property name="docs" location="${target}/docs"/> @@ -69,6 +69,19 @@ </fileset> </path> + <patternset id="lib-cobertura"> + <include name="cobertura-1.9.4.1.jar"/> + <include name="asm-3.0.jar"/> + <include name="asm-tree-3.0.jar"/> + <include name="oro/jakarta-oro-2.0.8.jar"/> + <include name="log4j-1.2.9.jar"/> + </patternset> + <path id="classpath-cobertura"> + <fileset dir="lib"> + <patternset refid="lib-cobertura"/> + </fileset> + </path> + <patternset id="lib-test"> <include name="junit-4.8.2.jar"/> <include name="org.easymock_2.5.2.jar"/> @@ -76,6 +89,7 @@ <path id="classpath-test"> <fileset dir="lib"> <patternset refid="lib-test"/> + <patternset refid="lib-cobertura"/> <patternset refid="lib"/> </fileset> <fileset dir="${target}/lib"> @@ -138,8 +152,13 @@ <target name="tests" depends="test"/> <target name="test" depends="compile-test"> - <junit failureproperty="junit.failure" printsummary="on"> + <junit fork="true" forkmode="once" + failureproperty="junit.failure" + printsummary="on"> + <sysproperty key="net.sourceforge.cobertura.datafile" + file="${target}/cobertura.ser" /> <classpath> + <pathelement location="${build-coverage}"/> <pathelement location="${build}"/> <pathelement location="${build-test}"/> <path refid="classpath-test"/> @@ -155,7 +174,33 @@ <fail if="junit.failure" message="Unit test(s) failed. See reports!"/> </target> - <target name="dist" depends="compile,compile-tests"> + <taskdef classpathref="classpath-cobertura" resource="tasks.properties"/> + <target name="clean-instrument"> + <delete file="${target}/cobertura.ser"/> + <delete dir="${build-coverage}"/> + </target> + <target name="instrument" depends="compile,compile-test,clean-instrument"> + <cobertura-instrument datafile="${target}/cobertura.ser" + todir="${build-coverage}" + classpathref="classpath-cobertura"> + <fileset dir="${build}"> + <include name="**/*.class"/> + </fileset> + </cobertura-instrument> + </target> + <target name="coverage-report"> + <cobertura-report format="html" + datafile="${target}/cobertura.ser" + destdir="${coverage-output}" + srcdir="${source}"/> + <cobertura-report format="xml" + datafile="${target}/cobertura.ser" + destdir="${coverage-output}" + srcdir="${source}"/> + </target> + <target name="coverage" depends="instrument,test,coverage-report"/> + + <target name="dist" depends="compile,compile-test"> <jar destfile="${floodlight-jar}" filesetmanifest="mergewithoutmain"> <manifest> <attribute name="Main-Class" value="${main-class}"/> @@ -181,6 +226,7 @@ <fileset dir="${resources}"/> <zipgroupfileset dir="lib"> <patternset refid="lib-test"/> + <patternset refid="lib-cobertura"/> </zipgroupfileset> <zipgroupfileset dir="${target}/lib"> <patternset refid="genlib"/> diff --git a/lib/asm-3.0.jar b/lib/asm-3.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..112f5bd4aecd5f9b7b3540f2c1a2a67b552e1d8b Binary files /dev/null and b/lib/asm-3.0.jar differ diff --git a/lib/asm-tree-3.0.jar b/lib/asm-tree-3.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..2a4b20856c0cff5a70575665d4583ef5ace0eed6 Binary files /dev/null and b/lib/asm-tree-3.0.jar differ diff --git a/lib/cobertura-1.9.4.1.jar b/lib/cobertura-1.9.4.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..b7332491cdac15e27f1dab3fe22bc6b811f089f1 Binary files /dev/null and b/lib/cobertura-1.9.4.1.jar differ diff --git a/lib/log4j-1.2.9.jar b/lib/log4j-1.2.9.jar new file mode 100644 index 0000000000000000000000000000000000000000..a6568b01a2179f5b20473a1dcee4c67da062b327 Binary files /dev/null and b/lib/log4j-1.2.9.jar differ diff --git a/lib/oro/jakarta-oro-2.0.8.jar b/lib/oro/jakarta-oro-2.0.8.jar new file mode 100644 index 0000000000000000000000000000000000000000..23488d2600f5f4784c0ba2be5baa4c41f396f616 Binary files /dev/null and b/lib/oro/jakarta-oro-2.0.8.jar differ diff --git a/lib/packetstreamer-thrift.jar b/lib/packetstreamer-thrift.jar new file mode 100644 index 0000000000000000000000000000000000000000..215dffc10525f03560141531e16414ea47a791e3 Binary files /dev/null and b/lib/packetstreamer-thrift.jar differ diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/NodePortTupleJSONSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/NodePortTupleJSONSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..d3b44b95ec2f4588c81071d21a144d5bf0327de0 --- /dev/null +++ b/src/main/java/net/floodlightcontroller/core/web/serializers/NodePortTupleJSONSerializer.java @@ -0,0 +1,29 @@ +package net.floodlightcontroller.core.web.serializers; + +import java.io.IOException; + +import net.floodlightcontroller.topology.NodePortTuple; + +import org.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; +import org.openflow.util.HexString; + +public class NodePortTupleJSONSerializer extends JsonSerializer<NodePortTuple> { + + @Override + public void serialize(NodePortTuple ntp, JsonGenerator jgen, + SerializerProvider sp) throws IOException, + JsonProcessingException { + jgen.writeStartObject(); + jgen.writeStringField("switch", HexString.toHexString(ntp.getNodeId())); + jgen.writeNumberField("port", ntp.getPortId()); + jgen.writeEndObject(); + } + + @Override + public Class<NodePortTuple> handledType() { + return NodePortTuple.class; + } +} diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java index 4e16e28fa6d5eb08656e76bb433b6ee79c4879b0..ed47ecb665f8398581dea41dea6f4de0f9e64917 100755 --- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java +++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java @@ -2161,7 +2161,6 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe // Update the maps with the new device copy devMgrMaps.updateMaps(dCopy, new Date(0)); } - break; } catch (ConcurrentModificationException e) { } catch (NullPointerException e) { } } diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java index e2a1274a43a1a8f9eedb2ac1ace9ebc1d3ef4f39..b1f06633cc409039cb87510b07dcb747d86e71c7 100644 --- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java +++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java @@ -67,7 +67,6 @@ import net.floodlightcontroller.packet.Ethernet; import net.floodlightcontroller.packet.IPv4; import net.floodlightcontroller.packet.LLDP; import net.floodlightcontroller.packet.LLDPTLV; -import net.floodlightcontroller.restserver.IRestApiService; import net.floodlightcontroller.routing.IRoutingService; import net.floodlightcontroller.storage.IResultSet; import net.floodlightcontroller.storage.IStorageSourceService; @@ -75,7 +74,6 @@ import net.floodlightcontroller.storage.IStorageSourceListener; import net.floodlightcontroller.storage.OperatorPredicate; import net.floodlightcontroller.storage.StorageException; import net.floodlightcontroller.threadpool.IThreadPoolService; -import net.floodlightcontroller.topology.web.TopologyWebRoutable; import net.floodlightcontroller.util.EventHistory; import net.floodlightcontroller.util.EventHistory.EvAction; import net.floodlightcontroller.util.StackTraceUtil; @@ -143,7 +141,6 @@ public class LinkDiscoveryManager protected IFloodlightProviderService floodlightProvider; protected IStorageSourceService storageSource; protected IRoutingService routingEngine; - protected IRestApiService restApi; protected IThreadPoolService threadPool; private static final byte[] LLDP_STANDARD_DST_MAC_STRING = @@ -1313,8 +1310,6 @@ public class LinkDiscoveryManager IFloodlightService>(); // We are the class that implements the service m.put(ILinkDiscoveryService.class, this); - //m.put(ITopologyService.class, this); - return m; } @@ -1325,7 +1320,6 @@ public class LinkDiscoveryManager l.add(IFloodlightProviderService.class); l.add(IStorageSourceService.class); l.add(IRoutingService.class); - l.add(IRestApiService.class); l.add(IThreadPoolService.class); return l; } @@ -1336,7 +1330,6 @@ public class LinkDiscoveryManager floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class); storageSource = context.getServiceImpl(IStorageSourceService.class); routingEngine = context.getServiceImpl(IRoutingService.class); - restApi = context.getServiceImpl(IRestApiService.class); threadPool = context.getServiceImpl(IThreadPoolService.class); // We create this here because there is no ordering guarantee @@ -1440,13 +1433,6 @@ public class LinkDiscoveryManager floodlightProvider.addOFSwitchListener(this); floodlightProvider.addHAListener(this); floodlightProvider.addInfoProvider("summary", this); - - // init our rest api - if (restApi != null) { - restApi.addRestletRoutable(new TopologyWebRoutable()); - } else { - log.error("Could not instantiate REST API"); - } setControllerTLV(); } diff --git a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java index 725c0d25ddba98a92bead784f5df7163970ec83e..16b7a30c1ec53a7967407b91e14e4d54859a3782 100644 --- a/src/main/java/net/floodlightcontroller/topology/ITopologyService.java +++ b/src/main/java/net/floodlightcontroller/topology/ITopologyService.java @@ -51,8 +51,24 @@ public interface ITopologyService extends IFloodlightService { */ public boolean inSameIsland(long switch1, long switch2); + /** + * Adds a listener to get topology notifications + * @param listener The module that wants to listen for events + */ public void addListener(ITopologyListener listener); + /** + * Gets the set of ports that belong to a broadcast domain. + * @return The set of ports that belong to a broadcast domain. + */ + public Set<NodePortTuple> getBroadcastDomainLinks(); + + /** + * Returns that set of links that are tunnel links. + * @return The set of links that are tunnel links. + */ + public Set<NodePortTuple> getTunnelLinks(); + public boolean isBroadcastDomainPort(long sw, short port); public boolean isAllowed(long sw, short portId); diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java index 34f1c4667ec50412f77a39f0ba25c7033a43a2f6..eec06aae1e30a2140753d1fe64230a9027708f50 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java @@ -36,15 +36,14 @@ public class TopologyInstance { protected Set<Long> switches; protected Set<NodePortTuple> broadcastDomainPorts; protected Set<NodePortTuple> tunnelPorts; - //protected Set<NodePortTuple> blockedPorts; protected Set<Cluster> clusters; // set of clusters protected Map<Long, Cluster> switchClusterMap; // switch to cluster map // States for routing - protected Map<Long, BroadcastTree> destinationRootedTrees; - protected Map<Long, Set<NodePortTuple>> clusterBroadcastNodePorts; - protected Map<Long, BroadcastTree> clusterBroadcastTrees; + protected Map<Long, BroadcastTree> destinationRootedTrees; // DPID -> BroadcastTree + protected Map<Long, Set<NodePortTuple>> clusterBroadcastNodePorts; // ClusterID -> BroadcastTree + protected Map<Long, BroadcastTree> clusterBroadcastTrees; // ClusterID -> BroadcastTree protected LRUHashMap<RouteId, Route> pathcache; public TopologyInstance() { diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java index 6dd7037d5aebba46ad05dad5603cff132982fdfd..762e19186f6c392c162ab70aaf6a97dca40ad898 100644 --- a/src/main/java/net/floodlightcontroller/topology/TopologyManager.java +++ b/src/main/java/net/floodlightcontroller/topology/TopologyManager.java @@ -21,11 +21,13 @@ import net.floodlightcontroller.core.module.IFloodlightService; import net.floodlightcontroller.core.util.SingletonTask; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryListener; import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService; +import net.floodlightcontroller.restserver.IRestApiService; import net.floodlightcontroller.routing.BroadcastTree; import net.floodlightcontroller.routing.IRoutingService; import net.floodlightcontroller.routing.Link; import net.floodlightcontroller.routing.Route; import net.floodlightcontroller.threadpool.IThreadPoolService; +import net.floodlightcontroller.topology.web.TopologyWebRoutable; import net.floodlightcontroller.util.StackTraceUtil; @@ -54,6 +56,7 @@ public class TopologyManager protected ILinkDiscoveryService linkDiscovery; protected IThreadPoolService threadPool; protected IFloodlightProviderService floodlightProvider; + protected IRestApiService restApi; // Modules that listen to our updates protected ArrayList<ITopologyListener> topologyAware; @@ -261,11 +264,7 @@ public class TopologyManager public Map<NodePortTuple, Set<Link>> getPortBroadcastDomainLinks() { return portBroadcastDomainLinks; } - - public Map<NodePortTuple, Set<Link>> getTunnelLinks() { - return tunnelLinks; - } - + public TopologyInstance getCurrentInstance() { return currentInstance; } @@ -297,7 +296,6 @@ public class TopologyManager @Override public Collection<Class<? extends IFloodlightService>> getModuleServices() { - // TODO Auto-generated method stub Collection<Class<? extends IFloodlightService>> l = new ArrayList<Class<? extends IFloodlightService>>(); l.add(ITopologyService.class); @@ -306,12 +304,10 @@ public class TopologyManager } @Override - public Map<Class<? extends IFloodlightService>, IFloodlightService> - getServiceImpls() { + public Map<Class<? extends IFloodlightService>, IFloodlightService> getServiceImpls() { Map<Class<? extends IFloodlightService>, - IFloodlightService> m = - new HashMap<Class<? extends IFloodlightService>, - IFloodlightService>(); + IFloodlightService> m = + new HashMap<Class<? extends IFloodlightService>, IFloodlightService>(); // We are the class that implements the service m.put(ITopologyService.class, this); m.put(IRoutingService.class, this); @@ -327,6 +323,7 @@ public class TopologyManager l.add(ILinkDiscoveryService.class); l.add(IThreadPoolService.class); l.add(IFloodlightProviderService.class); + l.add(IRestApiService.class); return l; } @@ -336,6 +333,7 @@ public class TopologyManager linkDiscovery = context.getServiceImpl(ILinkDiscoveryService.class); threadPool = context.getServiceImpl(IThreadPoolService.class); floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class); + restApi = context.getServiceImpl(IRestApiService.class); switchPorts = new HashMap<Long,Set<Short>>(); switchPortLinks = new HashMap<NodePortTuple, Set<Link>>(); @@ -351,8 +349,13 @@ public class TopologyManager newInstanceTask = new SingletonTask(ses, new NewInstanceWorker()); linkDiscovery.addListener(this); floodlightProvider.addHAListener(this); + addWebRoutable(); newInstanceTask.reschedule(1, TimeUnit.MILLISECONDS); } + + protected void addWebRoutable() { + restApi.addRestletRoutable(new TopologyWebRoutable()); + } // // ITopologyService interface methods @@ -499,5 +502,15 @@ public class TopologyManager break; } } + + @Override + public Set<NodePortTuple> getBroadcastDomainLinks() { + return portBroadcastDomainLinks.keySet(); + } + + @Override + public Set<NodePortTuple> getTunnelLinks() { + return tunnelLinks.keySet(); + } } diff --git a/src/main/java/net/floodlightcontroller/topology/web/BroadcastDomainResource.java b/src/main/java/net/floodlightcontroller/topology/web/BroadcastDomainResource.java new file mode 100644 index 0000000000000000000000000000000000000000..dc7dd46ebaeeacd88608ad9b93528717ffd6ed77 --- /dev/null +++ b/src/main/java/net/floodlightcontroller/topology/web/BroadcastDomainResource.java @@ -0,0 +1,20 @@ +package net.floodlightcontroller.topology.web; + +import java.util.Set; + +import net.floodlightcontroller.topology.ITopologyService; +import net.floodlightcontroller.topology.NodePortTuple; + +import org.restlet.resource.Get; +import org.restlet.resource.ServerResource; + +public class BroadcastDomainResource extends ServerResource { + @Get("json") + public Set<NodePortTuple> retrieve() { + ITopologyService topology = + (ITopologyService)getContext().getAttributes(). + get(ITopologyService.class.getCanonicalName()); + + return topology.getBroadcastDomainLinks(); + } +} diff --git a/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java b/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java index afe65fc9e5e7279ebbb25de444625567361a3aff..efe180c725dacbfab626c69c380a05be84ae2eae 100644 --- a/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java +++ b/src/main/java/net/floodlightcontroller/topology/web/TopologyWebRoutable.java @@ -1,7 +1,6 @@ package net.floodlightcontroller.topology.web; import org.restlet.Context; -import org.restlet.Restlet; import org.restlet.routing.Router; import net.floodlightcontroller.linkdiscovery.web.LinksResource; @@ -12,10 +11,12 @@ public class TopologyWebRoutable implements RestletRoutable { * Create the Restlet router and bind to the proper resources. */ @Override - public Restlet getRestlet(Context context) { + public Router getRestlet(Context context) { Router router = new Router(context); router.attach("/links/json", LinksResource.class); + router.attach("/tunnellinks/json", TunnelLinksResource.class); router.attach("/switchclusters/json", SwitchClustersResource.class); + router.attach("/broadcastdomainports/json", BroadcastDomainResource.class); return router; } diff --git a/src/main/java/net/floodlightcontroller/topology/web/TunnelLinksResource.java b/src/main/java/net/floodlightcontroller/topology/web/TunnelLinksResource.java new file mode 100644 index 0000000000000000000000000000000000000000..ac7c0e367681910573f22f1c350c30bca679b038 --- /dev/null +++ b/src/main/java/net/floodlightcontroller/topology/web/TunnelLinksResource.java @@ -0,0 +1,20 @@ +package net.floodlightcontroller.topology.web; + +import java.util.Set; + +import net.floodlightcontroller.topology.ITopologyService; +import net.floodlightcontroller.topology.NodePortTuple; + +import org.restlet.resource.Get; +import org.restlet.resource.ServerResource; + +public class TunnelLinksResource extends ServerResource { + @Get("json") + public Set<NodePortTuple> retrieve() { + ITopologyService topology = + (ITopologyService)getContext().getAttributes(). + get(ITopologyService.class.getCanonicalName()); + + return topology.getTunnelLinks(); + } +} diff --git a/src/main/resources/web/js/views/topology.js b/src/main/resources/web/js/views/topology.js index a82098e1802d9f57af92524fcea805ac9c0386f4..60b1a93809853ebef2cf8deeeca8d801c4f3e10d 100644 --- a/src/main/resources/web/js/views/topology.js +++ b/src/main/resources/web/js/views/topology.js @@ -43,7 +43,12 @@ window.TopologyView = Backbone.View.extend({ for (var i = 0; i < this.hosts.length; i++) { host = this.hosts[i]; - host.name = host.attributes['network-addresses'][0]['ip'] + "\n" + host.id; + if (( host.attributes['network-addresses'].length > 0 ) && + ('ip' in host.attributes['network-addresses'][0])) { + host.name = host.attributes['network-addresses'][0]['ip'] + "\n" + host.id; + } else { + host.name = host.id; + } host.group = 2; console.log(host); } diff --git a/src/main/resources/web/tpl/switch-list-item.html b/src/main/resources/web/tpl/switch-list-item.html index 680d50934507900a90dc3a961bf65658fd1835c6..7a20a5a09ad02cb3123d38e4029ddb7c4c0e98c9 100644 --- a/src/main/resources/web/tpl/switch-list-item.html +++ b/src/main/resources/web/tpl/switch-list-item.html @@ -1 +1 @@ - <td><a href="/switch/<%= id %>"><%= id %></a></td><td><%= packetCount %></td><td><%= byteCount %></td><td><%= flowCount %></td> +<td><a href="/switch/<%= id %>"><%= id %></a></td><td><%= manufacturerDescription %><td><%= packetCount %></td><td><%= byteCount %></td><td><%= flowCount %></td> diff --git a/src/main/resources/web/tpl/switch-list.html b/src/main/resources/web/tpl/switch-list.html index 3a23f7e61776a2a9a9d750ceb28a1d2a66b9af98..45c02f55f13b1024d9882bb489cda6cce8f6c8f4 100644 --- a/src/main/resources/web/tpl/switch-list.html +++ b/src/main/resources/web/tpl/switch-list.html @@ -4,7 +4,7 @@ <h1>Switches (<%= nswitches %>)</h1> </div> <table class="table striped-table switch-table"> - <thead><tr><th>DPID</th><th>Packets</th><th>Bytes</th><th>Flows</th></tr></thead> + <thead><tr><th>DPID</th><th>Vendor</th><th>Packets</th><th>Bytes</th><th>Flows</th></tr></thead> <tbody> <!-- switches will be inserted here by SwitchListView:render --> </tbody> diff --git a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java index fec23ee04999d32d44931fc4694bd2aa8bf2c1a3..d24df1962fcd2b5c1461ea8c9f5b3dd486aec8bd 100644 --- a/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java +++ b/src/test/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManagerTest.java @@ -38,6 +38,8 @@ import net.floodlightcontroller.linkdiscovery.ILinkDiscoveryService; import net.floodlightcontroller.linkdiscovery.LinkInfo; import net.floodlightcontroller.linkdiscovery.LinkTuple; import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager; +import net.floodlightcontroller.restserver.IRestApiService; +import net.floodlightcontroller.restserver.RestApiServer; import net.floodlightcontroller.routing.IRoutingService; import net.floodlightcontroller.storage.IStorageSourceService; import net.floodlightcontroller.storage.memory.MemoryStorageSource; @@ -87,15 +89,19 @@ public class LinkDiscoveryManagerTest extends FloodlightTestCase { TopologyManager routingEngine = new TopologyManager(); ldm.linkDiscoveryAware = new ArrayList<ILinkDiscoveryListener>(); 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()); + restApi.init(cntx); tp.init(cntx); routingEngine.init(cntx); ldm.init(cntx); + restApi.startUp(cntx); tp.startUp(cntx); routingEngine.startUp(cntx); ldm.startUp(cntx);