Renamed "devices" to "hosts" in the Topology REST API:

 * REST call path rename:
   http://%s:%s/wm/onos/topology/devices ->
   http://%s:%s/wm/onos/topology/hosts

 * Topology output JSON format: renamed field "devices" to "hosts".

OLD:
{
   ...
   "devices": [...],
   ...
}

NEW:
{
   ...
   "hosts": [...],
   ...
}

TODO in (a) separate commit(s):
 * Renaming of "Device/Devices" and "device/devices" in the Java API
 * Renaming of "Device/Devices" and "device/devices" in the backend
   implementation

Change-Id: Ic70bf166f885a1a5ba7d8d33326ff43f84d2c506
diff --git a/onoscli b/onoscli
index 0d7caee..6bfa9d0 100755
--- a/onoscli
+++ b/onoscli
@@ -162,9 +162,9 @@
             #
             Command("show", "Show command"),
             #
-            Command("show device", "Show devices"),
+            Command("show host", "Show hosts"),
             #
-            Command("show device all", "Show all devices", self.show_device_all),
+            Command("show host all", "Show all hosts", self.show_host_all),
             #
             Command("show intent", "Show intents"),
             #
@@ -300,10 +300,10 @@
         # if len(result) != 0:
         #     self.print_json_result(result)
 
-    def show_device_all(self, args):
-        "CLI command callback: show device all"
+    def show_host_all(self, args):
+        "CLI command callback: show host all"
 
-        url = "http://%s:%s/wm/onos/topology/devices" % (self.onos_ip, self.onos_port)
+        url = "http://%s:%s/wm/onos/topology/hosts" % (self.onos_ip, self.onos_port)
         result = get_json(url)
         self.print_json_result(result)
 
diff --git a/src/main/java/net/onrc/onos/core/topology/web/TopologyWebRoutable.java b/src/main/java/net/onrc/onos/core/topology/web/TopologyWebRoutable.java
index 8eb18d4..1f224d2 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/TopologyWebRoutable.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/TopologyWebRoutable.java
@@ -18,7 +18,7 @@
 
         // Topology API
         router.attach("", TopologyResource.class);
-        router.attach("/devices", DevicesResource.class);
+        router.attach("/hosts", DevicesResource.class);
         router.attach("/links", LinksResource.class);
         router.attach("/switches", SwitchesResource.class);
 
diff --git a/src/main/java/net/onrc/onos/core/topology/web/serializers/TopologySerializer.java b/src/main/java/net/onrc/onos/core/topology/web/serializers/TopologySerializer.java
index 0769805..48a5cfc 100644
--- a/src/main/java/net/onrc/onos/core/topology/web/serializers/TopologySerializer.java
+++ b/src/main/java/net/onrc/onos/core/topology/web/serializers/TopologySerializer.java
@@ -55,8 +55,8 @@
         }
         jsonGenerator.writeEndArray();
 
-        // Output the devices array
-        jsonGenerator.writeArrayFieldStart("devices");
+        // Output the hosts array
+        jsonGenerator.writeArrayFieldStart("hosts");
         for (final Device device : topology.getDevices()) {
             jsonGenerator.writeObject(device);
         }
diff --git a/src/test/java/net/onrc/onos/api/rest/TestRestTopologyGet.java b/src/test/java/net/onrc/onos/api/rest/TestRestTopologyGet.java
index eb8ee2e..b7b8d65 100644
--- a/src/test/java/net/onrc/onos/api/rest/TestRestTopologyGet.java
+++ b/src/test/java/net/onrc/onos/api/rest/TestRestTopologyGet.java
@@ -125,20 +125,20 @@
     }
 
     /**
-     * Check that the JSON array returned for the devices element matches
+     * Check that the JSON array returned for the hosts element matches
      * the data in the mocked topology.
      *
-     * @param devices JSON array of switches
+     * @param hosts JSON array of hosts
      */
-    private void checkDevices(final JSONArray devices) {
-        // devices array should be empty
-        assertThat(devices.length(), is(equalTo(0)));
+    private void checkHosts(final JSONArray hosts) {
+        // hosts array should be empty
+        assertThat(hosts.length(), is(equalTo(0)));
     }
 
     /**
      * Test that the GET of all Topology REST call returns the proper result.
      * The call to get all Topology should return 3 items (switches, links,
-     * and devices), an HTTP status of OK, and the proper topology data.
+     * and hosts), an HTTP status of OK, and the proper topology data.
      */
     @Test
     public void testFetchOfAllTopology() throws Exception {
@@ -159,9 +159,9 @@
         final JSONArray links = topology.getJSONArray("links");
         checkLinks(links);
 
-        // Check the devices array
-        final JSONArray devices = topology.getJSONArray("devices");
-        checkDevices(devices);
+        // Check the hosts array
+        final JSONArray hosts = topology.getJSONArray("hosts");
+        checkHosts(hosts);
     }
 
     /**
@@ -195,17 +195,17 @@
     }
 
     /**
-     * Test that the GET of all devices REST call returns the proper result.
-     * The call to get all devices should return no devices.
+     * Test that the GET of all hosts REST call returns the proper result.
+     * The call to get all hosts should return no hosts.
      */
     @Test
-    public void testFetchOfAllDevices() throws Exception {
-        final ClientResource client = new ClientResource(getBaseRestTopologyUrl() + "/switches");
-        final JSONArray devices = getJSONArray(client);
+    public void testFetchOfAllHosts() throws Exception {
+        final ClientResource client = new ClientResource(getBaseRestTopologyUrl() + "/hosts");
+        final JSONArray hosts = getJSONArray(client);
 
         // HTTP status should be OK
         assertThat(client, hasStatusOf(Status.SUCCESS_OK));
 
-        checkSwitches(devices);
+        checkHosts(hosts);
     }
 }