@GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("{networkId}/devices")
    public Response getVirtualDevices(@PathParam("networkId") long networkId) {
        NetworkId nid = NetworkId.networkId(networkId);
        Set<VirtualDevice> vdevs = vnetService.getVirtualDevices(nid);
        return ok(encodeArray(VirtualDevice.class, "devices", vdevs)).build();
    }
@Test
    public void testGetVirtualDevicesArray() {
        NetworkId networkId = networkId3;
        vdevSet.add(vdev1);
        vdevSet.add(vdev2);
        expect(mockVnetService.getVirtualDevices(networkId)).andReturn(vdevSet).anyTimes();
        replay(mockVnetService);

        WebTarget wt = target();
        String location = "vnets/" + networkId.toString() + "/devices";
        String response = wt.path(location).request().get(String.class);
        assertThat(response, containsString("{\"devices\":["));

        final JsonObject result = Json.parse(response).asObject();
        assertThat(result, notNullValue());

        assertThat(result.names(), hasSize(1));
        assertThat(result.names().get(0), is("devices"));

        final JsonArray vnetJsonArray = result.get("devices").asArray();
        assertThat(vnetJsonArray, notNullValue());
        assertEquals("Virtual devices array is not the correct size.",
                     vdevSet.size(), vnetJsonArray.size());

        vdevSet.forEach(vdev -> assertThat(vnetJsonArray, hasVdev(vdev)));

        verify(mockVnetService);
    }