Merge "toaster-it: add missing version for maven-paxexam-plugin"
authorMadhu Venugopal <vmadhu@cisco.com>
Sat, 31 Aug 2013 13:12:27 +0000 (13:12 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sat, 31 Aug 2013 13:12:27 +0000 (13:12 +0000)
16 files changed:
.gitignore
opendaylight/distribution/opendaylight/src/main/resources/configuration/context.xml
opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java
opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java
opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java
opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthbound.java
opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java
opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthbound.java
opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthbound.java
opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java
opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Node.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeConnector.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/NodeTable.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/match/Match.java
opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/match/MatchTest.java

index 52881a3..53ea040 100644 (file)
@@ -1,6 +1,6 @@
 *.class
 **/target
-**/bin
+bin/
 dist
 **/logs
 products
index 32b9dd3..2d270b4 100644 (file)
@@ -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 {
      *     &#x20;&#x20;&#x20;&lt;flowConfig&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;installInHw&gt;true&lt;/installInHw&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;name&gt;flow1&lt;/name&gt;
-     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;node id="00:00:00:00:00:00:00:01" type="OF"/&gt;
+     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;node&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;type&gt;OF&lt;/type&gt;
+     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;/node&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;ingressPort&gt;1&lt;/ingressPort&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;priority&gt;500&lt;/priority&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;etherType&gt;0x800&lt;/etherType&gt;
@@ -176,7 +179,7 @@ public class FlowProgrammerNorthbound {
      * &lt;/list&gt;
      *
      * 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"}}
      *
      * </pre>
@@ -228,7 +231,10 @@ public class FlowProgrammerNorthbound {
      *     &#x20;&#x20;&#x20;&lt;flowConfig&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;installInHw&gt;true&lt;/installInHw&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;name&gt;flow1&lt;/name&gt;
-     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;node id="00:00:00:00:00:00:00:01" type="OF"/&gt;
+     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;node&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;type&gt;OF&lt;/type&gt;
+     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;/node&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;ingressPort&gt;1&lt;/ingressPort&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;priority&gt;500&lt;/priority&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;etherType&gt;0x800&lt;/etherType&gt;
@@ -238,7 +244,7 @@ public class FlowProgrammerNorthbound {
      * &lt;/list&gt;
      *
      * 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"}}
      *
      * </pre>
@@ -297,7 +303,10 @@ public class FlowProgrammerNorthbound {
      * &lt;flowConfig&gt;
      *     &#x20;&#x20;&#x20;&lt;installInHw&gt;true&lt;/installInHw&gt;
      *     &#x20;&#x20;&#x20;&lt;name&gt;flow1&lt;/name&gt;
-     *     &#x20;&#x20;&#x20;&lt;node id="00:00:00:00:00:00:00:01" type="OF"/&gt;
+     *     &#x20;&#x20;&#x20;&lt;node&gt;
+     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;type&gt;OF&lt;/type&gt;
+     *     &#x20;&#x20;&#x20;&lt;/node&gt;
      *     &#x20;&#x20;&#x20;&lt;ingressPort&gt;1&lt;/ingressPort&gt;
      *     &#x20;&#x20;&#x20;&lt;priority&gt;500&lt;/priority&gt;
      *     &#x20;&#x20;&#x20;&lt;etherType&gt;0x800&lt;/etherType&gt;
@@ -306,7 +315,7 @@ public class FlowProgrammerNorthbound {
      * &lt;/flowConfig&gt;
      *
      * 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"}
      *
      * </pre>
@@ -373,7 +382,10 @@ public class FlowProgrammerNorthbound {
      * &lt;flowConfig&gt;
      *         &#x20;&#x20;&#x20;&lt;installInHw&gt;true&lt;/installInHw&gt;
      *         &#x20;&#x20;&#x20;&lt;name&gt;flow1&lt;/name&gt;
-     *         &#x20;&#x20;&#x20;&lt;node id="00:00:00:00:00:00:00:01" type="OF"/&gt;
+     *         &#x20;&#x20;&#x20;&lt;node&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;type&gt;OF&lt;/type&gt;
+     *         &#x20;&#x20;&#x20;&lt;/node&gt;
      *         &#x20;&#x20;&#x20;&lt;ingressPort&gt;1&lt;/ingressPort&gt;
      *         &#x20;&#x20;&#x20;&lt;priority&gt;500&lt;/priority&gt;
      *         &#x20;&#x20;&#x20;&lt;etherType&gt;0x800&lt;/etherType&gt;
@@ -382,7 +394,7 @@ public class FlowProgrammerNorthbound {
      * &lt;/flowConfig&gt;
      *
      * 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"}
      *
      * </pre>
index 2530d78..7694611 100644 (file)
@@ -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() {
index b8229cf..f4adc71 100644 (file)
@@ -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()
index 6b785b8..da7faa2 100644 (file)
@@ -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.
      * <pre>
+     *
      * Example :
-     * Request : PUT http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/mgmt1/1.1.1.1/6634
-     * Response : Node :
-     *                  xml : &lt;node type="STUB" id="mgmt1"/&gt;
-     *                  json: {"@type": "STUB","@id": "mgmt1"}
+     *
+     * Request :
+     * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/connect/mgmt1/1.1.1.1/6634
+     *
+     * Response :
+     * Node :
+     * xml :
+     * &lt;node&gt;
+     *    &lt;id&gt;mgmt1&lt;/id&gt;
+     *    &lt;type&gt;STUB&lt;/type&gt;
+     * &lt;/node&gt;
+     *
+     * json:
+     * {"id": "mgmt1","type": "STUB"}
+     *
      *</pre>
      * @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.
      * <pre>
+     *
      * 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 : &lt;node type="STUB" id="mgmt1"/&gt;
-     *                  json: {"@type": "STUB","@id": "mgmt1"}
+     * xml :
+     * &lt;node&gt;
+     *    &lt;id&gt;mgmt1&lt;/id&gt;
+     *    &lt;type&gt;STUB&lt;/type&gt;
+     * &lt;/node&gt;
+     *
+     * json:
+     * {"id": "mgmt1","type": "STUB"}
+     *
      *</pre>
      * @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.
      * <pre>
+     *
      * 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
+     *
      *</pre>
      * @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
     * <pre>
+    *
     * 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
+    *
     *</pre>
     * @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
     * <pre>
+    *
     * Example :
-    * Request : POST http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port2/200
-    *</pre>
+    * Request :
+    * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port2/200
+    *
+    * </pre>
     * @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.
index dceafac..8462ef8 100644 (file)
@@ -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;
index 1c3fd1c..a07f643 100644 (file)
@@ -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
      *
-     *         <pre>
+     * <pre>
+     *
      * 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:
      * &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
      * &lt;list&gt;
      *     &lt;flowStatistics&gt;
-     *         &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:02&quot;/&gt;
+     *         &lt;node&gt;
+     *             &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *             &lt;type&gt;OF&lt;/type&gt;
+     *         &lt;/node&gt;
      *         &lt;flowStatistic&gt;
      *             &lt;flow&gt;
      *                 &lt;match&gt;
@@ -191,8 +198,13 @@ public class StatisticsNorthbound {
      *                 &lt;/match&gt;
      *                 &lt;actions
      *                     xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;output&quot;&gt;
-     *                     &lt;port type=&quot;OF&quot; id=&quot;3&quot;&gt;
-     *                         &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:02&quot;/&gt;
+     *                     &lt;port&gt;
+     *                         &lt;node&gt;
+     *                             &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *                             &lt;type&gt;OF&lt;/type&gt;
+     *                         &lt;/node&gt;
+     *                         &lt;id&gt;3&lt;/id&gt;
+     *                         &lt;type&gt;OF&lt;/type&gt;
      *                     &lt;/port&gt;
      *                 &lt;/actions&gt;
      *                 &lt;priority&gt;1&lt;/priority&gt;
@@ -272,16 +284,18 @@ public class StatisticsNorthbound {
      *            Node Identifier
      * @return List of Flow Statistics for a given Node. *
      *
-     *         <pre>
+     * <pre>
+     *
      * 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:
      * &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
      *     &lt;nodeFlowStatistics&gt;
-     *         &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:02&quot;/&gt;
+     *         &lt;node&gt;
+     *             &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *             &lt;type&gt;OF&lt;/type&gt;
+     *         &lt;/node&gt;
      *         &lt;flowStatistic&gt;
      *             &lt;flow&gt;
      *                 &lt;match&gt;
@@ -350,8 +366,13 @@ public class StatisticsNorthbound {
      *                 &lt;/match&gt;
      *                 &lt;actions
      *                     xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;output&quot;&gt;
-     *                     &lt;port type=&quot;OF&quot; id=&quot;3&quot;&gt;
-     *                         &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:02&quot;/&gt;
+     *                     &lt;port&gt;
+     *                         &lt;node&gt;
+     *                             &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *                             &lt;type&gt;OF&lt;/type&gt;
+     *                         &lt;/node&gt;
+     *                         &lt;id&gt;3&lt;/id&gt;
+     *                         &lt;type&gt;OF&lt;/type&gt;
      *                     &lt;/port&gt;
      *                 &lt;/actions&gt;
      *                 &lt;priority&gt;1&lt;/priority&gt;
@@ -380,8 +401,13 @@ public class StatisticsNorthbound {
      *                 &lt;/match&gt;
      *                 &lt;actions
      *                     xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:type=&quot;output&quot;&gt;
-     *                     &lt;port type=&quot;OF&quot; id=&quot;3&quot;&gt;
-     *                         &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:02&quot;/&gt;
+     *                     &lt;port&gt;
+     *                         &lt;node&gt;
+     *                             &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *                             &lt;type&gt;OF&lt;/type&gt;
+     *                         &lt;/node&gt;
+     *                         &lt;id&gt;3&lt;/id&gt;
+     *                         &lt;type&gt;OF&lt;/type&gt;
      *                     &lt;/port&gt;
      *                 &lt;/actions&gt;
      *                 &lt;priority&gt;1&lt;/priority&gt;
@@ -445,28 +471,30 @@ public class StatisticsNorthbound {
      * @return List of all the Port Statistics across all the NodeConnectors on
      *         all the Nodes.
      *
-     *         <pre>
+     * <pre>
+     *
      * 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 {
      * &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
      * &lt;list&gt;
      *     &lt;portStatistics&gt;
-     *         &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:02&quot;/&gt;
-     *         &lt;portStatistic&gt;
-     *             &lt;nodeConnector type=&quot;OF&quot; id=&quot;3&quot;&gt;
-     *                 &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:02&quot;/&gt;
+     *          &lt;node&gt;
+     *             &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *             &lt;type&gt;OF&lt;/type&gt;
+     *          &lt;/node&gt;
+     *          &lt;portStatistic&gt;
+     *             &lt;nodeConnector&gt;
+     *                &lt;node&gt;
+     *                   &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *                   &lt;type&gt;OF&lt;/type&gt;
+     *                &lt;/node&gt;
+     *                &lt;id&gt;3&lt;/id&gt;
+     *                &lt;type&gt;OF&lt;/type&gt;
      *             &lt;/nodeConnector&gt;
      *             &lt;receivePackets&gt;181&lt;/receivePackets&gt;
      *             &lt;transmitPackets&gt;172&lt;/transmitPackets&gt;
@@ -543,8 +579,13 @@ public class StatisticsNorthbound {
      *             &lt;collisionCount&gt;0&lt;/collisionCount&gt;
      *         &lt;/portStatistic&gt;
      *         &lt;portStatistic&gt;
-     *             &lt;nodeConnector type=&quot;OF&quot; id=&quot;2&quot;&gt;
-     *                 &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:02&quot;/&gt;
+     *             &lt;nodeConnector&gt;
+     *                &lt;node&gt;
+     *                   &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *                   &lt;type&gt;OF&lt;/type&gt;
+     *                &lt;/node&gt;
+     *                &lt;id&gt;2&lt;/id&gt;
+     *                &lt;type&gt;OF&lt;/type&gt;
      *             &lt;/nodeConnector&gt;
      *             &lt;receivePackets&gt;173&lt;/receivePackets&gt;
      *             &lt;transmitPackets&gt;180&lt;/transmitPackets&gt;
@@ -559,7 +600,6 @@ public class StatisticsNorthbound {
      *             &lt;receiveCrcError&gt;0&lt;/receiveCrcError&gt;
      *             &lt;collisionCount&gt;0&lt;/collisionCount&gt;
      *         &lt;/portStatistic&gt;
-     *
      *     &lt;/portStatistics&gt;
      * &lt;/list&gt;
      * </pre>
@@ -619,27 +659,28 @@ public class StatisticsNorthbound {
      * @return Returns a list of all the Port Statistics across all the
      *         NodeConnectors in a given Node.
      *
-     *         <pre>
+     * <pre>
+     *
      * 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:
      * &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
      * &lt;nodePortStatistics&gt;
-     *     &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *     &lt;node&gt;
+     *         &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *         &lt;type&gt;OF&lt;/type&gt;
+     *     &lt;/node&gt;
      *     &lt;portStatistic&gt;
-     *         &lt;nodeConnector type=&quot;OF&quot; id=&quot;2&quot;&gt;
-     *             &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *         &lt;nodeConnector&gt;
+     *             &lt;node&gt;
+     *                 &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *                 &lt;type&gt;OF&lt;/type&gt;
+     *             &lt;/node&gt;
+     *             &lt;id&gt;2&lt;/id&gt;
+     *             &lt;type&gt;OF&lt;/type&gt;
      *         &lt;/nodeConnector&gt;
      *         &lt;receivePackets&gt;180&lt;/receivePackets&gt;
      *         &lt;transmitPackets&gt;2594&lt;/transmitPackets&gt;
@@ -701,8 +750,13 @@ public class StatisticsNorthbound {
      *         &lt;collisionCount&gt;0&lt;/collisionCount&gt;
      *     &lt;/portStatistic&gt;
      *     &lt;portStatistic&gt;
-     *         &lt;nodeConnector type=&quot;OF&quot; id=&quot;5&quot;&gt;
-     *             &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *         &lt;nodeConnector&gt;
+     *             &lt;node&gt;
+     *                 &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *                 &lt;type&gt;OF&lt;/type&gt;
+     *             &lt;/node&gt;
+     *             &lt;id&gt;5&lt;/id&gt;
+     *             &lt;type&gt;OF&lt;/type&gt;
      *         &lt;/nodeConnector&gt;
      *         &lt;receivePackets&gt;2542&lt;/receivePackets&gt;
      *         &lt;transmitPackets&gt;2719&lt;/transmitPackets&gt;
@@ -768,30 +822,29 @@ public class StatisticsNorthbound {
      *
      * @return Returns a list of all the Table Statistics in a given Node.
      *
-     *         <pre>
+     * <pre>
      *
-     *  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:
      *  &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
      *  &lt;list&gt;
      *  &lt;tableStatistics&gt;
-     *      &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *      &lt;node&gt;
+     *          &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *          &lt;type&gt;OF&lt;/type&gt;
+     *      &lt;/node&gt;
      *      &lt;tableStatistic&gt;
-     *          &lt;nodeTable id=&quot;0&quot;&gt;
-     *              &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *          &lt;nodeTable&gt;
+     *              &lt;node&gt;
+     *                  &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *                  &lt;type&gt;OF&lt;/type&gt;
+     *              &lt;/node&gt;
+     *              &lt;id&gt;0&lt;/id&gt;
      *          &lt;/nodeTable&gt;
      *          &lt;activeCount&gt;12&lt;/activeCount&gt;
      *          &lt;lookupCount&gt;10935&lt;/lookupCount&gt;
      *          &lt;matchedCount&gt;10084&lt;/matchedCount&gt;
      *      &lt;/tableStatistic&gt;
      *      &lt;tableStatistic&gt;
-     *          &lt;nodeTable id=&quot;1&quot;&gt;
-     *              &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *          &lt;nodeTable&gt;
+     *              &lt;node&gt;
+     *                  &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *                  &lt;type&gt;OF&lt;/type&gt;
+     *              &lt;/node&gt;
+     *              &lt;id&gt;1&lt;/id&gt;
      *          &lt;/nodeTable&gt;
      *          &lt;activeCount&gt;0&lt;/activeCount&gt;
      *          &lt;lookupCount&gt;0&lt;/lookupCount&gt;
      *          &lt;matchedCount&gt;0&lt;/matchedCount&gt;
      *      &lt;/tableStatistic&gt;
      *      &lt;tableStatistic&gt;
-     *          &lt;nodeTable id=&quot;2&quot;&gt;
-     *              &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *          &lt;nodeTable&gt;
+     *              &lt;node&gt;
+     *                  &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *                  &lt;type&gt;OF&lt;/type&gt;
+     *              &lt;/node&gt;
+     *              &lt;id&gt;2&lt;/id&gt;
      *          &lt;/nodeTable&gt;
      *          &lt;activeCount&gt;0&lt;/activeCount&gt;
      *          &lt;lookupCount&gt;0&lt;/lookupCount&gt;
@@ -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.
      *
-     *         <pre>
+     * <pre>
      *
      * 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:
      * &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
      * &lt;nodeTableStatistics&gt;
-     *     &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *     &lt;node&gt;
+     *          &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *          &lt;type&gt;OF&lt;/type&gt;
+     *     &lt;/node&gt;
      *     &lt;tableStatistic&gt;
-     *         &lt;nodeTable id=&quot;0&quot;&gt;
-     *             &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *         &lt;nodeTable&gt;
+     *             &lt;node&gt;
+     *                 &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *                 &lt;type&gt;OF&lt;/type&gt;
+     *             &lt;/node&gt;
+     *             &lt;id&gt;0&lt;/id&gt;
      *         &lt;/nodeTable&gt;
      *         &lt;activeCount&gt;12&lt;/activeCount&gt;
      *         &lt;lookupCount&gt;10935&lt;/lookupCount&gt;
      *         &lt;matchedCount&gt;10084&lt;/matchedCount&gt;
      *     &lt;/tableStatistic&gt;
      *     &lt;tableStatistic&gt;
-     *         &lt;nodeTable id=&quot;1&quot;&gt;
-     *             &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *         &lt;nodeTable&gt;
+     *             &lt;node&gt;
+     *                 &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *                 &lt;type&gt;OF&lt;/type&gt;
+     *             &lt;/node&gt;
+     *             &lt;id&gt;1&lt;/id&gt;
      *         &lt;/nodeTable&gt;
      *         &lt;activeCount&gt;0&lt;/activeCount&gt;
      *         &lt;lookupCount&gt;0&lt;/lookupCount&gt;
      *         &lt;matchedCount&gt;0&lt;/matchedCount&gt;
      *     &lt;/tableStatistic&gt;
      *     &lt;tableStatistic&gt;
-     *         &lt;nodeTable id=&quot;2&quot;&gt;
-     *             &lt;node type=&quot;OF&quot; id=&quot;00:00:00:00:00:00:00:01&quot;/&gt;
+     *         &lt;nodeTable&gt;
+     *             &lt;node&gt;
+     *                 &lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *                 &lt;type&gt;OF&lt;/type&gt;
+     *             &lt;/node&gt;
+     *             &lt;id&gt;2&lt;/id&gt;
      *         &lt;/nodeTable&gt;
      *         &lt;activeCount&gt;0&lt;/activeCount&gt;
      *         &lt;lookupCount&gt;0&lt;/lookupCount&gt;
@@ -971,7 +1053,6 @@ public class StatisticsNorthbound {
      *     &lt;/tableStatistic&gt;
      * &lt;/nodeTableStatistics&gt;
      *
-     *
      * </pre>
      */
     @Path("/{containerName}/table/node/{nodeType}/{nodeId}")
index 2765072..a5e805d 100644 (file)
@@ -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() {
index 98aa5ad..0f263ff 100644 (file)
@@ -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:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
      * &lt;list&gt;
      *     &#x20;&#x20;&#x20;&lt;nodeProperties&gt;
-     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;node type="OF" id="00:00:00:00:00:00:00:02"/&gt;
+     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;node&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;type&gt;OF&lt;/type&gt;
+     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;/node&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;properties&gt;
      *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;tables&gt;
      *                 &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;value&gt;-1&lt;/value&gt;
@@ -152,7 +156,7 @@ public class SwitchNorthbound {
      * &lt;/list&gt;
      *
      * 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
      *
      * </pre>
      */
@@ -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
      *
      * </pre>
      */
@@ -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:
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
      * &lt;list&gt;
      *     &#x20;&#x20;&#x20;&lt;nodeConnectorProperties&gt;
-     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;nodeconnector type="OF" id="2"&gt;
-     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;node type="OF" id="00:00:00:00:00:00:00:01"/&gt;
+     *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;nodeconnector&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;node&gt;
+     *                 &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;id&gt;00:00:00:00:00:00:00:01&lt;/id&gt;
+     *                 &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;type&gt;OF&lt;/type&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;/node&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;id&gt;2&lt;/id&gt;
+     *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;type&gt;OF&lt;/type&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;/nodeconnector&gt;
      *         &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;properties&gt;
      *             &#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&#x20;&lt;state&gt;
@@ -418,7 +428,7 @@ public class SwitchNorthbound {
      * &lt;/list&gt;
      *
      * 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"}}}]}
      *
      * </pre>
@@ -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
      *
      * </pre>
      */
@@ -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
      *
      * </pre>
      */
@@ -661,7 +671,7 @@ public class SwitchNorthbound {
      * Example:
      *
      * RequestURL:
-     * http://.../default/switch-config
+     * http://localhost:8080/controller/nb/v2/switch/default/switch-config
      *
      * </pre>
      */
index 3ba1eb1..c20cb26 100644 (file)
@@ -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.
      *
-     * <pre>
+     *         <pre>
      *
      * Example:
      *
@@ -91,10 +92,87 @@ public class TopologyNorthboundJAXRS {
      * http://localhost:8080/controller/nb/v2/topology/default
      *
      * Response in XML:
-     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;topology&gt;&lt;edgeProperties&gt;&lt;edge&gt;&lt;tailNodeConnector id="2" type="OF"&gt;&lt;node id="00:00:00:00:00:00:00:02" type="OF"/&gt;&lt;/tailNodeConnector&gt;&lt;headNodeConnector id="2" type="OF"&gt;&lt;node id="00:00:00:00:00:00:00:51" type="OF"/&gt;&lt;/headNodeConnector&gt;&lt;/edge&gt;&lt;properties&gt;&lt;state&gt;&lt;value&gt;1&lt;/value&gt;&lt;/state&gt;&lt;config&gt;&lt;value&gt;1&lt;/value&gt;&lt;/config&gt;&lt;name&gt;&lt;value&gt;C1_2-L2_2&lt;/value&gt;&lt;/name&gt;&lt;timeStamp&gt;&lt;value&gt;1377279422032&lt;/value&gt;&lt;name&gt;creation&lt;/name&gt;&lt;/timeStamp&gt;&lt;/properties&gt;&lt;/edgeProperties&gt;&lt;edgeProperties&gt;&lt;edge&gt;&lt;tailNodeConnector id="2" type="OF"&gt;&lt;node id="00:00:00:00:00:00:00:51" type="OF"/&gt;&lt;/tailNodeConnector&gt;&lt;headNodeConnector id="2" type="OF"&gt;&lt;node id="00:00:00:00:00:00:00:02" type="OF"/&gt;&lt;/headNodeConnector&gt;&lt;/edge&gt;&lt;properties&gt;&lt;state&gt;&lt;value&gt;1&lt;/value&gt;&lt;/state&gt;&lt;name&gt;&lt;value&gt;L2_2-C1_2&lt;/value&gt;&lt;/name&gt;&lt;config&gt;&lt;value&gt;1&lt;/value&gt;&lt;/config&gt;&lt;timeStamp&gt;&lt;value&gt;1377279423564&lt;/value&gt;&lt;name&gt;creation&lt;/name&gt;&lt;/timeStamp&gt;&lt;/properties&gt;&lt;/edgeProperties&gt;&lt;/topology&gt;
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * &lt;topology&gt;
+     *     &lt;edgeProperties&gt;
+     *         &lt;edge&gt;
+     *             &lt;tailNodeConnector&gt;
+     *                 &lt;node&gt;
+     *                     &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *                     &lt;type&gt;OF&lt;/type&gt;
+     *                 &lt;/node&gt;
+     *                 &lt;id&gt;2&lt;/id&gt;
+     *                 &lt;type&gt;OF&lt;/type&gt;
+     *             &lt;/tailNodeConnector&gt;
+     *             &lt;headNodeConnector&gt;
+     *                 &lt;node&gt;
+     *                     &lt;id&gt;00:00:00:00:00:00:00:51&lt;/id&gt;
+     *                     &lt;type&gt;OF&lt;/type&gt;
+     *                 &lt;/node&gt;
+     *                 &lt;id&gt;2&lt;/id&gt;
+     *                 &lt;type&gt;OF&lt;/type&gt;
+     *             &lt;/headNodeConnector&gt;
+     *         &lt;/edge&gt;
+     *         &lt;properties&gt;
+     *             &lt;state&gt;
+     *                 &lt;value&gt;1&lt;/value&gt;
+     *             &lt;/state&gt;
+     *             &lt;config&gt;
+     *                 &lt;value&gt;1&lt;/value&gt;
+     *             &lt;/config&gt;
+     *             &lt;name&gt;
+     *                 &lt;value&gt;C1_2-L2_2&lt;/value&gt;
+     *             &lt;/name&gt;
+     *             &lt;timeStamp&gt;
+     *                 &lt;value&gt;1377279422032&lt;/value&gt;
+     *                 &lt;name&gt;creation&lt;/name&gt;
+     *             &lt;/timeStamp&gt;
+     *         &lt;/properties&gt;
+     *     &lt;/edgeProperties&gt;
+     *     &lt;edgeProperties&gt;
+     *         &lt;edge&gt;
+     *             &lt;tailNodeConnector&gt;
+     *                 &lt;node&gt;
+     *                     &lt;id&gt;00:00:00:00:00:00:00:51&lt;/id&gt;
+     *                     &lt;type&gt;OF&lt;/type&gt;
+     *                 &lt;/node&gt;
+     *                 &lt;id&gt;2&lt;/id&gt;
+     *                 &lt;type&gt;OF&lt;/type&gt;
+     *             &lt;/tailNodeConnector&gt;
+     *             &lt;headNodeConnector&gt;
+     *                 &lt;node&gt;
+     *                     &lt;id&gt;00:00:00:00:00:00:00:02&lt;/id&gt;
+     *                     &lt;type&gt;OF&lt;/type&gt;
+     *                 &lt;/node&gt;
+     *                 &lt;id&gt;2&lt;/id&gt;
+     *                 &lt;type&gt;OF&lt;/type&gt;
+     *             &lt;/headNodeConnector&gt;
+     *         &lt;/edge&gt;
+     *         &lt;properties&gt;
+     *             &lt;state&gt;
+     *                 &lt;value&gt;1&lt;/value&gt;
+     *             &lt;/state&gt;
+     *             &lt;name&gt;
+     *                 &lt;value&gt;L2_2-C1_2&lt;/value&gt;
+     *             &lt;/name&gt;
+     *             &lt;config&gt;
+     *                 &lt;value&gt;1&lt;/value&gt;
+     *             &lt;/config&gt;
+     *             &lt;timeStamp&gt;
+     *                 &lt;value&gt;1377279423564&lt;/value&gt;
+     *                 &lt;name&gt;creation&lt;/name&gt;
+     *             &lt;/timeStamp&gt;
+     *         &lt;/properties&gt;
+     *     &lt;/edgeProperties&gt;
+     * &lt;/topology&gt;
      *
      * 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"}}}]}
      *
      * </pre>
      */
@@ -148,10 +226,19 @@ public class TopologyNorthboundJAXRS {
      * http://localhost:8080/controller/nb/v2/topology/default/user-link
      *
      * Response in XML:
-     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;topologyUserLinks&gt;&lt;userLinks&gt;&lt;status&gt;Success&lt;/status&gt;&lt;name&gt;link1&lt;/name&gt;&lt;srcNodeConnector&gt;OF|2@OF|00:00:00:00:00:00:00:02&lt;/srcNodeConnector&gt;&lt;dstNodeConnector&gt;OF|2@OF|00:00:00:00:00:00:00:51&lt;/dstNodeConnector&gt;&lt;/userLinks&gt;&lt;/topologyUserLinks&gt;
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * &lt;topologyUserLinks&gt;
+     * &lt;userLinks&gt;
+     * &lt;status&gt;Success&lt;/status&gt;
+     * &lt;name&gt;link1&lt;/name&gt;
+     * &lt;srcNodeConnector&gt;OF|2@OF|00:00:00:00:00:00:00:02&lt;/srcNodeConnector&gt;
+     * &lt;dstNodeConnector&gt;OF|2@OF|00:00:00:00:00:00:00:51&lt;/dstNodeConnector&gt;
+     * &lt;/userLinks&gt;
+     * &lt;/topologyUserLinks&gt;
      *
      * 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"}}
      *
      * </pre>
      */
@@ -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:
-     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;topologyUserLinks&gt;&lt;status&gt;Success&lt;/status&gt;&lt;name&gt;link1&lt;/name&gt;&lt;srcNodeConnector&gt;OF|2@OF|00:00:00:00:00:00:00:02&lt;/srcNodeConnector&gt;&lt;dstNodeConnector&gt;OF|2@OF|00:00:00:00:00:00:00:51&lt;/dstNodeConnector&gt;&lt;/topologyUserLinks&gt;
+     * &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
+     * &lt;topologyUserLinks&gt;
+     * &lt;status&gt;Success&lt;/status&gt;
+     * &lt;name&gt;link1&lt;/name&gt;
+     * &lt;srcNodeConnector&gt;OF|2@OF|00:00:00:00:00:00:00:02&lt;/srcNodeConnector&gt;
+     * &lt;dstNodeConnector&gt;OF|2@OF|00:00:00:00:00:00:00:51&lt;/dstNodeConnector&gt;
+     * &lt;/topologyUserLinks&gt;
      *
      * 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 {
      * </pre>
      */
     @Path("/{containerName}/user-link")
-    @POST
+    @PUT
     @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
     @StatusCodes({
index 5a71ab8..d21a147 100644 (file)
@@ -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);
index 9c49a31..85a6c22 100644 (file)
@@ -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();
     }
index 68ff9b4..7b7f1cc 100644 (file)
@@ -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();
     }
index 30c25af..b6381cc 100644 (file)
@@ -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 {
index f3c7a95..e3333cf 100644 (file)
@@ -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);

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.