*    <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>
* </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"}}
*
* </pre>
*    <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>
* </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"}}
*
* </pre>
* <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>
* </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"}
*
* </pre>
* <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>
* </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"}
*
* </pre>
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");
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 {
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");
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");
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");
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");
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")) {
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);
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);
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;
}
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);
.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()
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;
* 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 : <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"}
+ *
*</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.
* 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 : <node type="STUB" id="mgmt1"/>
- * json: {"@type": "STUB","@id": "mgmt1"}
+ * xml :
+ * <node>
+ * <id>mgmt1</id>
+ * <type>STUB</type>
+ * </node>
+ *
+ * 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.
/**
* 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.
/**
* 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.
/**
* 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.
* 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": [
* {
* "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",
*
* ]
* }
+ *
* 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>
* </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>
* 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": [
* {
* },
* {
* "@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"
* }
* }
* ],
* ]
* }
*
- *
* 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>
* </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>
* </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>
* @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",
* },
* {
* "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",
* },
* {
* "node": {
- * "@type": "OF",
- * "@id": "00:00:00:00:00:00:00:03"
+ * "id":"00:00:00:00:00:00:00:03",
+ * "type":"OF"
* },
* "portStatistic": [
* ..................
* <?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>
* <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>
* <receiveCrcError>0</receiveCrcError>
* <collisionCount>0</collisionCount>
* </portStatistic>
- *
* </portStatistics>
* </list>
* </pre>
* @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",
* },
* {
* "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",
* 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>
* <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>
*
* @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",
* ]
* }
*
- *
* 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>
* 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",
* },
* {
* "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",
* 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>
* </tableStatistic>
* </nodeTableStatistics>
*
- *
* </pre>
*/
@Path("/{containerName}/table/node/{nodeType}/{nodeId}")
* 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>
* </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"}}}]}
*
* 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>
*/
* 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>
*/
/**
*
- * 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.
* 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>
* </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"}}}]}
*
* </pre>
* 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>
*/
* 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>
*/
* Example:
*
* RequestURL:
- * http://.../default/switch-config
+ * http://localhost:8080/controller/nb/v2/switch/default/switch-config
*
* </pre>
*/
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;
* 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:
*
* 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"}}}]}
*
* </pre>
*/
* 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"}}
*
* </pre>
*/
* 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"}
* </pre>
*/
@Path("/{containerName}/user-link")
- @POST
+ @PUT
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@StatusCodes({
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;
*
* @return The node Type for this Node object
*/
- @XmlAttribute(name = "type")
+ @XmlElement(name = "type")
public String getType() {
return this.nodeType;
}
*
* @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);
*
* @return the NodeConnectorType of this object
*/
- @XmlAttribute(name = "type")
+ @XmlElement(name = "type")
public String getType() {
return this.nodeConnectorType;
}
*
* @return the NodeConnector ID of this object in String format
*/
- @XmlAttribute(name = "id")
+ @XmlElement(name = "id")
public String getNodeConnectorIDString() {
return this.nodeConnectorID.toString();
}
/**
* @return the nodeTableIDString
*/
- @XmlAttribute(name = "id")
+ @XmlElement(name = "id")
public String getNodeTableIDString() {
return this.nodeTableIDString != null? this.nodeTableIDString : nodeTableID.toString();
}