ONOS-4077: REST API's for virtual networks and tenants
Change-Id: Ic229c9bc78e4bfce20842717ae46a0b8acff0b76
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/TenantWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/TenantWebResource.java
index dc15be5..afef7a7 100755
--- a/web/api/src/main/java/org/onosproject/rest/resources/TenantWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/TenantWebResource.java
@@ -61,7 +61,7 @@
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
- public Response getVirtualNetworkTenants() {
+ public Response getVirtualNetworkTenantIds() {
Iterable<TenantId> tenantIds = vnetAdminService.getTenantIds();
return ok(encodeArray(TenantId.class, "tenants", tenantIds)).build();
}
@@ -109,24 +109,6 @@
}
/**
- * Removes the specified tenant with the specified tenant identifier.
- *
- * @param stream deviceIds JSON stream
- * @return 200 OK, 404 not found
- * @onos.rsModel TenantId
- */
- @DELETE
- public Response removeTenantId(InputStream stream) {
- try {
- final TenantId tid = getTenantIdFromJsonStream(stream);
- vnetAdminService.unregisterTenantId(tid);
- } catch (IOException e) {
- throw new IllegalArgumentException(e);
- }
- return Response.ok().build();
- }
-
- /**
* Get the tenant identifier from the JSON stream.
*
* @param stream TenantId JSON stream
diff --git a/web/api/src/test/java/org/onosproject/rest/resources/TenantWebResourceTest.java b/web/api/src/test/java/org/onosproject/rest/resources/TenantWebResourceTest.java
index e1bbcd7..2f4d65b 100644
--- a/web/api/src/test/java/org/onosproject/rest/resources/TenantWebResourceTest.java
+++ b/web/api/src/test/java/org/onosproject/rest/resources/TenantWebResourceTest.java
@@ -295,26 +295,6 @@
}
/**
- * Tests removing a tenant id with DELETE request via JSON stream.
- */
- @Test
- public void testDeleteViaJson() {
- mockVnetAdminService.unregisterTenantId(anyObject());
- expectLastCall();
- replay(mockVnetAdminService);
-
- WebTarget wt = target()
- .property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
- InputStream jsonStream = TenantWebResourceTest.class
- .getResourceAsStream("post-tenant.json");
- Response response = wt.request().method("DELETE", Entity.json(jsonStream));
-
-// assertThat(response.getStatus(), is(HttpURLConnection.HTTP_OK));
-
-// verify(mockVnetAdminService);
- }
-
- /**
* Tests that a DELETE of a non-existent tenant id throws an exception.
*/
@Test
diff --git a/web/api/src/test/java/org/onosproject/rest/resources/VirtualNetworkWebResourceTest.java b/web/api/src/test/java/org/onosproject/rest/resources/VirtualNetworkWebResourceTest.java
index a41f65a..dcf2f0b 100644
--- a/web/api/src/test/java/org/onosproject/rest/resources/VirtualNetworkWebResourceTest.java
+++ b/web/api/src/test/java/org/onosproject/rest/resources/VirtualNetworkWebResourceTest.java
@@ -226,12 +226,12 @@
* @param obj virtual network object we are looking for
* @param jsonFieldNames JSON field names to check against
* @param getValue function to retrieve value from virtual network object
- * @param <T>
- * @return JsonObjectMatcher
+ * @param <T> the type of virtual network object
+ * @return matcher
*/
private static <T> JsonObjectMatcher matchesVnetEntity(T obj, List<String> jsonFieldNames,
BiFunction<T, String, String> getValue) {
- return new JsonObjectMatcher(obj, jsonFieldNames, getValue);
+ return new JsonObjectMatcher<T>(obj, jsonFieldNames, getValue);
}
/**