Skip to content
Snippets Groups Projects
Commit f461b219 authored by Alex Reimers's avatar Alex Reimers Committed by Alex Reimers
Browse files

Enhancements to the Topology REST API.

parent c3ec93a0
No related branches found
No related tags found
No related merge requests found
......@@ -87,6 +87,10 @@ public class RestApiServer
// Add everything in the module context to the rest
for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) {
if (logger.isDebugEnabled()) {
logger.debug("Adding {} for service {} into context",
s.getCanonicalName(), fmlContext.getServiceImpl(s));
}
context.getAttributes().put(s.getCanonicalName(),
fmlContext.getServiceImpl(s));
}
......
......@@ -425,11 +425,11 @@ public class TopologyManager implements
// As we might have two topologies, simply get the union of
// both of them and send it.
bp = currentInstance.getBlockedPorts();
bp = getCurrentInstance(true).getBlockedPorts();
if (bp != null)
blockedPorts.addAll(bp);
bp = currentInstanceWithoutTunnels.getBlockedPorts();
bp = getCurrentInstance(false).getBlockedPorts();
if (bp != null)
blockedPorts.addAll(bp);
......@@ -569,7 +569,6 @@ public class TopologyManager implements
m.put(ITopologyService.class, this);
m.put(IRoutingService.class, this);
return m;
}
@Override
......@@ -610,10 +609,14 @@ public class TopologyManager implements
ScheduledExecutorService ses = threadPool.getScheduledExecutor();
newInstanceTask = new SingletonTask(ses, new NewInstanceWorker());
linkDiscovery.addListener(this);
restApi.addRestletRoutable(new TopologyWebRoutable());
newInstanceTask.reschedule(1, TimeUnit.MILLISECONDS);
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
floodlightProvider.addHAListener(this);
addRestletRoutable();
}
protected void addRestletRoutable() {
restApi.addRestletRoutable(new TopologyWebRoutable());
}
// ****************
......
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 BlockedPortsResource extends ServerResource {
@Get("json")
public Set<NodePortTuple> retrieve() {
ITopologyService topology =
(ITopologyService)getContext().getAttributes().
get(ITopologyService.class.getCanonicalName());
return topology.getBlockedPorts();
}
}
......@@ -17,6 +17,7 @@ public class TopologyWebRoutable implements RestletRoutable {
router.attach("/tunnellinks/json", TunnelLinksResource.class);
router.attach("/switchclusters/json", SwitchClustersResource.class);
router.attach("/broadcastdomainports/json", BroadcastDomainResource.class);
router.attach("/blockedports/json", BlockedPortsResource.class);
return router;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment