@GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("{networkId}/links")
    public Response getVirtualLinks(@PathParam("networkId") long networkId) {
        NetworkId nid = NetworkId.networkId(networkId);
        Set<VirtualLink> vlinks = vnetService.getVirtualLinks(nid);
        return ok(encodeArray(VirtualLink.class, "links", vlinks)).build();
    }
@Test
    public void testGetVirtualLinksArray() {
        NetworkId networkId = networkId3;
        final Set<VirtualLink> vlinkSet = ImmutableSet.of(vlink1, vlink2);
        expect(mockVnetService.getVirtualLinks(networkId)).andReturn(vlinkSet).anyTimes();
        replay(mockVnetService);

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

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

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

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

        vlinkSet.forEach(vlink -> assertThat(vnetJsonArray, hasVlink(vlink)));

        verify(mockVnetService);
    }