X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnorthbound%2Fintegrationtest%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnorthbound%2Fintegrationtest%2FNorthboundIT.java;h=ca6434af38acd0cfba7cf2bf0e4a5b038e8c9d19;hp=76974d7541d5994631e979db74e87ced20709054;hb=e72236867ac8470265fa90c6096216b93c8a2df2;hpb=144cfa4b4a926b7d0c3d5f60ada050c609762699 diff --git a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java index 76974d7541..ca6434af38 100644 --- a/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java +++ b/opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java @@ -208,29 +208,29 @@ public class NorthboundIT { if (timestamp == null || timestampName == null) { Assert.assertFalse(properties.has("timeStamp")); } else { - Assert.assertEquals(timestamp, (Integer) properties.getJSONObject("timeStamp").getInt("timestamp")); - Assert.assertEquals(timestampName, properties.getJSONObject("timeStamp").getString("timestampName")); + Assert.assertEquals(timestamp, (Integer) properties.getJSONObject("timeStamp").getInt("value")); + Assert.assertEquals(timestampName, properties.getJSONObject("timeStamp").getString("name")); } if (actionsValue == null) { Assert.assertFalse(properties.has("actions")); } else { - Assert.assertEquals(actionsValue, (Integer) properties.getJSONObject("actions").getInt("actionsValue")); + Assert.assertEquals(actionsValue, (Integer) properties.getJSONObject("actions").getInt("value")); } if (capabilitiesValue == null) { Assert.assertFalse(properties.has("capabilities")); } else { Assert.assertEquals(capabilitiesValue, - (Integer) properties.getJSONObject("capabilities").getInt("capabilitiesValue")); + (Integer) properties.getJSONObject("capabilities").getInt("value")); } if (tablesValue == null) { Assert.assertFalse(properties.has("tables")); } else { - Assert.assertEquals(tablesValue, (Integer) properties.getJSONObject("tables").getInt("tablesValue")); + Assert.assertEquals(tablesValue, (Integer) properties.getJSONObject("tables").getInt("value")); } if (buffersValue == null) { Assert.assertFalse(properties.has("buffers")); } else { - Assert.assertEquals(buffersValue, (Integer) properties.getJSONObject("buffers").getInt("buffersValue")); + Assert.assertEquals(buffersValue, (Integer) properties.getJSONObject("buffers").getInt("value")); } } @@ -249,18 +249,18 @@ public class NorthboundIT { if (state == null) { Assert.assertFalse(properties.has("state")); } else { - Assert.assertEquals(state, (Integer) properties.getJSONObject("state").getInt("stateValue")); + Assert.assertEquals(state, (Integer) properties.getJSONObject("state").getInt("value")); } if (capabilities == null) { Assert.assertFalse(properties.has("capabilities")); } else { Assert.assertEquals(capabilities, - (Integer) properties.getJSONObject("capabilities").getInt("capabilitiesValue")); + (Integer) properties.getJSONObject("capabilities").getInt("value")); } if (bandwidth == null) { Assert.assertFalse(properties.has("bandwidth")); } else { - Assert.assertEquals(bandwidth, (Integer) properties.getJSONObject("bandwidth").getInt("bandwidthValue")); + Assert.assertEquals(bandwidth, (Integer) properties.getJSONObject("bandwidth").getInt("value")); } } @@ -489,9 +489,9 @@ public class NorthboundIT { // Test add property to node // Add Tier and Description property to node1 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 + "/property/tier/1001", "PUT"); - Assert.assertEquals(200, httpResponseCode.intValue()); + Assert.assertEquals(201, httpResponseCode.intValue()); result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 + "/property/description/node1", "PUT"); - Assert.assertEquals(200, httpResponseCode.intValue()); + Assert.assertEquals(201, httpResponseCode.intValue()); // Test for first node result = getJsonResult(baseURL + "nodes"); @@ -499,8 +499,8 @@ public class NorthboundIT { json = new JSONObject(jt); node = getJsonInstance(json, "nodeProperties", nodeId_1); Assert.assertNotNull(node); - Assert.assertEquals(1001, node.getJSONObject("properties").getJSONObject("tier").getInt("tierValue")); - Assert.assertEquals("node1", node.getJSONObject("properties").getJSONObject("description").getString("descriptionValue")); + Assert.assertEquals(1001, node.getJSONObject("properties").getJSONObject("tier").getInt("value")); + Assert.assertEquals("node1", node.getJSONObject("properties").getJSONObject("description").getString("value")); // Test delete nodeConnector property // Delete state property of nodeconnector1 @@ -558,7 +558,7 @@ public class NorthboundIT { String baseURL = "http://127.0.0.1:8080/controller/nb/v2/statistics/default/"; - String result = getJsonResult(baseURL + "flowstats"); + String result = getJsonResult(baseURL + "flow"); JSONTokener jt = new JSONTokener(result); JSONObject json = new JSONObject(jt); JSONObject flowStatistics = getJsonInstance(json, "flowStatistics", 0xCAFE); @@ -568,7 +568,7 @@ public class NorthboundIT { Assert.assertEquals(node.getString("@type"), "STUB"); // test that flow statistics results are correct - JSONArray flowStats = flowStatistics.getJSONArray("flowStat"); + JSONArray flowStats = flowStatistics.getJSONArray("flowStatistic"); for (int i = 0; i < flowStats.length(); i++) { JSONObject flowStat = flowStats.getJSONObject(i); @@ -576,8 +576,8 @@ public class NorthboundIT { } - // for /controller/nb/v2/statistics/default/portstats - result = getJsonResult(baseURL + "portstats"); + // for /controller/nb/v2/statistics/default/port + result = getJsonResult(baseURL + "port"); jt = new JSONTokener(result); json = new JSONObject(jt); JSONObject portStatistics = getJsonInstance(json, "portStatistics", 0xCAFE); @@ -587,7 +587,7 @@ public class NorthboundIT { Assert.assertEquals(node2.getString("@type"), "STUB"); // test that port statistic results are correct - JSONObject portStat = portStatistics.getJSONObject("portStat"); + JSONObject portStat = portStatistics.getJSONObject("portStatistic"); Assert.assertTrue(portStat.getInt("receivePackets") == 250); Assert.assertTrue(portStat.getInt("transmitPackets") == 500); Assert.assertTrue(portStat.getInt("receiveBytes") == 1000); @@ -602,7 +602,7 @@ public class NorthboundIT { Assert.assertTrue(portStat.getInt("collisionCount") == 4); // test for getting one specific node's stats - result = getJsonResult(baseURL + "flowstats/STUB/51966"); + result = getJsonResult(baseURL + "flow/node/STUB/51966"); jt = new JSONTokener(result); json = new JSONObject(jt); node = json.getJSONObject("node"); @@ -611,13 +611,13 @@ public class NorthboundIT { Assert.assertEquals(node.getString("@type"), "STUB"); // test that flow statistics results are correct - flowStats = json.getJSONArray("flowStat"); + flowStats = json.getJSONArray("flowStatistic"); for (int i = 0; i < flowStats.length(); i++) { JSONObject flowStat = flowStats.getJSONObject(i); testFlowStat(flowStat, actionTypes[i], i); } - result = getJsonResult(baseURL + "portstats/STUB/51966"); + result = getJsonResult(baseURL + "port/node/STUB/51966"); jt = new JSONTokener(result); json = new JSONObject(jt); node2 = json.getJSONObject("node"); @@ -626,7 +626,7 @@ public class NorthboundIT { Assert.assertEquals(node2.getString("@type"), "STUB"); // test that port statistic results are correct - portStat = json.getJSONObject("portStat"); + portStat = json.getJSONObject("portStatistic"); Assert.assertTrue(portStat.getInt("receivePackets") == 250); Assert.assertTrue(portStat.getInt("transmitPackets") == 500); Assert.assertTrue(portStat.getInt("receiveBytes") == 1000); @@ -734,16 +734,16 @@ public class NorthboundIT { String baseURL = "http://127.0.0.1:8080/controller/nb/v2/flow/default/"; // Attempt to get a flow that doesn't exit. Should return 404 // status. - String result = getJsonResult(baseURL + "STUB/51966/test1", "GET"); + String result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test1", "GET"); Assert.assertTrue(result.equals("404")); // test add flow1 String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; - result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc); + result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test1", "PUT", fc); Assert.assertTrue(httpResponseCode == 201); // test get returns flow that was added. - result = getJsonResult(baseURL + "STUB/51966/test1", "GET"); + result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test1", "GET"); // check that result came out fine. Assert.assertTrue(httpResponseCode == 200); JSONTokener jt = new JSONTokener(result); @@ -756,21 +756,21 @@ public class NorthboundIT { Assert.assertEquals(node.getString("@id"), "51966"); // test adding same flow again fails due to repeat name..return 409 // code - result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc); + result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test1", "PUT", fc); Assert.assertTrue(result.equals("409")); fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; - result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc); - // test should return 500 for error due to same flow being added. - Assert.assertTrue(result.equals("500")); + result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test2", "PUT", fc); + // test should return 409 for error due to same flow being added. + Assert.assertTrue(result.equals("409")); // add second flow that's different fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; - result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc); + result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test2", "PUT", fc); Assert.assertTrue(httpResponseCode == 201); // check that request returns both flows given node. - result = getJsonResult(baseURL + "STUB/51966/", "GET"); + result = getJsonResult(baseURL + "node/STUB/51966/", "GET"); jt = new JSONTokener(result); json = new JSONObject(jt); Assert.assertTrue(json.get("flowConfig") instanceof JSONArray); @@ -788,10 +788,10 @@ public class NorthboundIT { Assert.assertTrue(count == 2); // delete a flow, check that it's no longer in list. - result = getJsonResult(baseURL + "STUB/51966/test2", "DELETE"); + result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test2", "DELETE"); Assert.assertTrue(httpResponseCode == 200); - result = getJsonResult(baseURL + "STUB/51966/test2", "GET"); + result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test2", "GET"); Assert.assertTrue(result.equals("404")); } @@ -1091,9 +1091,9 @@ public class NorthboundIT { Assert.assertEquals(tailNode.getString("@type"),nodeType); Assert.assertEquals(tailNode.getString("@type"), nodeConnType); Assert.assertEquals(tailNC.getLong("@id"), tailNC1_nodeConnId); - Assert.assertEquals(bandw.getLong("bandwidthValue"), bw_1); - Assert.assertTrue((short) stt.getInt("stateValue") == state_1); - Assert.assertEquals(ltc.getLong("latencyValue"), lat_1); + Assert.assertEquals(bandw.getLong("value"), bw_1); + Assert.assertTrue((short) stt.getInt("value") == state_1); + Assert.assertEquals(ltc.getLong("value"), lat_1); } else if (headNC.getInt("@id") == headNC2_nodeConnId) { Assert.assertEquals(headNode.getString("@type"),nodeType); Assert.assertEquals(headNode.getLong("@id"), headNC2_nodeId); @@ -1102,9 +1102,9 @@ public class NorthboundIT { Assert.assertTrue(tailNode.getInt("@id") == tailNC2_nodeId); Assert.assertEquals(tailNC.getString("@type"), nodeConnType); Assert.assertEquals(tailNC.getLong("@id"), tailNC2_nodeConnId); - Assert.assertEquals(bandw.getLong("bandwidthValue"), bw_2); - Assert.assertTrue((short) stt.getInt("stateValue") == state_2); - Assert.assertEquals(ltc.getLong("latencyValue"), lat_2); + Assert.assertEquals(bandw.getLong("value"), bw_2); + Assert.assertTrue((short) stt.getInt("value") == state_2); + Assert.assertEquals(ltc.getLong("value"), lat_2); } }