Skip to content
Snippets Groups Projects
Commit 21166e70 authored by Saurav Das's avatar Saurav Das
Browse files

Modifying DebugEvent web resources to be consistent with Rob's changes to DebugCounters

parent 36dd750b
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,6 @@
package net.floodlightcontroller.core.web;
import net.floodlightcontroller.core.module.ModuleLoaderResource;
import net.floodlightcontroller.debugevent.DebugEventGetResource;
import net.floodlightcontroller.restserver.RestletRoutable;
import org.restlet.Context;
......@@ -61,7 +60,6 @@ public class CoreWebRoutable implements RestletRoutable {
router.attach("/role/json", ControllerRoleResource.class);
router.attach("/health/json", HealthCheckResource.class);
router.attach("/system/uptime/json", SystemUptimeResource.class);
router.attach("/debugevent/{param}/json", DebugEventGetResource.class);
return router;
}
}
......@@ -17,6 +17,8 @@ import net.floodlightcontroller.core.module.FloodlightModuleContext;
import net.floodlightcontroller.core.module.FloodlightModuleException;
import net.floodlightcontroller.core.module.IFloodlightModule;
import net.floodlightcontroller.core.module.IFloodlightService;
import net.floodlightcontroller.debugevent.web.DebugEventRoutable;
import net.floodlightcontroller.restserver.IRestApiService;
import com.google.common.collect.Sets;
/**
......@@ -51,7 +53,7 @@ public class DebugEvent implements IFloodlightModule, IDebugEventService {
/**
* Event Information
*/
protected class EventInfo {
public class EventInfo {
int eventId;
boolean enabled;
int bufferCapacity;
......@@ -404,7 +406,10 @@ public class DebugEvent implements IFloodlightModule, IDebugEventService {
@Override
public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
return null;
ArrayList<Class<? extends IFloodlightService>> deps =
new ArrayList<Class<? extends IFloodlightService>>();
deps.add(IRestApiService.class);
return deps;
}
@Override
......@@ -415,6 +420,9 @@ public class DebugEvent implements IFloodlightModule, IDebugEventService {
@Override
public void startUp(FloodlightModuleContext context)
throws FloodlightModuleException {
IRestApiService restService =
context.getServiceImpl(IRestApiService.class);
restService.addRestletRoutable(new DebugEventRoutable());
}
}
......@@ -32,6 +32,7 @@ public interface IDebugEventService extends IFloodlightService {
public EventInfo getEventInfo() {
return eventInfo;
}
public ArrayList<String> getEvents() {
return events;
}
......
package net.floodlightcontroller.debugevent;
package net.floodlightcontroller.debugevent.web;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.floodlightcontroller.debugevent.IDebugEventService.DebugEventInfo;
import org.restlet.resource.Get;
......@@ -16,7 +17,7 @@ import org.slf4j.LoggerFactory;
* Return the debug event data for the get rest-api call
*
* URI must be in one of the following forms:
* "http://{controller-hostname}:8080/wm/core/debugevent/{param}/json
* "http://{controller-hostname}:8080/wm/debugevent/{param}/json
*
* where {param} must be one of (no quotes):
* "all" returns value/info on all active events.
......@@ -25,9 +26,9 @@ import org.slf4j.LoggerFactory;
*
* @author Saurav
*/
public class DebugEventGetResource extends DebugEventResourceBase {
public class DebugEventResource extends DebugEventResourceBase {
protected static Logger logger =
LoggerFactory.getLogger(DebugEventGetResource.class);
LoggerFactory.getLogger(DebugEventResource.class);
/**
* The output JSON model that contains the counter information
......@@ -109,7 +110,7 @@ public class DebugEventGetResource extends DebugEventResourceBase {
private void populateSingleEvent(DebugEventInfo singleEventHistory,
DebugEventInfoOutput output) {
if (singleEventHistory != null) {
output.eventMap.put(singleEventHistory.eventInfo.moduleEventName,
output.eventMap.put(singleEventHistory.getEventInfo().getModuleEventName(),
singleEventHistory);
}
}
......
package net.floodlightcontroller.debugevent;
package net.floodlightcontroller.debugevent.web;
import net.floodlightcontroller.debugevent.IDebugEventService;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;
......
package net.floodlightcontroller.debugevent.web;
import org.restlet.Context;
import org.restlet.Restlet;
import org.restlet.routing.Router;
import net.floodlightcontroller.restserver.RestletRoutable;
public class DebugEventRoutable implements RestletRoutable {
@Override
public Restlet getRestlet(Context context) {
Router router = new Router(context);
router.attach("/{param}", DebugEventResource.class);
return router;
}
@Override
public String basePath() {
return "/wm/debugevent";
}
}
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