Implemented the API method to get all switch-controller information from Zookeeper. Also implemented the informational REST APIs for the Registry service
diff --git a/src/main/java/net/onrc/onos/registry/controller/SwitchRegistryResource.java b/src/main/java/net/onrc/onos/registry/controller/SwitchRegistryResource.java
new file mode 100644
index 0000000..17ad48c
--- /dev/null
+++ b/src/main/java/net/onrc/onos/registry/controller/SwitchRegistryResource.java
@@ -0,0 +1,40 @@
+package net.onrc.onos.registry.controller;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.restlet.resource.Get;
+import org.restlet.resource.ServerResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SwitchRegistryResource extends ServerResource {
+
+ protected static Logger log = LoggerFactory.getLogger(SwitchRegistryResource.class);
+
+ @Get("json")
+ public Map<String, List<ControllerRegistryEntry>> getAllControllers(){
+ IControllerRegistryService registry =
+ (IControllerRegistryService) getContext().getAttributes().
+ get(IControllerRegistryService.class.getCanonicalName());
+
+ Map<String, List<ControllerRegistryEntry>> switches = null;
+ switches = registry.getAllSwitches();
+
+ if (switches == null){
+ switches = new HashMap<String, List<ControllerRegistryEntry>>();
+ }
+
+ log.debug("GETTING ALL CONTROLLERS");
+
+ for (List<ControllerRegistryEntry> list: switches.values()){
+ for (ControllerRegistryEntry en : list) {
+ log.debug("Controller id {}", en.getControllerId());
+ }
+ }
+
+
+ return switches;
+ }
+}