From: Madhu Venugopal Date: Sat, 31 Aug 2013 13:12:27 +0000 (+0000) Subject: Merge "toaster-it: add missing version for maven-paxexam-plugin" X-Git-Tag: releasepom-0.1.0~138 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=04187bee472c35e1f200bff6ef0daeb5163d36fa;hp=5aab0b90a2383de33cb98382e138f64c0b848674 Merge "toaster-it: add missing version for maven-paxexam-plugin" --- diff --git a/.gitignore b/.gitignore index 52881a35c0..53ea040cf6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ *.class **/target -**/bin +bin/ dist **/logs products diff --git a/opendaylight/distribution/opendaylight/src/main/resources/configuration/context.xml b/opendaylight/distribution/opendaylight/src/main/resources/configuration/context.xml index 24c211ac47..90b9ddf1c8 100644 --- a/opendaylight/distribution/opendaylight/src/main/resources/configuration/context.xml +++ b/opendaylight/distribution/opendaylight/src/main/resources/configuration/context.xml @@ -1 +1 @@ - + diff --git a/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java b/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java index 32b9dd32bb..2d270b44f9 100644 --- a/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java +++ b/opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java @@ -70,7 +70,7 @@ public class FlowProgrammerNorthbound { @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName(); } protected String getUserName() { @@ -166,7 +166,10 @@ public class FlowProgrammerNorthbound { * <flowConfig> * <installInHw>true</installInHw> * <name>flow1</name> - * <node id="00:00:00:00:00:00:00:01" type="OF"/> + * <node> + * <id>00:00:00:00:00:00:00:01</id> + * <type>OF</type> + * </node> * <ingressPort>1</ingressPort> * <priority>500</priority> * <etherType>0x800</etherType> @@ -176,7 +179,7 @@ public class FlowProgrammerNorthbound { * </list> * * Response in JSON: - * {"flowConfig":{"installInHw":"true","name":"flow1","node":{"@id":"00:00:00:00:00:00:00:01","@type":"OF"}, + * {"flowConfig":{"installInHw":"true","name":"flow1","node":{"id":"00:00:00:00:00:00:00:01","type":"OF"}, * "ingressPort":"1","priority":"500","etherType":"0x800","nwSrc":"9.9.1.1","actions":"OUTPUT=2"}} * * @@ -228,7 +231,10 @@ public class FlowProgrammerNorthbound { * <flowConfig> * <installInHw>true</installInHw> * <name>flow1</name> - * <node id="00:00:00:00:00:00:00:01" type="OF"/> + * <node> + * <id>00:00:00:00:00:00:00:01</id> + * <type>OF</type> + * </node> * <ingressPort>1</ingressPort> * <priority>500</priority> * <etherType>0x800</etherType> @@ -238,7 +244,7 @@ public class FlowProgrammerNorthbound { * </list> * * Response in JSON: - * {"flowConfig":{"installInHw":"true","name":"flow1","node":{"@id":"00:00:00:00:00:00:00:01","@type":"OF"}, + * {"flowConfig":{"installInHw":"true","name":"flow1","node":{"id":"00:00:00:00:00:00:00:01","type":"OF"}, * "ingressPort":"1","priority":"500","etherType":"0x800","nwSrc":"9.9.1.1","actions":"OUTPUT=2"}} * * @@ -297,7 +303,10 @@ public class FlowProgrammerNorthbound { * <flowConfig> * <installInHw>true</installInHw> * <name>flow1</name> - * <node id="00:00:00:00:00:00:00:01" type="OF"/> + * <node> + * <id>00:00:00:00:00:00:00:01</id> + * <type>OF</type> + * </node> * <ingressPort>1</ingressPort> * <priority>500</priority> * <etherType>0x800</etherType> @@ -306,7 +315,7 @@ public class FlowProgrammerNorthbound { * </flowConfig> * * Response in JSON: - * {"installInHw":"true","name":"flow1","node":{"@id":"00:00:00:00:00:00:00:01","@type":"OF"}, + * {"installInHw":"true","name":"flow1","node":{"id":"00:00:00:00:00:00:00:01","type":"OF"}, * "ingressPort":"1","priority":"500","etherType":"0x800","nwSrc":"9.9.1.1","actions":"OUTPUT=2"} * * @@ -373,7 +382,10 @@ public class FlowProgrammerNorthbound { * <flowConfig> * <installInHw>true</installInHw> * <name>flow1</name> - * <node id="00:00:00:00:00:00:00:01" type="OF"/> + * <node> + * <id>00:00:00:00:00:00:00:01</id> + * <type>OF</type> + * </node> * <ingressPort>1</ingressPort> * <priority>500</priority> * <etherType>0x800</etherType> @@ -382,7 +394,7 @@ public class FlowProgrammerNorthbound { * </flowConfig> * * Request in JSON: - * {"installInHw":"true","name":"flow1","node":{"@id":"00:00:00:00:00:00:00:01","@type":"OF"}, + * {"installInHw":"true","name":"flow1","node":{"id":"00:00:00:00:00:00:00:01","type":"OF"}, * "ingressPort":"1","priority":"500","etherType":"0x800","nwSrc":"9.9.1.1","actions":"OUTPUT=2"} * * diff --git a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java index 2530d78416..769461167c 100644 --- a/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java +++ b/opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java @@ -78,7 +78,7 @@ public class HostTrackerNorthbound { @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName(); } protected String getUserName() { 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 b8229cfc5d..f4adc71fa2 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 @@ -200,8 +200,8 @@ public class NorthboundIT { Integer buffersValue) throws JSONException { JSONObject nodeInfo = node.getJSONObject("node"); - Assert.assertEquals(nodeId, (Integer) nodeInfo.getInt("@id")); - Assert.assertEquals(nodeType, nodeInfo.getString("@type")); + Assert.assertEquals(nodeId, (Integer) nodeInfo.getInt("id")); + Assert.assertEquals(nodeType, nodeInfo.getString("type")); JSONObject properties = node.getJSONObject("properties"); @@ -242,10 +242,10 @@ public class NorthboundIT { JSONObject node = nodeConnector.getJSONObject("node"); JSONObject properties = nodeConnectorProperties.getJSONObject("properties"); - Assert.assertEquals(ncId, (Integer) nodeConnector.getInt("@id")); - Assert.assertEquals(ncType, nodeConnector.getString("@type")); - Assert.assertEquals(nodeId, (Integer) node.getInt("@id")); - Assert.assertEquals(nodeType, node.getString("@type")); + Assert.assertEquals(ncId, (Integer) nodeConnector.getInt("id")); + Assert.assertEquals(ncType, nodeConnector.getString("type")); + Assert.assertEquals(nodeId, (Integer) node.getInt("id")); + Assert.assertEquals(nodeType, node.getString("type")); if (state == null) { Assert.assertFalse(properties.has("state")); } else { @@ -612,8 +612,8 @@ public class NorthboundIT { JSONObject flowStatistics = getJsonInstance(json, "flowStatistics", 0xCAFE); JSONObject node = flowStatistics.getJSONObject("node"); // test that node was returned properly - Assert.assertTrue(node.getInt("@id") == 0xCAFE); - Assert.assertEquals(node.getString("@type"), "STUB"); + Assert.assertTrue(node.getInt("id") == 0xCAFE); + Assert.assertEquals(node.getString("type"), "STUB"); // test that flow statistics results are correct JSONArray flowStats = flowStatistics.getJSONArray("flowStatistic"); @@ -631,8 +631,8 @@ public class NorthboundIT { JSONObject portStatistics = getJsonInstance(json, "portStatistics", 0xCAFE); JSONObject node2 = portStatistics.getJSONObject("node"); // test that node was returned properly - Assert.assertTrue(node2.getInt("@id") == 0xCAFE); - Assert.assertEquals(node2.getString("@type"), "STUB"); + Assert.assertTrue(node2.getInt("id") == 0xCAFE); + Assert.assertEquals(node2.getString("type"), "STUB"); // test that port statistic results are correct JSONObject portStat = portStatistics.getJSONObject("portStatistic"); @@ -655,8 +655,8 @@ public class NorthboundIT { json = new JSONObject(jt); node = json.getJSONObject("node"); // test that node was returned properly - Assert.assertTrue(node.getInt("@id") == 0xCAFE); - Assert.assertEquals(node.getString("@type"), "STUB"); + Assert.assertTrue(node.getInt("id") == 0xCAFE); + Assert.assertEquals(node.getString("type"), "STUB"); // test that flow statistics results are correct flowStats = json.getJSONArray("flowStatistic"); @@ -670,8 +670,8 @@ public class NorthboundIT { json = new JSONObject(jt); node2 = json.getJSONObject("node"); // test that node was returned properly - Assert.assertTrue(node2.getInt("@id") == 0xCAFE); - Assert.assertEquals(node2.getString("@type"), "STUB"); + Assert.assertTrue(node2.getInt("id") == 0xCAFE); + Assert.assertEquals(node2.getString("type"), "STUB"); // test that port statistic results are correct portStat = json.getJSONObject("portStatistic"); @@ -713,10 +713,10 @@ public class NorthboundIT { if (act.getString("@type").equals("output")) { JSONObject port = act.getJSONObject("port"); JSONObject port_node = port.getJSONObject("node"); - Assert.assertTrue(port.getInt("@id") == 51966); - Assert.assertTrue(port.getString("@type").equals("STUB")); - Assert.assertTrue(port_node.getInt("@id") == 51966); - Assert.assertTrue(port_node.getString("@type").equals("STUB")); + Assert.assertTrue(port.getInt("id") == 51966); + Assert.assertTrue(port.getString("type").equals("STUB")); + Assert.assertTrue(port_node.getInt("id") == 51966); + Assert.assertTrue(port_node.getString("type").equals("STUB")); } if (act.getString("@type").equals("setDlSrc")) { @@ -786,7 +786,7 @@ public class NorthboundIT { Assert.assertTrue(result.equals("404")); // test add flow1 - String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; + String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test1", "PUT", fc); Assert.assertTrue(httpResponseCode == 201); @@ -800,20 +800,20 @@ public class NorthboundIT { Assert.assertEquals(json.getString("actions"), "DROP"); Assert.assertEquals(json.getString("installInHw"), "true"); JSONObject node = json.getJSONObject("node"); - Assert.assertEquals(node.getString("@type"), "STUB"); - Assert.assertEquals(node.getString("@id"), "51966"); + Assert.assertEquals(node.getString("type"), "STUB"); + Assert.assertEquals(node.getString("id"), "51966"); // test adding same flow again fails due to repeat name..return 409 // code 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\"]}"; + fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; 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\"]}"; + fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}"; result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test2", "PUT", fc); Assert.assertTrue(httpResponseCode == 201); @@ -854,13 +854,13 @@ public class NorthboundIT { JSONArray json_array = json.getJSONArray(array_name); for (int i = 0; i < json_array.length(); i++) { result = json_array.getJSONObject(i); - Integer nid = result.getJSONObject("node").getInt("@id"); + Integer nid = result.getJSONObject("node").getInt("id"); if (nid.equals(nodeId)) break; } } else { result = json.getJSONObject(array_name); - Integer nid = result.getJSONObject("node").getInt("@id"); + Integer nid = result.getJSONObject("node").getInt("id"); if (!nid.equals(nodeId)) result = null; } @@ -1137,24 +1137,24 @@ public class NorthboundIT { JSONObject stt = Props.getJSONObject("state"); JSONObject ltc = Props.getJSONObject("latency"); - if (headNC.getInt("@id") == headNC1_nodeConnId) { - Assert.assertEquals(headNode.getString("@type"), nodeType); - Assert.assertEquals(headNode.getLong("@id"), headNC1_nodeId); - Assert.assertEquals(headNC.getString("@type"), nodeConnType); - Assert.assertEquals(tailNode.getString("@type"),nodeType); - Assert.assertEquals(tailNode.getString("@type"), nodeConnType); - Assert.assertEquals(tailNC.getLong("@id"), tailNC1_nodeConnId); + if (headNC.getInt("id") == headNC1_nodeConnId) { + Assert.assertEquals(headNode.getString("type"), nodeType); + Assert.assertEquals(headNode.getLong("id"), headNC1_nodeId); + Assert.assertEquals(headNC.getString("type"), nodeConnType); + Assert.assertEquals(tailNode.getString("type"),nodeType); + Assert.assertEquals(tailNode.getString("type"), nodeConnType); + Assert.assertEquals(tailNC.getLong("id"), tailNC1_nodeConnId); 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); - Assert.assertEquals(headNC.getString("@type"), nodeConnType); - Assert.assertEquals(tailNode.getString("@type"), nodeType); - Assert.assertTrue(tailNode.getInt("@id") == tailNC2_nodeId); - Assert.assertEquals(tailNC.getString("@type"), nodeConnType); - Assert.assertEquals(tailNC.getLong("@id"), tailNC2_nodeConnId); + } else if (headNC.getInt("id") == headNC2_nodeConnId) { + Assert.assertEquals(headNode.getString("type"),nodeType); + Assert.assertEquals(headNode.getLong("id"), headNC2_nodeId); + Assert.assertEquals(headNC.getString("type"), nodeConnType); + Assert.assertEquals(tailNode.getString("type"), nodeType); + Assert.assertTrue(tailNode.getInt("id") == tailNC2_nodeId); + Assert.assertEquals(tailNC.getString("type"), nodeConnType); + Assert.assertEquals(tailNC.getLong("id"), tailNC2_nodeConnId); Assert.assertEquals(bandw.getLong("value"), bw_2); Assert.assertTrue((short) stt.getInt("value") == state_2); Assert.assertEquals(ltc.getLong("value"), lat_2); @@ -1180,7 +1180,7 @@ public class NorthboundIT { .append("dstNodeConnector", nodeConnectorType_2 + "|" + nodeConnectorId_2 + "@" + nodeType_2 + "|" + nodeId_2); // execute HTTP request and verify response code - result = getJsonResult(baseURL + "/user-link", "POST", jo.toString()); + result = getJsonResult(baseURL + "/user-link", "PUT", jo.toString()); Assert.assertTrue(httpResponseCode == 201); // === test GET method for getUserLinks() diff --git a/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java b/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java index 6b785b8070..da7faa2c78 100644 --- a/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java +++ b/opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java @@ -29,10 +29,10 @@ import org.opendaylight.controller.connectionmanager.IConnectionManager; import org.opendaylight.controller.northbound.commons.exception.NotAcceptableException; import org.opendaylight.controller.northbound.commons.exception.ResourceNotFoundException; import org.opendaylight.controller.northbound.commons.exception.ServiceUnavailableException; -import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants; -import org.opendaylight.controller.sal.networkconfig.bridgedomain.IBridgeDomainConfigService; import org.opendaylight.controller.sal.connection.ConnectionConstants; import org.opendaylight.controller.sal.core.Node; +import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants; +import org.opendaylight.controller.sal.networkconfig.bridgedomain.IBridgeDomainConfigService; import org.opendaylight.controller.sal.utils.NetUtils; import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.controller.sal.utils.Status; @@ -56,7 +56,7 @@ public class BridgeDomainNorthbound { @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName(); } protected String getUserName() { return username; @@ -76,11 +76,23 @@ public class BridgeDomainNorthbound { * If a Network Configuration Service needs a special Management Connection and if the * Node Type is unknown, use this REST api to connect to the management session. *
+     *
      * Example :
-     * Request : PUT http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/mgmt1/1.1.1.1/6634
-     * Response : Node :
-     *                  xml : <node type="STUB" id="mgmt1"/>
-     *                  json: {"@type": "STUB","@id": "mgmt1"}
+     *
+     * Request :
+     * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/mgmt1/1.1.1.1/6634
+     *
+     * Response :
+     * Node :
+     * xml :
+     * <node>
+     *    <id>mgmt1</id>
+     *    <type>STUB</type>
+     * </node>
+     *
+     * json:
+     * {"id": "mgmt1","type": "STUB"}
+     *
      *
* @param nodeName User-Defined name of the node to connect with. This can be any alpha numeric value * @param ipAddress IP Address of the Node to connect with. @@ -137,11 +149,22 @@ public class BridgeDomainNorthbound { * If a Network Configuration Service needs a special Management Connection, and if the * node Type is known, the user can choose to use this REST api to connect to the management session. *
+     *
      * Example :
-     * Request : PUT http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/STUB/mgmt1/1.1.1.1/6634
+     *
+     * Request :
+     * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/STUB/mgmt1/1.1.1.1/6634
+     *
      * Response : Node :
-     *                  xml : <node type="STUB" id="mgmt1"/>
-     *                  json: {"@type": "STUB","@id": "mgmt1"}
+     * xml :
+     * <node>
+     *    <id>mgmt1</id>
+     *    <type>STUB</type>
+     * </node>
+     *
+     * json:
+     * {"id": "mgmt1","type": "STUB"}
+     *
      *
* @param nodeName User-Defined name of the node to connect with. This can be any alpha numeric value * @param ipAddress IP Address of the Node to connect with. @@ -198,8 +221,12 @@ public class BridgeDomainNorthbound { /** * Create a Bridge. *
+     *
      * Example :
-     * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/STUB/mgmt1/bridge1
+     *
+     * Request :
+     * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/STUB/mgmt1/bridge1
+     *
      *
* @param nodeType Node Type of the node with the management session. * @param nodeId Node Identifier of the node with the management session. @@ -239,8 +266,12 @@ public class BridgeDomainNorthbound { /** * Add a Port to a Bridge *
+    *
     * Example :
-    * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port1
+    *
+    * Request :
+    * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port1
+    *
     *
* @param nodeType Node Type of the node with the management session. * @param nodeId Node Identifier of the node with the management session. @@ -282,9 +313,12 @@ public class BridgeDomainNorthbound { /** * Add a Port,Vlan to a Bridge *
+    *
     * Example :
-    * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port2/200
-    *
+ * Request : + * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port2/200 + * + * * @param nodeType Node Type of the node with the management session. * @param nodeId Node Identifier of the node with the management session. * @param bridgeName Name / Identifier of the bridge to which a Port is being added. diff --git a/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java b/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java index dceafac4ab..8462ef804a 100644 --- a/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java +++ b/opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java @@ -73,7 +73,7 @@ public class StaticRoutingNorthbound { @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName(); } protected String getUserName() { return username; diff --git a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthbound.java b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthbound.java index 1c3fd1cf2e..a07f6435fe 100644 --- a/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthbound.java +++ b/opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthbound.java @@ -64,7 +64,7 @@ public class StatisticsNorthbound { @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName(); } protected String getUserName() { @@ -111,17 +111,20 @@ public class StatisticsNorthbound { * controller is "default". * @return List of FlowStatistics from all the Nodes * - *
+     * 
+     *
      * Example:
-     * Request URL: localhost:8080/controller/nb/v2/statistics/default/flow
+     *
+     * Request URL:
+     * http://localhost:8080/controller/nb/v2/statistics/default/flow
      *
      * Response in JSON:
      * {
      *     "flowStatistics": [
      *         {
      *             "node": {
-     *                 "@type": "OF",
-     *                 "@id": "00:00:00:00:00:00:00:02"
+     *                 "id":"00:00:00:00:00:00:00:02",
+     *                 "type":"OF"
      *             },
      *             "flowStatistic": [
      *                 {
@@ -142,12 +145,12 @@ public class StatisticsNorthbound {
      *                         "actions": {
      *                             "@type": "output",
      *                             "port": {
-     *                                 "@type": "OF",
-     *                                 "@id": "3",
-     *                                 "node": {
-     *                                     "@type": "OF",
-     *                                     "@id": "00:00:00:00:00:00:00:02"
-     *                                 }
+     *                                 "node":{
+     *                                     "id":"00:00:00:00:00:00:00:02",
+     *                                     "type":"OF"
+     *                                 },
+     *                                 "id":"3",
+     *                                 "type":"OF"
      *                             }
      *                         },
      *                         "priority": "1",
@@ -171,11 +174,15 @@ public class StatisticsNorthbound {
      *
      *     ]
      * }
+     *
      * Response in XML:
      * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      * <list>
      *     <flowStatistics>
-     *         <node type="OF" id="00:00:00:00:00:00:00:02"/>
+     *         <node>
+     *             <id>00:00:00:00:00:00:00:02</id>
+     *             <type>OF</type>
+     *         </node>
      *         <flowStatistic>
      *             <flow>
      *                 <match>
@@ -191,8 +198,13 @@ public class StatisticsNorthbound {
      *                 </match>
      *                 <actions
      *                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="output">
-     *                     <port type="OF" id="3">
-     *                         <node type="OF" id="00:00:00:00:00:00:00:02"/>
+     *                     <port>
+     *                         <node>
+     *                             <id>00:00:00:00:00:00:00:02</id>
+     *                             <type>OF</type>
+     *                         </node>
+     *                         <id>3</id>
+     *                         <type>OF</type>
      *                     </port>
      *                 </actions>
      *                 <priority>1</priority>
@@ -272,16 +284,18 @@ public class StatisticsNorthbound {
      *            Node Identifier
      * @return List of Flow Statistics for a given Node. *
      *
-     *         
+     * 
+     *
      * Example:
+     *
      * Request URL:
-     * http://host:8080/controller/nb/v2/statistics/default/flow/node/OF/00:00:00:00:00:00:00:01
+     * http://localhost:8080/controller/nb/v2/statistics/default/flow/node/OF/00:00:00:00:00:00:00:01
      *
      * Response in JSON:
      * {
      *     "node": {
-     *         "@type": "OF",
-     *         "@id": "00:00:00:00:00:00:00:01"
+     *         "id":"00:00:00:00:00:00:00:01",
+     *         "type":"OF"
      *     },
      *     "flowStatistic": [
      *         {
@@ -306,13 +320,13 @@ public class StatisticsNorthbound {
      *                     },
      *                     {
      *                         "@type": "output",
-     *                         "port": {
-     *                             "@type": "OF",
-     *                             "@id": "5",
-     *                             "node": {
-     *                                 "@type": "OF",
-     *                                 "@id": "00:00:00:00:00:00:00:01"
-     *                             }
+     *                         "port":{
+     *                             "node":{
+     *                                 "id":"00:00:00:00:00:00:00:01",
+     *                                 "type":"OF"
+     *                              },
+     *                              "id":"5",
+     *                              "type":"OF"
      *                         }
      *                     }
      *                 ],
@@ -330,11 +344,13 @@ public class StatisticsNorthbound {
      *     ]
      * }
      *
-     *
      * Response in XML:
      * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      *     <nodeFlowStatistics>
-     *         <node type="OF" id="00:00:00:00:00:00:00:02"/>
+     *         <node>
+     *             <id>00:00:00:00:00:00:00:02</id>
+     *             <type>OF</type>
+     *         </node>
      *         <flowStatistic>
      *             <flow>
      *                 <match>
@@ -350,8 +366,13 @@ public class StatisticsNorthbound {
      *                 </match>
      *                 <actions
      *                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="output">
-     *                     <port type="OF" id="3">
-     *                         <node type="OF" id="00:00:00:00:00:00:00:02"/>
+     *                     <port>
+     *                         <node>
+     *                             <id>00:00:00:00:00:00:00:02</id>
+     *                             <type>OF</type>
+     *                         </node>
+     *                         <id>3</id>
+     *                         <type>OF</type>
      *                     </port>
      *                 </actions>
      *                 <priority>1</priority>
@@ -380,8 +401,13 @@ public class StatisticsNorthbound {
      *                 </match>
      *                 <actions
      *                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="output">
-     *                     <port type="OF" id="3">
-     *                         <node type="OF" id="00:00:00:00:00:00:00:02"/>
+     *                     <port>
+     *                         <node>
+     *                             <id>00:00:00:00:00:00:00:02</id>
+     *                             <type>OF</type>
+     *                         </node>
+     *                         <id>3</id>
+     *                         <type>OF</type>
      *                     </port>
      *                 </actions>
      *                 <priority>1</priority>
@@ -445,28 +471,30 @@ public class StatisticsNorthbound {
      * @return List of all the Port Statistics across all the NodeConnectors on
      *         all the Nodes.
      *
-     *         
+     * 
+     *
      * Example:
      *
-     * Requset URL: http://host:8080/controller/nb/v2/statistics/default/port
+     * Request URL:
+     * http://localhost:8080/controller/nb/v2/statistics/default/port
      *
      * Response in JSON:
      * {
      *     "portStatistics": [
      *         {
      *             "node": {
-     *                 "@type": "OF",
-     *                 "@id": "00:00:00:00:00:00:00:02"
+     *                  "id":"00:00:00:00:00:00:00:02",
+     *                  "type":"OF"
      *             },
      *             "portStatistic": [
      *                 {
-     *                     "nodeConnector": {
-     *                         "@type": "OF",
-     *                         "@id": "3",
-     *                         "node": {
-     *                             "@type": "OF",
-     *                             "@id": "00:00:00:00:00:00:00:02"
-     *                         }
+     *                     "nodeConnector":{
+     *                          "node":{
+     *                                 "id":"00:00:00:00:00:00:00:02",
+     *                                 "type":"OF"
+     *                           },
+     *                           "id":"3",
+     *                           "type":"OF"
      *                     },
      *                     "receivePackets": "182",
      *                     "transmitPackets": "173",
@@ -483,12 +511,12 @@ public class StatisticsNorthbound {
      *                 },
      *                 {
      *                     "nodeConnector": {
-     *                         "@type": "OF",
-     *                         "@id": "2",
-     *                         "node": {
-     *                             "@type": "OF",
-     *                             "@id": "00:00:00:00:00:00:00:02"
-     *                         }
+     *                          "node":{
+     *                                  "id":"00:00:00:00:00:00:00:02",
+     *                                  "type":"OF"
+     *                           },
+     *                           "id":"2",
+     *                           "type":"OF"
      *                     },
      *                     "receivePackets": "174",
      *                     "transmitPackets": "181",
@@ -508,8 +536,8 @@ public class StatisticsNorthbound {
      *         },
      *         {
      *             "node": {
-     *                 "@type": "OF",
-     *                 "@id": "00:00:00:00:00:00:00:03"
+     *                  "id":"00:00:00:00:00:00:00:03",
+     *                  "type":"OF"
      *             },
      *             "portStatistic": [
      *                  ..................
@@ -524,10 +552,18 @@ public class StatisticsNorthbound {
      * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      * <list>
      *     <portStatistics>
-     *         <node type="OF" id="00:00:00:00:00:00:00:02"/>
-     *         <portStatistic>
-     *             <nodeConnector type="OF" id="3">
-     *                 <node type="OF" id="00:00:00:00:00:00:00:02"/>
+     *          <node>
+     *             <id>00:00:00:00:00:00:00:02</id>
+     *             <type>OF</type>
+     *          </node>
+     *          <portStatistic>
+     *             <nodeConnector>
+     *                <node>
+     *                   <id>00:00:00:00:00:00:00:02</id>
+     *                   <type>OF</type>
+     *                </node>
+     *                <id>3</id>
+     *                <type>OF</type>
      *             </nodeConnector>
      *             <receivePackets>181</receivePackets>
      *             <transmitPackets>172</transmitPackets>
@@ -543,8 +579,13 @@ public class StatisticsNorthbound {
      *             <collisionCount>0</collisionCount>
      *         </portStatistic>
      *         <portStatistic>
-     *             <nodeConnector type="OF" id="2">
-     *                 <node type="OF" id="00:00:00:00:00:00:00:02"/>
+     *             <nodeConnector>
+     *                <node>
+     *                   <id>00:00:00:00:00:00:00:02</id>
+     *                   <type>OF</type>
+     *                </node>
+     *                <id>2</id>
+     *                <type>OF</type>
      *             </nodeConnector>
      *             <receivePackets>173</receivePackets>
      *             <transmitPackets>180</transmitPackets>
@@ -559,7 +600,6 @@ public class StatisticsNorthbound {
      *             <receiveCrcError>0</receiveCrcError>
      *             <collisionCount>0</collisionCount>
      *         </portStatistic>
-     *
      *     </portStatistics>
      * </list>
      * 
@@ -619,27 +659,28 @@ public class StatisticsNorthbound { * @return Returns a list of all the Port Statistics across all the * NodeConnectors in a given Node. * - *
+     * 
+     *
      * Example:
      *
      * Request URL:
-     * http://host:8080/controller/nb/v2/statistics/default/port/node/OF/00:00:00:00:00:00:00:01
+     * http://localhost:8080/controller/nb/v2/statistics/default/port/node/OF/00:00:00:00:00:00:00:01
      *
      * Response in JSON:
      * {
      *     "node": {
-     *         "@type": "OF",
-     *         "@id": "00:00:00:00:00:00:00:01"
+     *         "id":"00:00:00:00:00:00:00:01",
+     *         "type":"OF"
      *     },
      *     "portStatistic": [
      *         {
      *             "nodeConnector": {
-     *                 "@type": "OF",
-     *                 "@id": "3",
-     *                 "node": {
-     *                     "@type": "OF",
-     *                     "@id": "00:00:00:00:00:00:00:01"
-     *                 }
+     *                 "node":{
+     *                     "id":"00:00:00:00:00:00:00:01",
+     *                     "type":"OF"
+     *                 },
+     *                 "id":"3",
+     *                 "type":"OF"
      *             },
      *             "receivePackets": "171",
      *             "transmitPackets": "2451",
@@ -656,12 +697,12 @@ public class StatisticsNorthbound {
      *         },
      *         {
      *             "nodeConnector": {
-     *                 "@type": "OF",
-     *                 "@id": "2",
-     *                 "node": {
-     *                     "@type": "OF",
-     *                     "@id": "00:00:00:00:00:00:00:01"
-     *                 }
+     *                 "node":{
+     *                     "id":"00:00:00:00:00:00:00:01",
+     *                     "type":"OF"
+     *                 },
+     *                 "id":"2",
+     *                 "type":"OF"
      *             },
      *             "receivePackets": "179",
      *             "transmitPackets": "2443",
@@ -682,10 +723,18 @@ public class StatisticsNorthbound {
      * Response in XML:
      * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      * <nodePortStatistics>
-     *     <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *     <node>
+     *         <id>00:00:00:00:00:00:00:01</id>
+     *         <type>OF</type>
+     *     </node>
      *     <portStatistic>
-     *         <nodeConnector type="OF" id="2">
-     *             <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *         <nodeConnector>
+     *             <node>
+     *                 <id>00:00:00:00:00:00:00:01</id>
+     *                 <type>OF</type>
+     *             </node>
+     *             <id>2</id>
+     *             <type>OF</type>
      *         </nodeConnector>
      *         <receivePackets>180</receivePackets>
      *         <transmitPackets>2594</transmitPackets>
@@ -701,8 +750,13 @@ public class StatisticsNorthbound {
      *         <collisionCount>0</collisionCount>
      *     </portStatistic>
      *     <portStatistic>
-     *         <nodeConnector type="OF" id="5">
-     *             <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *         <nodeConnector>
+     *             <node>
+     *                 <id>00:00:00:00:00:00:00:01</id>
+     *                 <type>OF</type>
+     *             </node>
+     *             <id>5</id>
+     *             <type>OF</type>
      *         </nodeConnector>
      *         <receivePackets>2542</receivePackets>
      *         <transmitPackets>2719</transmitPackets>
@@ -768,30 +822,29 @@ public class StatisticsNorthbound {
      *
      * @return Returns a list of all the Table Statistics in a given Node.
      *
-     *         
+     * 
      *
-     *  Example:
-     *
-     *  Request URL:
-     *  http://host:8080/controller/nb/v2/statistics/default/table
+     * Example:
      *
-     *  Response in JSON:
+     * Request URL:
+     * http://localhost:8080/controller/nb/v2/statistics/default/table
      *
+     * Response in JSON:
      * {
      *     "tableStatistics": [
      *         {
      *             "node": {
-     *                 "@type": "OF",
-     *                 "@id": "00:00:00:00:00:00:00:02"
+     *                 "id":"00:00:00:00:00:00:00:02",
+     *                 "type":"OF"
      *             },
      *             "tableStatistic": [
      *                 {
      *                     "nodeTable": {
-     *                         "@id": "0",
-     *                         "node": {
-     *                             "@type": "OF",
-     *                             "@id": "00:00:00:00:00:00:00:02"
-     *                         }
+     *                        "node":{
+     *                           "id":"00:00:00:00:00:00:00:02",
+     *                           "type":"OF"
+     *                         },
+     *                         "id":"0"
      *                     },
      *                     "activeCount": "11",
      *                     "lookupCount": "816",
@@ -808,31 +861,45 @@ public class StatisticsNorthbound {
      *     ]
      * }
      *
-     *
      *  Response in XML:
      *  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      *  <list>
      *  <tableStatistics>
-     *      <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *      <node>
+     *          <id>00:00:00:00:00:00:00:01</id>
+     *          <type>OF</type>
+     *      </node>
      *      <tableStatistic>
-     *          <nodeTable id="0">
-     *              <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *          <nodeTable>
+     *              <node>
+     *                  <id>00:00:00:00:00:00:00:01</id>
+     *                  <type>OF</type>
+     *              </node>
+     *              <id>0</id>
      *          </nodeTable>
      *          <activeCount>12</activeCount>
      *          <lookupCount>10935</lookupCount>
      *          <matchedCount>10084</matchedCount>
      *      </tableStatistic>
      *      <tableStatistic>
-     *          <nodeTable id="1">
-     *              <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *          <nodeTable>
+     *              <node>
+     *                  <id>00:00:00:00:00:00:00:01</id>
+     *                  <type>OF</type>
+     *              </node>
+     *              <id>1</id>
      *          </nodeTable>
      *          <activeCount>0</activeCount>
      *          <lookupCount>0</lookupCount>
      *          <matchedCount>0</matchedCount>
      *      </tableStatistic>
      *      <tableStatistic>
-     *          <nodeTable id="2">
-     *              <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *          <nodeTable>
+     *              <node>
+     *                  <id>00:00:00:00:00:00:00:01</id>
+     *                  <type>OF</type>
+     *              </node>
+     *              <id>2</id>
      *          </nodeTable>
      *          <activeCount>0</activeCount>
      *          <lookupCount>0</lookupCount>
@@ -900,27 +967,27 @@ public class StatisticsNorthbound {
      *            Identifier (e.g. MAC address)
      * @return Returns a list of all the Table Statistics in a given Node.
      *
-     *         
+     * 
      *
      * Example:
      *
      * Request URL:
-     * http://host:8080/controller/nb/v2/statistics/default/table/node/OF/00:00:00:00:00:00:00:01
+     * http://localhost:8080/controller/nb/v2/statistics/default/table/node/OF/00:00:00:00:00:00:00:01
      *
      * Response in JSON:
      * {
      *     "node": {
-     *         "@type": "OF",
-     *         "@id": "00:00:00:00:00:00:00:01"
+     *         "id":"00:00:00:00:00:00:00:01",
+     *         "type":"OF"
      *     },
      *     "tableStatistic": [
      *         {
      *             "nodeTable": {
-     *                 "@id": "0",
-     *                 "node": {
-     *                     "@type": "OF",
-     *                     "@id": "00:00:00:00:00:00:00:01"
-     *                 }
+     *                 "node":{
+     *                     "id":"00:00:00:00:00:00:00:01",
+     *                     "type":"OF"
+     *                 },
+     *                 "id":"0"
      *             },
      *             "activeCount": "12",
      *             "lookupCount": "11382",
@@ -928,11 +995,11 @@ public class StatisticsNorthbound {
      *         },
      *         {
      *             "nodeTable": {
-     *                 "@id": "1",
-     *                 "node": {
-     *                     "@type": "OF",
-     *                     "@id": "00:00:00:00:00:00:00:01"
-     *                 }
+     *                 "node":{
+     *                     "id":"00:00:00:00:00:00:00:01",
+     *                     "type":"OF"
+     *                 },
+     *                 "id":"1"
      *             },
      *             "activeCount": "0",
      *             "lookupCount": "0",
@@ -944,26 +1011,41 @@ public class StatisticsNorthbound {
      * Response in XML:
      * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      * <nodeTableStatistics>
-     *     <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *     <node>
+     *          <id>00:00:00:00:00:00:00:01</id>
+     *          <type>OF</type>
+     *     </node>
      *     <tableStatistic>
-     *         <nodeTable id="0">
-     *             <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *         <nodeTable>
+     *             <node>
+     *                 <id>00:00:00:00:00:00:00:01</id>
+     *                 <type>OF</type>
+     *             </node>
+     *             <id>0</id>
      *         </nodeTable>
      *         <activeCount>12</activeCount>
      *         <lookupCount>10935</lookupCount>
      *         <matchedCount>10084</matchedCount>
      *     </tableStatistic>
      *     <tableStatistic>
-     *         <nodeTable id="1">
-     *             <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *         <nodeTable>
+     *             <node>
+     *                 <id>00:00:00:00:00:00:00:01</id>
+     *                 <type>OF</type>
+     *             </node>
+     *             <id>1</id>
      *         </nodeTable>
      *         <activeCount>0</activeCount>
      *         <lookupCount>0</lookupCount>
      *         <matchedCount>0</matchedCount>
      *     </tableStatistic>
      *     <tableStatistic>
-     *         <nodeTable id="2">
-     *             <node type="OF" id="00:00:00:00:00:00:00:01"/>
+     *         <nodeTable>
+     *             <node>
+     *                 <id>00:00:00:00:00:00:00:01</id>
+     *                 <type>OF</type>
+     *             </node>
+     *             <id>2</id>
      *         </nodeTable>
      *         <activeCount>0</activeCount>
      *         <lookupCount>0</lookupCount>
@@ -971,7 +1053,6 @@ public class StatisticsNorthbound {
      *     </tableStatistic>
      * </nodeTableStatistics>
      *
-     *
      * 
*/ @Path("/{containerName}/table/node/{nodeType}/{nodeId}") diff --git a/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthbound.java b/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthbound.java index 2765072246..a5e805d396 100644 --- a/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthbound.java +++ b/opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthbound.java @@ -53,7 +53,7 @@ public class SubnetsNorthbound { @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName(); } protected String getUserName() { diff --git a/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java b/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java index 98aa5ad94e..0f263ff38c 100644 --- a/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java +++ b/opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java @@ -62,7 +62,7 @@ public class SwitchNorthbound { @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName(); } protected String getUserName() { @@ -118,12 +118,16 @@ public class SwitchNorthbound { * Example: * * RequestURL: - * http://.../default/nodes + * http://localhost:8080/controller/nb/v2/switch/default/nodes * * Response in XML: + * <?xml version="1.0" encoding="UTF-8" standalone="yes"?> * <list> * <nodeProperties> - * <node type="OF" id="00:00:00:00:00:00:00:02"/> + * <node> + * <id>00:00:00:00:00:00:00:02</id> + * <type>OF</type> + * </node> * <properties> * <tables> * <value>-1</value> @@ -152,7 +156,7 @@ public class SwitchNorthbound { * </list> * * Response in JSON: - * {"nodeProperties":[{"node":{"@type":"OF","@id":"00:00:00:00:00:00:00:02"},"properties":{"tables":{"value":"-1"}, + * {"nodeProperties":[{"node":{"id":"00:00:00:00:00:00:00:02","type":"OF"},"properties":{"tables":{"value":"-1"}, * "description":{"value":"None"},"actions":{"value":"4095"},"macAddress":{"value":"00:00:00:00:00:02"},"capabilities" * :{"value":"199"},"timeStamp":{"value":"1377291227877","name":"connectedSince"},"buffers":{"value":"256"}}}]} * @@ -232,7 +236,7 @@ public class SwitchNorthbound { * Example: * * RequestURL: - * http://.../default/node/OF/00:00:00:00:00:00:00:03/property/description/Switch3 + * http://localhost:8080/controller/nb/v2/switch/default/node/OF/00:00:00:00:00:00:00:03/property/description/Switch3 * *
*/ @@ -310,7 +314,7 @@ public class SwitchNorthbound { * Example: * * RequestURL: - * http://.../default/node/OF/00:00:00:00:00:00:00:03/property/forwarding + * http://localhost:8080/controller/nb/v2/switch/default/node/OF/00:00:00:00:00:00:00:03/property/forwarding * *
*/ @@ -372,8 +376,8 @@ public class SwitchNorthbound { /** * - * Retrieve a list of all the nodeconnectors and their properties in a - * given node + * Retrieve a list of all the nodeconnectors and their properties in a given + * node * * @param containerName * The container for which we want to retrieve the list (Eg. @@ -395,13 +399,19 @@ public class SwitchNorthbound { * Example: * * RequestURL: - * http://.../default/node/OF/00:00:00:00:00:00:00:01 + * http://localhost:8080/controller/nb/v2/switch/default/node/OF/00:00:00:00:00:00:00:01 * * Response in XML: + * <?xml version="1.0" encoding="UTF-8" standalone="yes"?> * <list> * <nodeConnectorProperties> - * <nodeconnector type="OF" id="2"> - * <node type="OF" id="00:00:00:00:00:00:00:01"/> + * <nodeconnector> + * <node> + * <id>00:00:00:00:00:00:00:01</id> + * <type>OF</type> + * </node> + * <id>2</id> + * <type>OF</type> * </nodeconnector> * <properties> * <state> @@ -418,7 +428,7 @@ public class SwitchNorthbound { * </list> * * Response in JSON: - * {"nodeConnectorProperties":[{"nodeconnector":{"@type":"OF","@id":"2","node":{"@type":"OF","@id":"00:00:00:00:00:00:00:01"}}, + * {"nodeConnectorProperties":[{"nodeconnector":{"node":{"id":"00:00:00:00:00:00:00:01","type":"OF"},"id":"2","type":"OF"}, * "properties":{"state":{"value":"1"},"config":{"value":"1"},"name":{"value":"L1_2-C2_1"}}}]} * *
@@ -509,7 +519,7 @@ public class SwitchNorthbound { * Example: * * RequestURL: - * http://.../default/nodeconnector/OF/00:00:00:00:00:00:00:01/OF/2/property/bandwidth/1 + * http://localhost:8080/controller/nb/v2/switch/default/nodeconnector/OF/00:00:00:00:00:00:00:01/OF/2/property/bandwidth/1 * *
*/ @@ -597,7 +607,7 @@ public class SwitchNorthbound { * Example: * * RequestURL: - * http://.../default/nodeconnector/OF/00:00:00:00:00:00:00:01/OF/2/property/bandwidth + * http://localhost:8080/controller/nb/v2/switch/default/nodeconnector/OF/00:00:00:00:00:00:00:01/OF/2/property/bandwidth * *
*/ @@ -661,7 +671,7 @@ public class SwitchNorthbound { * Example: * * RequestURL: - * http://.../default/switch-config + * http://localhost:8080/controller/nb/v2/switch/default/switch-config * *
*/ diff --git a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java index 3ba1eb1843..c20cb26885 100644 --- a/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java +++ b/opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java @@ -17,7 +17,7 @@ import java.util.concurrent.ConcurrentMap; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; -import javax.ws.rs.POST; +import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -66,7 +66,7 @@ public class TopologyNorthboundJAXRS { @Context public void setSecurityContext(SecurityContext context) { - username = context.getUserPrincipal().getName(); + if (context != null && context.getUserPrincipal() != null) username = context.getUserPrincipal().getName(); } protected String getUserName() { @@ -78,12 +78,13 @@ public class TopologyNorthboundJAXRS { * Retrieve the Topology * * @param containerName - * The container for which we want to retrieve the topology (Eg. 'default') + * The container for which we want to retrieve the topology (Eg. + * 'default') * * @return A List of EdgeProps each EdgeProp represent an Edge of the grap * with the corresponding properties attached to it. * - *
+     *         
      *
      * Example:
      *
@@ -91,10 +92,87 @@ public class TopologyNorthboundJAXRS {
      * http://localhost:8080/controller/nb/v2/topology/default
      *
      * Response in XML:
-     * <?xml version="1.0" encoding="UTF-8" standalone="yes"?><topology><edgeProperties><edge><tailNodeConnector id="2" type="OF"><node id="00:00:00:00:00:00:00:02" type="OF"/></tailNodeConnector><headNodeConnector id="2" type="OF"><node id="00:00:00:00:00:00:00:51" type="OF"/></headNodeConnector></edge><properties><state><value>1</value></state><config><value>1</value></config><name><value>C1_2-L2_2</value></name><timeStamp><value>1377279422032</value><name>creation</name></timeStamp></properties></edgeProperties><edgeProperties><edge><tailNodeConnector id="2" type="OF"><node id="00:00:00:00:00:00:00:51" type="OF"/></tailNodeConnector><headNodeConnector id="2" type="OF"><node id="00:00:00:00:00:00:00:02" type="OF"/></headNodeConnector></edge><properties><state><value>1</value></state><name><value>L2_2-C1_2</value></name><config><value>1</value></config><timeStamp><value>1377279423564</value><name>creation</name></timeStamp></properties></edgeProperties></topology>
+     * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+     * <topology>
+     *     <edgeProperties>
+     *         <edge>
+     *             <tailNodeConnector>
+     *                 <node>
+     *                     <id>00:00:00:00:00:00:00:02</id>
+     *                     <type>OF</type>
+     *                 </node>
+     *                 <id>2</id>
+     *                 <type>OF</type>
+     *             </tailNodeConnector>
+     *             <headNodeConnector>
+     *                 <node>
+     *                     <id>00:00:00:00:00:00:00:51</id>
+     *                     <type>OF</type>
+     *                 </node>
+     *                 <id>2</id>
+     *                 <type>OF</type>
+     *             </headNodeConnector>
+     *         </edge>
+     *         <properties>
+     *             <state>
+     *                 <value>1</value>
+     *             </state>
+     *             <config>
+     *                 <value>1</value>
+     *             </config>
+     *             <name>
+     *                 <value>C1_2-L2_2</value>
+     *             </name>
+     *             <timeStamp>
+     *                 <value>1377279422032</value>
+     *                 <name>creation</name>
+     *             </timeStamp>
+     *         </properties>
+     *     </edgeProperties>
+     *     <edgeProperties>
+     *         <edge>
+     *             <tailNodeConnector>
+     *                 <node>
+     *                     <id>00:00:00:00:00:00:00:51</id>
+     *                     <type>OF</type>
+     *                 </node>
+     *                 <id>2</id>
+     *                 <type>OF</type>
+     *             </tailNodeConnector>
+     *             <headNodeConnector>
+     *                 <node>
+     *                     <id>00:00:00:00:00:00:00:02</id>
+     *                     <type>OF</type>
+     *                 </node>
+     *                 <id>2</id>
+     *                 <type>OF</type>
+     *             </headNodeConnector>
+     *         </edge>
+     *         <properties>
+     *             <state>
+     *                 <value>1</value>
+     *             </state>
+     *             <name>
+     *                 <value>L2_2-C1_2</value>
+     *             </name>
+     *             <config>
+     *                 <value>1</value>
+     *             </config>
+     *             <timeStamp>
+     *                 <value>1377279423564</value>
+     *                 <name>creation</name>
+     *             </timeStamp>
+     *         </properties>
+     *     </edgeProperties>
+     * </topology>
      *
      * Response in JSON:
-     * {"edgeProperties":[{"edge":{"tailNodeConnector":{"@id":"2","@type":"OF","node":{"@id":"00:00:00:00:00:00:00:02","@type":"OF"}},"headNodeConnector":{"@id":"2","@type":"OF","node":{"@id":"00:00:00:00:00:00:00:51","@type":"OF"}}},"properties":{"timeStamp":{"value":"1377278961017","name":"creation"}}},{"edge":{"tailNodeConnector":{"@id":"2","@type":"OF","node":{"@id":"00:00:00:00:00:00:00:51","@type":"OF"}},"headNodeConnector":{"@id":"2","@type":"OF","node":{"@id":"00:00:00:00:00:00:00:02","@type":"OF"}}},"properties":{"timeStamp":{"value":"1377278961018","name":"creation"}}}]}
+     * {"edgeProperties":[{"edge":{"tailNodeConnector":{"node":{"id":"00:00:00:00:00:00:00:02","type":"OF"},
+     * "id":"2","type":"OF"},"headNodeConnector":{"node":{"id":"00:00:00:00:00:00:00:51","type":"OF"},"id":
+     * "2","type":"OF"}},"properties":{"timeStamp":{"value":"1377278961017","name":"creation"}}},
+     * {"edge":{"tailNodeConnector":{"node":{"id":"00:00:00:00:00:00:00:51","type":"OF"},"id":
+     * "2","type":"OF"}},"headNodeConnector":{"node":{"id":"00:00:00:00:00:00:00:02","type":"OF"},
+     * "id":"2","type":"OF"}},"properties":{"timeStamp":{"value":"1377278961018","name":"creation"}}}]}
      *
      * 
*/ @@ -148,10 +226,19 @@ public class TopologyNorthboundJAXRS { * http://localhost:8080/controller/nb/v2/topology/default/user-link * * Response in XML: - * <?xml version="1.0" encoding="UTF-8" standalone="yes"?><topologyUserLinks><userLinks><status>Success</status><name>link1</name><srcNodeConnector>OF|2@OF|00:00:00:00:00:00:00:02</srcNodeConnector><dstNodeConnector>OF|2@OF|00:00:00:00:00:00:00:51</dstNodeConnector></userLinks></topologyUserLinks> + * <?xml version="1.0" encoding="UTF-8" standalone="yes"?> + * <topologyUserLinks> + * <userLinks> + * <status>Success</status> + * <name>link1</name> + * <srcNodeConnector>OF|2@OF|00:00:00:00:00:00:00:02</srcNodeConnector> + * <dstNodeConnector>OF|2@OF|00:00:00:00:00:00:00:51</dstNodeConnector> + * </userLinks> + * </topologyUserLinks> * * Response in JSON: - * {"userLinks":{"status":"Success","name":"link1","srcNodeConnector":"OF|2@OF|00:00:00:00:00:00:00:02","dstNodeConnector":"OF|2@OF|00:00:00:00:00:00:00:51"}} + * {"userLinks":{"status":"Success","name":"link1","srcNodeConnector": + * "OF|2@OF|00:00:00:00:00:00:00:02","dstNodeConnector":"OF|2@OF|00:00:00:00:00:00:00:51"}} * *
*/ @@ -201,10 +288,16 @@ public class TopologyNorthboundJAXRS { * Example: * * RequestURL: - * http://localhost:8080/controller/nb/v2/topology/default/user-link/config1-content + * http://localhost:8080/controller/nb/v2/topology/default/user-link * * Request in XML: - * <?xml version="1.0" encoding="UTF-8" standalone="yes"?><topologyUserLinks><status>Success</status><name>link1</name><srcNodeConnector>OF|2@OF|00:00:00:00:00:00:00:02</srcNodeConnector><dstNodeConnector>OF|2@OF|00:00:00:00:00:00:00:51</dstNodeConnector></topologyUserLinks> + * <?xml version="1.0" encoding="UTF-8" standalone="yes"?> + * <topologyUserLinks> + * <status>Success</status> + * <name>link1</name> + * <srcNodeConnector>OF|2@OF|00:00:00:00:00:00:00:02</srcNodeConnector> + * <dstNodeConnector>OF|2@OF|00:00:00:00:00:00:00:51</dstNodeConnector> + * </topologyUserLinks> * * Request in JSON: * {"status":"Success","name":"link1","srcNodeConnector":"OF|2@OF|00:00:00:00:00:00:00:02","dstNodeConnector":"OF|2@OF|00:00:00:00:00:00:00:51"} @@ -212,7 +305,7 @@ public class TopologyNorthboundJAXRS { *
*/ @Path("/{containerName}/user-link") - @POST + @PUT @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @StatusCodes({ diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Node.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Node.java index 5a71ab8a69..d21a147506 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Node.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Node.java @@ -27,6 +27,7 @@ import java.util.concurrent.ConcurrentHashMap; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.opendaylight.controller.sal.utils.HexEncode; @@ -197,7 +198,7 @@ public class Node implements Serializable { * * @return The node Type for this Node object */ - @XmlAttribute(name = "type") + @XmlElement(name = "type") public String getType() { return this.nodeType; } @@ -266,7 +267,7 @@ public class Node implements Serializable { * * @return The nodeID in string format */ - @XmlAttribute(name = "id") + @XmlElement(name = "id") public String getNodeIDString() { if (this.nodeType.equals(NodeIDType.OPENFLOW)) { return HexEncode.longToHexString((Long) this.nodeID); diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeConnector.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeConnector.java index 9c49a31508..85a6c22c56 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeConnector.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeConnector.java @@ -279,7 +279,7 @@ public class NodeConnector implements Serializable { * * @return the NodeConnectorType of this object */ - @XmlAttribute(name = "type") + @XmlElement(name = "type") public String getType() { return this.nodeConnectorType; } @@ -362,7 +362,7 @@ public class NodeConnector implements Serializable { * * @return the NodeConnector ID of this object in String format */ - @XmlAttribute(name = "id") + @XmlElement(name = "id") public String getNodeConnectorIDString() { return this.nodeConnectorID.toString(); } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeTable.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeTable.java index 68ff9b4f38..7b7f1ccaea 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeTable.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeTable.java @@ -206,7 +206,7 @@ public class NodeTable implements Serializable { /** * @return the nodeTableIDString */ - @XmlAttribute(name = "id") + @XmlElement(name = "id") public String getNodeTableIDString() { return this.nodeTableIDString != null? this.nodeTableIDString : nodeTableID.toString(); } diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java index 30c25af57f..b6381cc7d8 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java @@ -354,7 +354,7 @@ public class Match implements Cloneable, Serializable { .getSubnetMaskLength(thisMask); int otherMaskLen = (otherMask == null) ? ((otherAddress instanceof Inet4Address) ? 32 : 128) : NetUtils .getSubnetMaskLength(otherMask); - if (otherMaskLen < thisMaskLen) { + if (thisMaskLen < otherMaskLen) { intersection.setField(new MatchField(type, NetUtils.getSubnetPrefix(otherAddress, otherMaskLen), otherMask)); } else { diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java index f3c7a95b0e..e3333cf78c 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java @@ -532,6 +532,8 @@ public class MatchTest { InetAddress ipm2 = InetAddress.getByName("255.255.255.0"); InetAddress ip3 = InetAddress.getByName("1.3.0.0"); InetAddress ipm3 = InetAddress.getByName("255.255.0.0"); + InetAddress ip4 = InetAddress.getByName("1.3.4.4"); + InetAddress ipm4 = InetAddress.getByName("255.255.255.0"); Match m1 = new Match(); m1.setField(MatchType.DL_TYPE, ethType); @@ -562,8 +564,9 @@ public class MatchTest { Match i = m1.getIntersection(m2); Assert.assertTrue(((Short)i.getField(MatchType.DL_TYPE).getValue()).equals(ethType)); - Assert.assertTrue(((InetAddress)i.getField(MatchType.NW_SRC).getValue()).equals(ip2)); - Assert.assertTrue(((InetAddress)i.getField(MatchType.NW_SRC).getMask()).equals(ipm2)); + // Verify intersection of IP addresses is correct + Assert.assertTrue(((InetAddress)i.getField(MatchType.NW_SRC).getValue()).equals(ip1)); + Assert.assertNull(i.getField(MatchType.NW_SRC).getMask()); // Empty set i = m2.getIntersection(m3); @@ -572,8 +575,14 @@ public class MatchTest { Match m4 = new Match(); m4.setField(MatchType.DL_TYPE, ethType); m4.setField(MatchType.NW_PROTO, IPProtocols.TCP.byteValue()); + m3.setField(MatchType.NW_SRC, ip4, ipm4); Assert.assertTrue(m4.intersetcs(m3)); + // Verify intersection of IP and IP mask addresses is correct + Match ii = m3.getIntersection(m4); + Assert.assertTrue(((InetAddress)ii.getField(MatchType.NW_SRC).getValue()).equals(ip4)); + Assert.assertTrue(((InetAddress)ii.getField(MatchType.NW_SRC).getMask()).equals(ipm4)); + Match m5 = new Match(); m5.setField(MatchType.DL_TYPE, ethType); m3.setField(MatchType.NW_SRC, ip3, ipm3);