1 package org.opendaylight.controller.northbound.integrationtest;
3 import static org.junit.Assert.assertFalse;
4 import static org.junit.Assert.assertNotNull;
5 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
6 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
7 import static org.ops4j.pax.exam.CoreOptions.options;
8 import static org.ops4j.pax.exam.CoreOptions.systemPackages;
9 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
11 import java.util.ArrayList;
12 import java.util.Arrays;
13 import java.util.HashMap;
14 import java.util.HashSet;
15 import java.util.List;
18 import javax.inject.Inject;
20 import org.apache.commons.codec.binary.Base64;
21 import org.codehaus.jettison.json.JSONArray;
22 import org.codehaus.jettison.json.JSONException;
23 import org.codehaus.jettison.json.JSONObject;
24 import org.codehaus.jettison.json.JSONTokener;
25 import org.junit.Assert;
26 import org.junit.Before;
27 import org.junit.Test;
28 import org.junit.runner.RunWith;
29 import org.opendaylight.controller.commons.httpclient.HTTPClient;
30 import org.opendaylight.controller.commons.httpclient.HTTPRequest;
31 import org.opendaylight.controller.commons.httpclient.HTTPResponse;
32 import org.opendaylight.controller.hosttracker.IfIptoHost;
33 import org.opendaylight.controller.sal.core.Bandwidth;
34 import org.opendaylight.controller.sal.core.ConstructionException;
35 import org.opendaylight.controller.sal.core.Edge;
36 import org.opendaylight.controller.sal.core.Latency;
37 import org.opendaylight.controller.sal.core.Node;
38 import org.opendaylight.controller.sal.core.NodeConnector;
39 import org.opendaylight.controller.sal.core.Property;
40 import org.opendaylight.controller.sal.core.State;
41 import org.opendaylight.controller.sal.core.UpdateType;
42 import org.opendaylight.controller.sal.topology.IListenTopoUpdates;
43 import org.opendaylight.controller.sal.topology.TopoEdgeUpdate;
44 import org.opendaylight.controller.switchmanager.IInventoryListener;
45 import org.opendaylight.controller.usermanager.IUserManager;
46 import org.ops4j.pax.exam.Configuration;
47 import org.ops4j.pax.exam.Option;
48 import org.ops4j.pax.exam.junit.PaxExam;
49 import org.ops4j.pax.exam.util.PathUtils;
50 import org.osgi.framework.Bundle;
51 import org.osgi.framework.BundleContext;
52 import org.osgi.framework.ServiceReference;
53 import org.slf4j.Logger;
54 import org.slf4j.LoggerFactory;
56 @RunWith(PaxExam.class)
57 public class NorthboundIT {
58 private final Logger log = LoggerFactory.getLogger(NorthboundIT.class);
59 // get the OSGI bundle context
61 private BundleContext bc;
62 private IUserManager userManager = null;
63 private IInventoryListener invtoryListener = null;
64 private IListenTopoUpdates topoUpdates = null;
65 private static final String baseUrlPrefix = "http://127.0.0.1:8080/controller/nb/v2/";
66 private final Boolean debugMsg = false;
68 private String stateToString(int state) {
72 case Bundle.INSTALLED:
76 case Bundle.UNINSTALLED:
79 return "Not CONVERTED";
84 public void areWeReady() {
86 boolean debugit = false;
87 Bundle b[] = bc.getBundles();
88 for (Bundle element : b) {
89 int state = element.getState();
90 if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {
91 log.debug("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state));
96 log.debug("Do some debugging because some bundle is " + "unresolved");
98 // Assert if true, if false we are good to go!
101 ServiceReference r = bc.getServiceReference(IUserManager.class.getName());
103 this.userManager = (IUserManager) bc.getService(r);
105 // If UserManager is null, cannot login to run tests.
106 assertNotNull(this.userManager);
108 r = bc.getServiceReference(IfIptoHost.class.getName());
110 this.invtoryListener = (IInventoryListener) bc.getService(r);
113 // If inventoryListener is null, cannot run hosttracker tests.
114 assertNotNull(this.invtoryListener);
116 r = bc.getServiceReference(IListenTopoUpdates.class.getName());
118 this.topoUpdates = (IListenTopoUpdates) bc.getService(r);
121 // If topologyManager is null, cannot run topology North tests.
122 assertNotNull(this.topoUpdates);
126 // static variable to pass response code from getJsonResult()
127 private static Integer httpResponseCode = null;
129 private String getJsonResult(String restUrl) {
130 return getJsonResult(restUrl, "GET", null);
133 private String getJsonResult(String restUrl, String method) {
134 return getJsonResult(restUrl, method, null);
137 private String getJsonResult(String restUrl, String method, String body) {
138 // initialize response code to indicate error
139 httpResponseCode = 400;
142 System.out.println("HTTP method: " + method + " url: " + restUrl.toString());
144 System.out.println("body: " + body);
149 this.userManager.getAuthorizationList();
150 this.userManager.authenticate("admin", "admin");
151 HTTPRequest request = new HTTPRequest();
153 request.setUri(restUrl);
154 request.setMethod(method);
155 request.setTimeout(0); // HostTracker doesn't respond
156 // within default timeout during
157 // IT so setting an indefinite
158 // timeout till the issue is
161 Map<String, List<String>> headers = new HashMap<String, List<String>>();
162 String authString = "admin:admin";
163 byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
164 String authStringEnc = new String(authEncBytes);
165 List<String> header = new ArrayList<String>();
166 header.add("Basic "+authStringEnc);
167 headers.put("Authorization", header);
168 header = new ArrayList<String>();
169 header.add("application/json");
170 headers.put("Accept", header);
171 request.setHeaders(headers);
172 request.setContentType("application/json");
174 request.setEntity(body);
177 HTTPResponse response = HTTPClient.sendRequest(request);
179 // Response code for success should be 2xx
180 httpResponseCode = response.getStatus();
181 if (httpResponseCode > 299) {
182 return httpResponseCode.toString();
186 System.out.println("HTTP response code: " + response.getStatus());
187 System.out.println("HTTP response message: " + response.getEntity());
189 return response.getEntity();
190 } catch (Exception e) {
198 private void testNodeProperties(JSONObject node, Integer nodeId, String nodeType, Integer timestamp,
199 String timestampName, Integer actionsValue, Integer capabilitiesValue, Integer tablesValue,
200 Integer buffersValue) throws JSONException {
202 JSONObject nodeInfo = node.getJSONObject("node");
203 Assert.assertEquals(nodeId, (Integer) nodeInfo.getInt("id"));
204 Assert.assertEquals(nodeType, nodeInfo.getString("type"));
206 JSONObject properties = node.getJSONObject("properties");
208 if (timestamp == null || timestampName == null) {
209 Assert.assertFalse(properties.has("timeStamp"));
211 Assert.assertEquals(timestamp, (Integer) properties.getJSONObject("timeStamp").getInt("value"));
212 Assert.assertEquals(timestampName, properties.getJSONObject("timeStamp").getString("name"));
214 if (actionsValue == null) {
215 Assert.assertFalse(properties.has("actions"));
217 Assert.assertEquals(actionsValue, (Integer) properties.getJSONObject("actions").getInt("value"));
219 if (capabilitiesValue == null) {
220 Assert.assertFalse(properties.has("capabilities"));
222 Assert.assertEquals(capabilitiesValue,
223 (Integer) properties.getJSONObject("capabilities").getInt("value"));
225 if (tablesValue == null) {
226 Assert.assertFalse(properties.has("tables"));
228 Assert.assertEquals(tablesValue, (Integer) properties.getJSONObject("tables").getInt("value"));
230 if (buffersValue == null) {
231 Assert.assertFalse(properties.has("buffers"));
233 Assert.assertEquals(buffersValue, (Integer) properties.getJSONObject("buffers").getInt("value"));
237 private void testNodeConnectorProperties(JSONObject nodeConnectorProperties, Integer ncId, String ncType,
238 Integer nodeId, String nodeType, Integer state, Integer capabilities, Integer bandwidth)
239 throws JSONException {
241 JSONObject nodeConnector = nodeConnectorProperties.getJSONObject("nodeconnector");
242 JSONObject node = nodeConnector.getJSONObject("node");
243 JSONObject properties = nodeConnectorProperties.getJSONObject("properties");
245 Assert.assertEquals(ncId, (Integer) nodeConnector.getInt("id"));
246 Assert.assertEquals(ncType, nodeConnector.getString("type"));
247 Assert.assertEquals(nodeId, (Integer) node.getInt("id"));
248 Assert.assertEquals(nodeType, node.getString("type"));
250 Assert.assertFalse(properties.has("state"));
252 Assert.assertEquals(state, (Integer) properties.getJSONObject("state").getInt("value"));
254 if (capabilities == null) {
255 Assert.assertFalse(properties.has("capabilities"));
257 Assert.assertEquals(capabilities,
258 (Integer) properties.getJSONObject("capabilities").getInt("value"));
260 if (bandwidth == null) {
261 Assert.assertFalse(properties.has("bandwidth"));
263 Assert.assertEquals(bandwidth, (Integer) properties.getJSONObject("bandwidth").getInt("value"));
268 public void testSubnetsNorthbound() throws JSONException, ConstructionException {
269 System.out.println("Starting Subnets JAXB client.");
270 String baseURL = baseUrlPrefix + "subnetservice/";
272 String name1 = "testSubnet1";
273 String subnet1 = "1.1.1.1/24";
275 String name2 = "testSubnet2";
276 String subnet2 = "2.2.2.2/24";
278 String name3 = "testSubnet3";
279 String subnet3 = "3.3.3.3/24";
282 * Create the node connector string list for the two subnets as:
283 * portList2 = {"OF|1@OF|00:00:00:00:00:00:00:02", "OF|2@OF|00:00:00:00:00:00:00:02", "OF|3@OF|00:00:00:00:00:00:00:02", "OF|4@OF|00:00:00:00:00:00:00:02"};
284 * portList3 = {"OF|1@OF|00:00:00:00:00:00:00:03", "OF|2@OF|00:00:00:00:00:00:00:03", "OF|3@OF|00:00:00:00:00:00:00:03"};
286 Node node2 = new Node(Node.NodeIDType.OPENFLOW, 2L);
287 List<String> portList2 = new ArrayList<String>();
288 NodeConnector nc21 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)1, node2);
289 NodeConnector nc22 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)2, node2);
290 NodeConnector nc23 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)3, node2);
291 NodeConnector nc24 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)3, node2);
292 portList2.add(nc21.toString());
293 portList2.add(nc22.toString());
294 portList2.add(nc23.toString());
295 portList2.add(nc24.toString());
297 List<String> portList3 = new ArrayList<String>();
298 Node node3 = new Node(Node.NodeIDType.OPENFLOW, 3L);
299 NodeConnector nc31 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)1, node3);
300 NodeConnector nc32 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)2, node3);
301 NodeConnector nc33 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)3, node3);
302 portList3.add(nc31.toString());
303 portList3.add(nc32.toString());
304 portList3.add(nc33.toString());
306 // Test GET subnets in default container
307 String result = getJsonResult(baseURL + "default/subnets");
308 JSONTokener jt = new JSONTokener(result);
309 JSONObject json = new JSONObject(jt);
310 JSONArray subnetConfigs = json.getJSONArray("subnetConfig");
311 Assert.assertEquals(subnetConfigs.length(), 1); // should only get the default subnet
313 // Test GET subnet1 expecting 404
314 result = getJsonResult(baseURL + "default/subnet/" + name1);
315 Assert.assertEquals(404, httpResponseCode.intValue());
318 JSONObject jo = new JSONObject().put("name", name1).put("subnet", subnet1);
319 // execute HTTP request and verify response code
320 result = getJsonResult(baseURL + "default/subnet/" + name1, "PUT", jo.toString());
321 Assert.assertTrue(httpResponseCode == 201);
324 result = getJsonResult(baseURL + "default/subnet/" + name1);
325 jt = new JSONTokener(result);
326 json = new JSONObject(jt);
327 Assert.assertEquals(200, httpResponseCode.intValue());
328 Assert.assertEquals(name1, json.getString("name"));
329 Assert.assertEquals(subnet1, json.getString("subnet"));
332 JSONObject jo2 = new JSONObject().put("name", name2).put("subnet", subnet2).put("nodeConnectors", portList2);
333 // execute HTTP request and verify response code
334 result = getJsonResult(baseURL + "default/subnet/" + name2, "PUT", jo2.toString());
335 Assert.assertEquals(201, httpResponseCode.intValue());
337 JSONObject jo3 = new JSONObject().put("name", name3).put("subnet", subnet3);
338 // execute HTTP request and verify response code
339 result = getJsonResult(baseURL + "default/subnet/" + name3, "PUT", jo3.toString());
340 Assert.assertEquals(201, httpResponseCode.intValue());
341 // Test POST subnet3 (modify port list: add)
342 JSONObject jo3New = new JSONObject().put("name", name3).put("subnet", subnet3).put("nodeConnectors", portList3);
343 // execute HTTP request and verify response code
344 result = getJsonResult(baseURL + "default/subnet/" + name3, "POST", jo3New.toString());
345 Assert.assertEquals(200, httpResponseCode.intValue());
347 // Test GET all subnets in default container
348 result = getJsonResult(baseURL + "default/subnets");
349 jt = new JSONTokener(result);
350 json = new JSONObject(jt);
351 JSONArray subnetConfigArray = json.getJSONArray("subnetConfig");
352 JSONObject subnetConfig;
353 Assert.assertEquals(3, subnetConfigArray.length());
354 for (int i = 0; i < subnetConfigArray.length(); i++) {
355 subnetConfig = subnetConfigArray.getJSONObject(i);
356 if (subnetConfig.getString("name").equals(name1)) {
357 Assert.assertEquals(subnet1, subnetConfig.getString("subnet"));
358 } else if (subnetConfig.getString("name").equals(name2)) {
359 Assert.assertEquals(subnet2, subnetConfig.getString("subnet"));
360 JSONArray portListGet = subnetConfig.getJSONArray("nodeConnectors");
361 Assert.assertEquals(portList2.get(0), portListGet.get(0));
362 Assert.assertEquals(portList2.get(1), portListGet.get(1));
363 Assert.assertEquals(portList2.get(2), portListGet.get(2));
364 Assert.assertEquals(portList2.get(3), portListGet.get(3));
365 } else if (subnetConfig.getString("name").equals(name3)) {
366 Assert.assertEquals(subnet3, subnetConfig.getString("subnet"));
367 JSONArray portListGet = subnetConfig.getJSONArray("nodeConnectors");
368 Assert.assertEquals(portList3.get(0), portListGet.get(0));
369 Assert.assertEquals(portList3.get(1), portListGet.get(1));
370 Assert.assertEquals(portList3.get(2), portListGet.get(2));
372 // Unexpected config name
373 Assert.assertTrue(false);
377 // Test POST subnet2 (modify port list: remove one port only)
378 List<String> newPortList2 = new ArrayList<String>(portList2);
379 newPortList2.remove(3);
380 JSONObject jo2New = new JSONObject().put("name", name2).put("subnet", subnet2).put("nodeConnectors", newPortList2);
381 // execute HTTP request and verify response code
382 result = getJsonResult(baseURL + "default/subnet/" + name2, "POST", jo2New.toString());
383 Assert.assertEquals(200, httpResponseCode.intValue());
385 // Test GET subnet2: verify contains only the first three ports
386 result = getJsonResult(baseURL + "default/subnet/" + name2);
387 jt = new JSONTokener(result);
388 subnetConfig = new JSONObject(jt);
389 Assert.assertEquals(200, httpResponseCode.intValue());
390 JSONArray portListGet2 = subnetConfig.getJSONArray("nodeConnectors");
391 Assert.assertEquals(portList2.get(0), portListGet2.get(0));
392 Assert.assertEquals(portList2.get(1), portListGet2.get(1));
393 Assert.assertEquals(portList2.get(2), portListGet2.get(2));
394 Assert.assertTrue(portListGet2.length() == 3);
396 // Test DELETE subnet1
397 result = getJsonResult(baseURL + "default/subnet/" + name1, "DELETE");
398 Assert.assertEquals(204, httpResponseCode.intValue());
400 // Test GET deleted subnet1
401 result = getJsonResult(baseURL + "default/subnet/" + name1);
402 Assert.assertEquals(404, httpResponseCode.intValue());
404 // TEST PUT bad subnet, expect 400, validate JSON exception mapper
405 JSONObject joBad = new JSONObject().put("foo", "bar");
406 result = getJsonResult(baseURL + "default/subnet/foo", "PUT", joBad.toString());
407 Assert.assertEquals(400, httpResponseCode.intValue());
411 public void testStaticRoutingNorthbound() throws JSONException {
412 System.out.println("Starting StaticRouting JAXB client.");
413 String baseURL = baseUrlPrefix + "staticroute/";
415 String name1 = "testRoute1";
416 String prefix1 = "192.168.1.1/24";
417 String nextHop1 = "0.0.0.0";
418 String name2 = "testRoute2";
419 String prefix2 = "192.168.1.1/16";
420 String nextHop2 = "1.1.1.1";
422 // Test GET static routes in default container, expecting no results
423 String result = getJsonResult(baseURL + "default/routes");
424 JSONTokener jt = new JSONTokener(result);
425 JSONObject json = new JSONObject(jt);
426 JSONArray staticRoutes = json.getJSONArray("staticRoute");
427 Assert.assertEquals(staticRoutes.length(), 0);
429 // Test insert static route
430 String requestBody = "{\"name\":\"" + name1 + "\", \"prefix\":\"" + prefix1 + "\", \"nextHop\":\"" + nextHop1
432 result = getJsonResult(baseURL + "default/route/" + name1, "PUT", requestBody);
433 Assert.assertEquals(201, httpResponseCode.intValue());
435 requestBody = "{\"name\":\"" + name2 + "\", \"prefix\":\"" + prefix2 + "\", \"nextHop\":\"" + nextHop2 + "\"}";
436 result = getJsonResult(baseURL + "default/route/" + name2, "PUT", requestBody);
437 Assert.assertEquals(201, httpResponseCode.intValue());
439 // Test Get all static routes
440 result = getJsonResult(baseURL + "default/routes");
441 jt = new JSONTokener(result);
442 json = new JSONObject(jt);
443 JSONArray staticRouteArray = json.getJSONArray("staticRoute");
444 Assert.assertEquals(2, staticRouteArray.length());
446 for (int i = 0; i < staticRoutes.length(); i++) {
447 route = staticRoutes.getJSONObject(i);
448 if (route.getString("name").equals(name1)) {
449 Assert.assertEquals(prefix1, route.getString("prefix"));
450 Assert.assertEquals(nextHop1, route.getString("nextHop"));
451 } else if (route.getString("name").equals(name2)) {
452 Assert.assertEquals(prefix2, route.getString("prefix"));
453 Assert.assertEquals(nextHop2, route.getString("nextHop"));
455 // static route has unknown name
456 Assert.assertTrue(false);
460 // Test get specific static route
461 result = getJsonResult(baseURL + "default/route/" + name1);
462 jt = new JSONTokener(result);
463 json = new JSONObject(jt);
465 Assert.assertEquals(name1, json.getString("name"));
466 Assert.assertEquals(prefix1, json.getString("prefix"));
467 Assert.assertEquals(nextHop1, json.getString("nextHop"));
469 result = getJsonResult(baseURL + "default/route/" + name2);
470 jt = new JSONTokener(result);
471 json = new JSONObject(jt);
473 Assert.assertEquals(name2, json.getString("name"));
474 Assert.assertEquals(prefix2, json.getString("prefix"));
475 Assert.assertEquals(nextHop2, json.getString("nextHop"));
477 // Test delete static route
478 result = getJsonResult(baseURL + "default/route/" + name1, "DELETE");
479 Assert.assertEquals(204, httpResponseCode.intValue());
481 result = getJsonResult(baseURL + "default/routes");
482 jt = new JSONTokener(result);
483 json = new JSONObject(jt);
485 staticRouteArray = json.getJSONArray("staticRoute");
486 JSONObject singleStaticRoute = staticRouteArray.getJSONObject(0);
487 Assert.assertEquals(name2, singleStaticRoute.getString("name"));
492 public void testSwitchManager() throws JSONException {
493 System.out.println("Starting SwitchManager JAXB client.");
494 String baseURL = baseUrlPrefix + "switchmanager/default/";
496 // define Node/NodeConnector attributes for test
497 int nodeId_1 = 51966;
500 int nodeConnectorId_1 = 51966;
501 int nodeConnectorId_2 = 12;
502 int nodeConnectorId_3 = 34;
503 String nodeType = "STUB";
504 String ncType = "STUB";
505 int timestamp_1 = 100000;
506 String timestampName_1 = "connectedSince";
507 int actionsValue_1 = 2;
508 int capabilitiesValue_1 = 3;
509 int tablesValue_1 = 1;
510 int buffersValue_1 = 1;
512 int ncCapabilities = 1;
513 int ncBandwidth = 1000000000;
515 // Test GET all nodes
517 String result = getJsonResult(baseURL + "nodes");
518 JSONTokener jt = new JSONTokener(result);
519 JSONObject json = new JSONObject(jt);
521 // Test for first node
522 JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1);
523 Assert.assertNotNull(node);
524 testNodeProperties(node, nodeId_1, nodeType, timestamp_1, timestampName_1, actionsValue_1, capabilitiesValue_1,
525 tablesValue_1, buffersValue_1);
527 // Test 2nd node, properties of 2nd node same as first node
528 node = getJsonInstance(json, "nodeProperties", nodeId_2);
529 Assert.assertNotNull(node);
530 testNodeProperties(node, nodeId_2, nodeType, timestamp_1, timestampName_1, actionsValue_1, capabilitiesValue_1,
531 tablesValue_1, buffersValue_1);
533 // Test 3rd node, properties of 3rd node same as first node
534 node = getJsonInstance(json, "nodeProperties", nodeId_3);
535 Assert.assertNotNull(node);
536 testNodeProperties(node, nodeId_3, nodeType, timestamp_1, timestampName_1, actionsValue_1, capabilitiesValue_1,
537 tablesValue_1, buffersValue_1);
539 // Test GET nodeConnectors of a node
541 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
542 jt = new JSONTokener(result);
543 json = new JSONObject(jt);
544 JSONArray nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
545 JSONObject nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
547 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, ncState,
548 ncCapabilities, ncBandwidth);
551 result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
552 jt = new JSONTokener(result);
553 json = new JSONObject(jt);
555 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
556 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
559 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
560 ncCapabilities, ncBandwidth);
563 result = getJsonResult(baseURL + "node/STUB/" + nodeId_3);
564 jt = new JSONTokener(result);
565 json = new JSONObject(jt);
567 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
568 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
569 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_3, ncType, nodeId_3, nodeType, ncState,
570 ncCapabilities, ncBandwidth);
572 // Test add property to node
573 // Add Tier and Description property to node1
574 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 + "/property/tier/1001", "PUT");
575 Assert.assertEquals(201, httpResponseCode.intValue());
576 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 + "/property/description/node1", "PUT");
577 Assert.assertEquals(201, httpResponseCode.intValue());
579 // Test for first node
580 result = getJsonResult(baseURL + "nodes");
581 jt = new JSONTokener(result);
582 json = new JSONObject(jt);
583 node = getJsonInstance(json, "nodeProperties", nodeId_1);
584 Assert.assertNotNull(node);
585 Assert.assertEquals(1001, node.getJSONObject("properties").getJSONObject("tier").getInt("value"));
586 Assert.assertEquals("node1", node.getJSONObject("properties").getJSONObject("description").getString("value"));
588 // Test delete nodeConnector property
589 // Delete state property of nodeconnector1
590 result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1 + "/STUB/" + nodeConnectorId_1
591 + "/property/state", "DELETE");
592 Assert.assertEquals(204, httpResponseCode.intValue());
594 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
595 jt = new JSONTokener(result);
596 json = new JSONObject(jt);
597 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
598 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
600 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, null,
601 ncCapabilities, ncBandwidth);
603 // Delete capabilities property of nodeconnector2
604 result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_2 + "/STUB/" + nodeConnectorId_2
605 + "/property/capabilities", "DELETE");
606 Assert.assertEquals(204, httpResponseCode.intValue());
608 result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
609 jt = new JSONTokener(result);
610 json = new JSONObject(jt);
611 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
612 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
614 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
617 // Test PUT nodeConnector property
618 int newBandwidth = 1001;
620 // Add Name/Bandwidth property to nodeConnector1
621 result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1 + "/STUB/" + nodeConnectorId_1
622 + "/property/bandwidth/" + newBandwidth, "PUT");
623 Assert.assertEquals(201, httpResponseCode.intValue());
625 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
626 jt = new JSONTokener(result);
627 json = new JSONObject(jt);
628 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
629 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
631 // Check for new bandwidth value, state value removed from previous
633 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, null,
634 ncCapabilities, newBandwidth);
639 public void testStatistics() throws JSONException {
640 final String actionTypes[] = { "DROP", "LOOPBACK", "FLOOD", "FLOOD_ALL", "CONTROLLER", "SW_PATH", "HW_PATH", "OUTPUT",
641 "SET_DL_SRC", "SET_DL_DST", "SET_DL_TYPE", "SET_VLAN_ID", "SET_VLAN_PCP", "SET_VLAN_CFI", "POP_VLAN", "PUSH_VLAN",
642 "SET_NW_SRC", "SET_NW_DST", "SET_NW_TOS", "SET_TP_SRC", "SET_TP_DST" };
643 System.out.println("Starting Statistics JAXB client.");
645 String baseURL = baseUrlPrefix + "statistics/default/";
647 String result = getJsonResult(baseURL + "flow");
648 JSONTokener jt = new JSONTokener(result);
649 JSONObject json = new JSONObject(jt);
650 JSONObject flowStatistics = getJsonInstance(json, "flowStatistics", 0xCAFE);
651 JSONObject node = flowStatistics.getJSONObject("node");
652 // test that node was returned properly
653 Assert.assertTrue(node.getInt("id") == 0xCAFE);
654 Assert.assertEquals(node.getString("type"), "STUB");
656 // test that flow statistics results are correct
657 JSONArray flowStats = flowStatistics.getJSONArray("flowStatistic");
658 for (int i = 0; i < flowStats.length(); i++) {
660 JSONObject flowStat = flowStats.getJSONObject(i);
661 testFlowStat(flowStat, actionTypes[i], i);
665 // for /controller/nb/v2/statistics/default/port
666 result = getJsonResult(baseURL + "port");
667 jt = new JSONTokener(result);
668 json = new JSONObject(jt);
669 JSONObject portStatistics = getJsonInstance(json, "portStatistics", 0xCAFE);
670 JSONObject node2 = portStatistics.getJSONObject("node");
671 // test that node was returned properly
672 Assert.assertTrue(node2.getInt("id") == 0xCAFE);
673 Assert.assertEquals(node2.getString("type"), "STUB");
675 // test that port statistic results are correct
676 JSONArray portStatArray = portStatistics.getJSONArray("portStatistic");
677 JSONObject portStat = portStatArray.getJSONObject(0);
678 Assert.assertTrue(portStat.getInt("receivePackets") == 250);
679 Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
680 Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
681 Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
682 Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
683 Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
684 Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
685 Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
686 Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
687 Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
688 Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
689 Assert.assertTrue(portStat.getInt("collisionCount") == 4);
691 // test for getting one specific node's stats
692 result = getJsonResult(baseURL + "flow/node/STUB/51966");
693 jt = new JSONTokener(result);
694 json = new JSONObject(jt);
695 node = json.getJSONObject("node");
696 // test that node was returned properly
697 Assert.assertTrue(node.getInt("id") == 0xCAFE);
698 Assert.assertEquals(node.getString("type"), "STUB");
700 // test that flow statistics results are correct
701 flowStats = json.getJSONArray("flowStatistic");
702 for (int i = 0; i < flowStats.length(); i++) {
703 JSONObject flowStat = flowStats.getJSONObject(i);
704 testFlowStat(flowStat, actionTypes[i], i);
707 result = getJsonResult(baseURL + "port/node/STUB/51966");
708 jt = new JSONTokener(result);
709 json = new JSONObject(jt);
710 node2 = json.getJSONObject("node");
711 // test that node was returned properly
712 Assert.assertTrue(node2.getInt("id") == 0xCAFE);
713 Assert.assertEquals(node2.getString("type"), "STUB");
715 // test that port statistic results are correct
716 portStatArray = json.getJSONArray("portStatistic");
717 portStat = portStatArray.getJSONObject(0);
719 Assert.assertTrue(portStat.getInt("receivePackets") == 250);
720 Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
721 Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
722 Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
723 Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
724 Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
725 Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
726 Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
727 Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
728 Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
729 Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
730 Assert.assertTrue(portStat.getInt("collisionCount") == 4);
733 private void testFlowStat(JSONObject flowStat, String actionType, int actIndex) throws JSONException {
734 Assert.assertTrue(flowStat.getInt("tableId") == 1);
735 Assert.assertTrue(flowStat.getInt("durationSeconds") == 40);
736 Assert.assertTrue(flowStat.getInt("durationNanoseconds") == 400);
737 Assert.assertTrue(flowStat.getInt("packetCount") == 200);
738 Assert.assertTrue(flowStat.getInt("byteCount") == 100);
740 // test that flow information is correct
741 JSONObject flow = flowStat.getJSONObject("flow");
742 Assert.assertTrue(flow.getInt("priority") == (3500 + actIndex));
743 Assert.assertTrue(flow.getInt("idleTimeout") == 1000);
744 Assert.assertTrue(flow.getInt("hardTimeout") == 2000);
745 Assert.assertTrue(flow.getInt("id") == 12345);
747 JSONArray matches = (flow.getJSONObject("match").getJSONArray("matchField"));
748 Assert.assertEquals(matches.length(), 1);
749 JSONObject match = matches.getJSONObject(0);
750 Assert.assertTrue(match.getString("type").equals("NW_DST"));
751 Assert.assertTrue(match.getString("value").equals("1.1.1.1"));
753 JSONArray actionsArray = flow.getJSONArray("actions");
754 Assert.assertEquals(actionsArray.length(), 1);
755 JSONObject act = actionsArray.getJSONObject(0);
756 Assert.assertTrue(act.getString("type").equals(actionType));
758 if (act.getString("type").equals("OUTPUT")) {
759 JSONObject port = act.getJSONObject("port");
760 JSONObject port_node = port.getJSONObject("node");
761 Assert.assertTrue(port.getInt("id") == 51966);
762 Assert.assertTrue(port.getString("type").equals("STUB"));
763 Assert.assertTrue(port_node.getInt("id") == 51966);
764 Assert.assertTrue(port_node.getString("type").equals("STUB"));
767 if (act.getString("type").equals("SET_DL_SRC")) {
768 byte srcMatch[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2, (byte) 1 };
769 String src = act.getString("address");
770 byte srcBytes[] = new byte[5];
771 srcBytes[0] = Byte.parseByte(src.substring(0, 2));
772 srcBytes[1] = Byte.parseByte(src.substring(2, 4));
773 srcBytes[2] = Byte.parseByte(src.substring(4, 6));
774 srcBytes[3] = Byte.parseByte(src.substring(6, 8));
775 srcBytes[4] = Byte.parseByte(src.substring(8, 10));
776 Assert.assertTrue(Arrays.equals(srcBytes, srcMatch));
779 if (act.getString("type").equals("SET_DL_DST")) {
780 byte dstMatch[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
781 String dst = act.getString("address");
782 byte dstBytes[] = new byte[5];
783 dstBytes[0] = Byte.parseByte(dst.substring(0, 2));
784 dstBytes[1] = Byte.parseByte(dst.substring(2, 4));
785 dstBytes[2] = Byte.parseByte(dst.substring(4, 6));
786 dstBytes[3] = Byte.parseByte(dst.substring(6, 8));
787 dstBytes[4] = Byte.parseByte(dst.substring(8, 10));
788 Assert.assertTrue(Arrays.equals(dstBytes, dstMatch));
790 if (act.getString("type").equals("SET_DL_TYPE")) {
791 Assert.assertTrue(act.getInt("dlType") == 10);
793 if (act.getString("type").equals("SET_VLAN_ID")) {
794 Assert.assertTrue(act.getInt("vlanId") == 2);
796 if (act.getString("type").equals("SET_VLAN_PCP")) {
797 Assert.assertTrue(act.getInt("pcp") == 3);
799 if (act.getString("type").equals("SET_VLAN_CFI")) {
800 Assert.assertTrue(act.getInt("cfi") == 1);
803 if (act.getString("type").equals("SET_NW_SRC")) {
804 Assert.assertTrue(act.getString("address").equals("2.2.2.2"));
806 if (act.getString("type").equals("SET_NW_DST")) {
807 Assert.assertTrue(act.getString("address").equals("1.1.1.1"));
810 if (act.getString("type").equals("PUSH_VLAN")) {
811 int head = act.getInt("VlanHeader");
812 // parsing vlan header
813 int id = head & 0xfff;
814 int cfi = (head >> 12) & 0x1;
815 int pcp = (head >> 13) & 0x7;
816 int tag = (head >> 16) & 0xffff;
817 Assert.assertTrue(id == 1234);
818 Assert.assertTrue(cfi == 1);
819 Assert.assertTrue(pcp == 1);
820 Assert.assertTrue(tag == 0x8100);
822 if (act.getString("type").equals("SET_NW_TOS")) {
823 Assert.assertTrue(act.getInt("tos") == 16);
825 if (act.getString("type").equals("SET_TP_SRC")) {
826 Assert.assertTrue(act.getInt("port") == 4201);
828 if (act.getString("type").equals("SET_TP_DST")) {
829 Assert.assertTrue(act.getInt("port") == 8080);
834 public void testFlowProgrammer() throws JSONException {
835 System.out.println("Starting FlowProgrammer JAXB client.");
836 String baseURL = baseUrlPrefix + "flowprogrammer/default/";
837 // Attempt to get a flow that doesn't exit. Should return 404
839 String result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "GET");
840 Assert.assertTrue(result.equals("404"));
843 String fc = "{\"name\":\"test1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
844 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "PUT", fc);
845 Assert.assertTrue(httpResponseCode == 201);
847 // test get returns flow that was added.
848 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "GET");
849 // check that result came out fine.
850 Assert.assertTrue(httpResponseCode == 200);
851 JSONTokener jt = new JSONTokener(result);
852 JSONObject json = new JSONObject(jt);
853 Assert.assertEquals(json.getString("name"), "test1");
854 JSONArray actionsArray = json.getJSONArray("actions");
855 Assert.assertEquals(actionsArray.getString(0), "DROP");
856 Assert.assertEquals(json.getString("installInHw"), "true");
857 JSONObject node = json.getJSONObject("node");
858 Assert.assertEquals(node.getString("type"), "STUB");
859 Assert.assertEquals(node.getString("id"), "51966");
860 // test adding same flow again succeeds with a change in any field ..return Success
862 fc = "{\"name\":\"test1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"LOOPBACK\"]}";
863 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "PUT", fc);
864 Assert.assertTrue(result.contains("Success"));
866 fc = "{\"name\":\"test2\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
867 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test2", "PUT", fc);
868 // test should return 409 for error due to same flow being added.
869 Assert.assertTrue(result.equals("409"));
871 // add second flow that's different
872 fc = "{\"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
873 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test2", "PUT", fc);
874 Assert.assertTrue(httpResponseCode == 201);
876 // check that request returns both flows given node.
877 result = getJsonResult(baseURL + "node/STUB/51966/", "GET");
878 jt = new JSONTokener(result);
879 json = new JSONObject(jt);
880 Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
881 JSONArray ja = json.getJSONArray("flowConfig");
882 Integer count = ja.length();
883 Assert.assertTrue(count == 2);
885 // check that request returns both flows given just container.
886 result = getJsonResult(baseURL);
887 jt = new JSONTokener(result);
888 json = new JSONObject(jt);
889 Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
890 ja = json.getJSONArray("flowConfig");
892 Assert.assertTrue(count == 2);
894 // delete a flow, check that it's no longer in list.
895 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test2", "DELETE");
896 Assert.assertTrue(httpResponseCode == 204);
898 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test2", "GET");
899 Assert.assertTrue(result.equals("404"));
902 // method to extract a JSONObject with specified node ID from a JSONObject
903 // that may contain an array of JSONObjects
904 // This is specifically written for statistics manager northbound REST
906 // array_name should be either "flowStatistics" or "portStatistics"
907 private JSONObject getJsonInstance(JSONObject json, String array_name, Integer nodeId) throws JSONException {
908 JSONObject result = null;
909 if (json.get(array_name) instanceof JSONArray) {
910 JSONArray json_array = json.getJSONArray(array_name);
911 for (int i = 0; i < json_array.length(); i++) {
912 result = json_array.getJSONObject(i);
913 Integer nid = result.getJSONObject("node").getInt("id");
914 if (nid.equals(nodeId)) {
919 result = json.getJSONObject(array_name);
920 Integer nid = result.getJSONObject("node").getInt("id");
921 if (!nid.equals(nodeId)) {
928 // a class to construct query parameter for HTTP request
929 private class QueryParameter {
930 StringBuilder queryString = null;
933 QueryParameter(String key, String value) {
934 queryString = new StringBuilder();
935 queryString.append("?").append(key).append("=").append(value);
938 // method to add more query parameter
939 QueryParameter add(String key, String value) {
940 this.queryString.append("&").append(key).append("=").append(value);
944 // method to get the query parameter string
946 return this.queryString.toString();
952 public void testHostTracker() throws JSONException {
954 System.out.println("Starting HostTracker JAXB client.");
956 // setup 2 host models for @POST method
958 String networkAddress_1 = "192.168.0.8";
959 String dataLayerAddress_1 = "11:22:33:44:55:66";
960 String nodeType_1 = "STUB";
961 Integer nodeId_1 = 3366;
962 String nodeConnectorType_1 = "STUB";
963 Integer nodeConnectorId_1 = 12;
967 String networkAddress_2 = "10.1.1.1";
968 String dataLayerAddress_2 = "1A:2B:3C:4D:5E:6F";
969 String nodeType_2 = "STUB";
970 Integer nodeId_2 = 4477;
971 String nodeConnectorType_2 = "STUB";
972 Integer nodeConnectorId_2 = 34;
973 String vlan_2 = "123";
975 String baseURL = baseUrlPrefix + "hosttracker/default";
977 // test PUT method: addHost()
978 JSONObject fc_json = new JSONObject();
979 fc_json.put("dataLayerAddress", dataLayerAddress_1);
980 fc_json.put("nodeType", nodeType_1);
981 fc_json.put("nodeId", nodeId_1);
982 fc_json.put("nodeConnectorType", nodeType_1);
983 fc_json.put("nodeConnectorId", nodeConnectorId_1.toString());
984 fc_json.put("vlan", vlan_1);
985 fc_json.put("staticHost", "true");
986 fc_json.put("networkAddress", networkAddress_1);
988 String result = getJsonResult(baseURL + "/address/" + networkAddress_1, "PUT", fc_json.toString());
989 Assert.assertTrue(httpResponseCode == 201);
991 fc_json = new JSONObject();
992 fc_json.put("dataLayerAddress", dataLayerAddress_2);
993 fc_json.put("nodeType", nodeType_2);
994 fc_json.put("nodeId", nodeId_2);
995 fc_json.put("nodeConnectorType", nodeType_2);
996 fc_json.put("nodeConnectorId", nodeConnectorId_2.toString());
997 fc_json.put("vlan", vlan_2);
998 fc_json.put("staticHost", "true");
999 fc_json.put("networkAddress", networkAddress_2);
1001 result = getJsonResult(baseURL + "/address/" + networkAddress_2 , "PUT", fc_json.toString());
1002 Assert.assertTrue(httpResponseCode == 201);
1004 // define variables for decoding returned strings
1005 String networkAddress;
1008 // the two hosts should be in inactive host DB
1009 // test GET method: getInactiveHosts()
1010 result = getJsonResult(baseURL + "/hosts/inactive", "GET");
1011 Assert.assertTrue(httpResponseCode == 200);
1013 JSONTokener jt = new JSONTokener(result);
1014 JSONObject json = new JSONObject(jt);
1015 // there should be at least two hosts in the DB
1016 Assert.assertTrue(json.get("hostConfig") instanceof JSONArray);
1017 JSONArray ja = json.getJSONArray("hostConfig");
1018 Integer count = ja.length();
1019 Assert.assertTrue(count == 2);
1021 for (int i = 0; i < count; i++) {
1022 host_jo = ja.getJSONObject(i);
1023 networkAddress = host_jo.getString("networkAddress");
1024 if (networkAddress.equalsIgnoreCase(networkAddress_1)) {
1025 Assert.assertTrue(host_jo.getString("dataLayerAddress").equalsIgnoreCase(dataLayerAddress_1));
1026 Assert.assertTrue(host_jo.getString("nodeConnectorType").equalsIgnoreCase(nodeConnectorType_1));
1027 Assert.assertTrue(host_jo.getInt("nodeConnectorId") == nodeConnectorId_1);
1028 Assert.assertTrue(host_jo.getString("nodeType").equalsIgnoreCase(nodeType_1));
1029 Assert.assertTrue(host_jo.getInt("nodeId") == nodeId_1);
1030 Assert.assertTrue(host_jo.getString("vlan").equals("0"));
1031 Assert.assertTrue(host_jo.getBoolean("staticHost"));
1032 } else if (networkAddress.equalsIgnoreCase(networkAddress_2)) {
1033 Assert.assertTrue(host_jo.getString("dataLayerAddress").equalsIgnoreCase(dataLayerAddress_2));
1034 Assert.assertTrue(host_jo.getString("nodeConnectorType").equalsIgnoreCase(nodeConnectorType_2));
1035 Assert.assertTrue(host_jo.getInt("nodeConnectorId") == nodeConnectorId_2);
1036 Assert.assertTrue(host_jo.getString("nodeType").equalsIgnoreCase(nodeType_2));
1037 Assert.assertTrue(host_jo.getInt("nodeId") == nodeId_2);
1038 Assert.assertTrue(host_jo.getString("vlan").equalsIgnoreCase(vlan_2));
1039 Assert.assertTrue(host_jo.getBoolean("staticHost"));
1041 Assert.assertTrue(false);
1045 // test GET method: getActiveHosts() - no host expected
1046 result = getJsonResult(baseURL + "/hosts/active", "GET");
1047 Assert.assertTrue(httpResponseCode == 200);
1049 jt = new JSONTokener(result);
1050 json = new JSONObject(jt);
1051 Assert.assertFalse(hostInJson(json, networkAddress_1));
1052 Assert.assertFalse(hostInJson(json, networkAddress_2));
1054 // put the 1st host into active host DB
1058 nd = new Node(nodeType_1, nodeId_1);
1059 ndc = new NodeConnector(nodeConnectorType_1, nodeConnectorId_1, nd);
1060 this.invtoryListener.notifyNodeConnector(ndc, UpdateType.ADDED, null);
1061 } catch (ConstructionException e) {
1066 // verify the host shows up in active host DB
1068 result = getJsonResult(baseURL + "/hosts/active", "GET");
1069 Assert.assertTrue(httpResponseCode == 200);
1071 jt = new JSONTokener(result);
1072 json = new JSONObject(jt);
1074 Assert.assertTrue(hostInJson(json, networkAddress_1));
1076 // test GET method for getHostDetails()
1078 result = getJsonResult(baseURL + "/address/" + networkAddress_1, "GET");
1079 Assert.assertTrue(httpResponseCode == 200);
1081 jt = new JSONTokener(result);
1082 json = new JSONObject(jt);
1084 Assert.assertFalse(json.length() == 0);
1086 Assert.assertTrue(json.getString("dataLayerAddress").equalsIgnoreCase(dataLayerAddress_1));
1087 Assert.assertTrue(json.getString("nodeConnectorType").equalsIgnoreCase(nodeConnectorType_1));
1088 Assert.assertTrue(json.getInt("nodeConnectorId") == nodeConnectorId_1);
1089 Assert.assertTrue(json.getString("nodeType").equalsIgnoreCase(nodeType_1));
1090 Assert.assertTrue(json.getInt("nodeId") == nodeId_1);
1091 Assert.assertTrue(json.getString("vlan").equals("0"));
1092 Assert.assertTrue(json.getBoolean("staticHost"));
1094 // test DELETE method for deleteFlow()
1096 result = getJsonResult(baseURL + "/address/" + networkAddress_1, "DELETE");
1097 Assert.assertTrue(httpResponseCode == 204);
1099 // verify host_1 removed from active host DB
1100 // test GET method: getActiveHosts() - no host expected
1102 result = getJsonResult(baseURL + "/hosts/active", "GET");
1103 Assert.assertTrue(httpResponseCode == 200);
1105 jt = new JSONTokener(result);
1106 json = new JSONObject(jt);
1108 Assert.assertFalse(hostInJson(json, networkAddress_1));
1112 private Boolean hostInJson(JSONObject json, String hostIp) throws JSONException {
1113 // input JSONObject may be empty
1114 if (json.length() == 0) {
1117 if (json.get("hostConfig") instanceof JSONArray) {
1118 JSONArray ja = json.getJSONArray("hostConfig");
1119 for (int i = 0; i < ja.length(); i++) {
1120 String na = ja.getJSONObject(i).getString("networkAddress");
1121 if (na.equalsIgnoreCase(hostIp)) {
1127 JSONObject ja = json.getJSONObject("hostConfig");
1128 String na = ja.getString("networkAddress");
1129 return na.equalsIgnoreCase(hostIp);
1134 public void testTopology() throws JSONException, ConstructionException {
1135 System.out.println("Starting Topology JAXB client.");
1136 String baseURL = baseUrlPrefix + "topology/default";
1138 // === test GET method for getTopology()
1139 short state_1 = State.EDGE_UP, state_2 = State.EDGE_DOWN;
1140 long bw_1 = Bandwidth.BW10Gbps, bw_2 = Bandwidth.BW100Mbps;
1141 long lat_1 = Latency.LATENCY100ns, lat_2 = Latency.LATENCY1ms;
1142 String nodeType = "STUB";
1143 String nodeConnType = "STUB";
1144 int headNC1_nodeId = 1, headNC1_nodeConnId = 11;
1145 int tailNC1_nodeId = 2, tailNC1_nodeConnId = 22;
1146 int headNC2_nodeId = 2, headNC2_nodeConnId = 21;
1147 int tailNC2_nodeId = 1, tailNC2_nodeConnId = 12;
1149 List<TopoEdgeUpdate> topoedgeupdateList = new ArrayList<TopoEdgeUpdate>();
1150 NodeConnector headnc1 = new NodeConnector(nodeConnType, headNC1_nodeConnId, new Node(nodeType, headNC1_nodeId));
1151 NodeConnector tailnc1 = new NodeConnector(nodeConnType, tailNC1_nodeConnId, new Node(nodeType, tailNC1_nodeId));
1152 Edge e1 = new Edge(tailnc1, headnc1);
1153 Set<Property> props_1 = new HashSet<Property>();
1154 props_1.add(new State(state_1));
1155 props_1.add(new Bandwidth(bw_1));
1156 props_1.add(new Latency(lat_1));
1157 TopoEdgeUpdate teu1 = new TopoEdgeUpdate(e1, props_1, UpdateType.ADDED);
1158 topoedgeupdateList.add(teu1);
1160 NodeConnector headnc2 = new NodeConnector(nodeConnType, headNC2_nodeConnId, new Node(nodeType, headNC2_nodeId));
1161 NodeConnector tailnc2 = new NodeConnector(nodeConnType, tailNC2_nodeConnId, new Node(nodeType, tailNC2_nodeId));
1162 Edge e2 = new Edge(tailnc2, headnc2);
1163 Set<Property> props_2 = new HashSet<Property>();
1164 props_2.add(new State(state_2));
1165 props_2.add(new Bandwidth(bw_2));
1166 props_2.add(new Latency(lat_2));
1168 TopoEdgeUpdate teu2 = new TopoEdgeUpdate(e2, props_2, UpdateType.ADDED);
1169 topoedgeupdateList.add(teu2);
1171 topoUpdates.edgeUpdate(topoedgeupdateList);
1174 String result = getJsonResult(baseURL, "GET");
1175 Assert.assertTrue(httpResponseCode == 200);
1177 System.out.println("Get Topology: " + result);
1180 // returned data must be an array of edges
1181 JSONTokener jt = new JSONTokener(result);
1182 JSONObject json = new JSONObject(jt);
1183 Assert.assertTrue(json.get("edgeProperties") instanceof JSONArray);
1184 JSONArray ja = json.getJSONArray("edgeProperties");
1186 for (int i = 0; i < ja.length(); i++) {
1187 JSONObject edgeProp = ja.getJSONObject(i);
1188 JSONObject edge = edgeProp.getJSONObject("edge");
1189 JSONObject tailNC = edge.getJSONObject("tailNodeConnector");
1190 JSONObject tailNode = tailNC.getJSONObject("node");
1192 JSONObject headNC = edge.getJSONObject("headNodeConnector");
1193 JSONObject headNode = headNC.getJSONObject("node");
1194 JSONObject Props = edgeProp.getJSONObject("properties");
1195 JSONObject bandw = Props.getJSONObject("bandwidth");
1196 JSONObject stt = Props.getJSONObject("state");
1197 JSONObject ltc = Props.getJSONObject("latency");
1199 if (headNC.getInt("id") == headNC1_nodeConnId) {
1200 Assert.assertEquals(headNode.getString("type"), nodeType);
1201 Assert.assertEquals(headNode.getLong("id"), headNC1_nodeId);
1202 Assert.assertEquals(headNC.getString("type"), nodeConnType);
1203 Assert.assertEquals(tailNode.getString("type"),nodeType);
1204 Assert.assertEquals(tailNode.getString("type"), nodeConnType);
1205 Assert.assertEquals(tailNC.getLong("id"), tailNC1_nodeConnId);
1206 Assert.assertEquals(bandw.getLong("value"), bw_1);
1207 Assert.assertTrue((short) stt.getInt("value") == state_1);
1208 Assert.assertEquals(ltc.getLong("value"), lat_1);
1209 } else if (headNC.getInt("id") == headNC2_nodeConnId) {
1210 Assert.assertEquals(headNode.getString("type"),nodeType);
1211 Assert.assertEquals(headNode.getLong("id"), headNC2_nodeId);
1212 Assert.assertEquals(headNC.getString("type"), nodeConnType);
1213 Assert.assertEquals(tailNode.getString("type"), nodeType);
1214 Assert.assertTrue(tailNode.getInt("id") == tailNC2_nodeId);
1215 Assert.assertEquals(tailNC.getString("type"), nodeConnType);
1216 Assert.assertEquals(tailNC.getLong("id"), tailNC2_nodeConnId);
1217 Assert.assertEquals(bandw.getLong("value"), bw_2);
1218 Assert.assertTrue((short) stt.getInt("value") == state_2);
1219 Assert.assertEquals(ltc.getLong("value"), lat_2);
1223 // === test POST method for addUserLink()
1224 // define 2 sample nodeConnectors for user link configuration tests
1225 String nodeType_1 = "STUB";
1226 Integer nodeId_1 = 3366;
1227 String nodeConnectorType_1 = "STUB";
1228 Integer nodeConnectorId_1 = 12;
1229 String nodeType_2 = "STUB";
1230 Integer nodeId_2 = 4477;
1231 String nodeConnectorType_2 = "STUB";
1232 Integer nodeConnectorId_2 = 34;
1234 JSONObject jo = new JSONObject()
1235 .put("name", "userLink_1")
1236 .put("srcNodeConnector",
1237 nodeConnectorType_1 + "|" + nodeConnectorId_1 + "@" + nodeType_1 + "|" + nodeId_1)
1238 .put("dstNodeConnector",
1239 nodeConnectorType_2 + "|" + nodeConnectorId_2 + "@" + nodeType_2 + "|" + nodeId_2);
1240 // execute HTTP request and verify response code
1241 result = getJsonResult(baseURL + "/userLink/userLink_1", "PUT", jo.toString());
1242 Assert.assertTrue(httpResponseCode == 201);
1244 // === test GET method for getUserLinks()
1245 result = getJsonResult(baseURL + "/userLinks", "GET");
1246 Assert.assertTrue(httpResponseCode == 200);
1248 System.out.println("result:" + result);
1251 jt = new JSONTokener(result);
1252 json = new JSONObject(jt);
1254 // should have at least one object returned
1255 Assert.assertFalse(json.length() == 0);
1256 JSONObject userlink = new JSONObject();
1258 if (json.get("userLinks") instanceof JSONArray) {
1259 ja = json.getJSONArray("userLinks");
1261 for (i = 0; i < ja.length(); i++) {
1262 userlink = ja.getJSONObject(i);
1263 if (userlink.getString("name").equalsIgnoreCase("userLink_1")) {
1267 Assert.assertFalse(i == ja.length());
1269 userlink = json.getJSONObject("userLinks");
1270 Assert.assertTrue(userlink.getString("name").equalsIgnoreCase("userLink_1"));
1273 String[] level_1, level_2;
1274 level_1 = userlink.getString("srcNodeConnector").split("\\@");
1275 level_2 = level_1[0].split("\\|");
1276 Assert.assertTrue(level_2[0].equalsIgnoreCase(nodeConnectorType_1));
1277 Assert.assertTrue(Integer.parseInt(level_2[1]) == nodeConnectorId_1);
1278 level_2 = level_1[1].split("\\|");
1279 Assert.assertTrue(level_2[0].equalsIgnoreCase(nodeType_1));
1280 Assert.assertTrue(Integer.parseInt(level_2[1]) == nodeId_1);
1281 level_1 = userlink.getString("dstNodeConnector").split("\\@");
1282 level_2 = level_1[0].split("\\|");
1283 Assert.assertTrue(level_2[0].equalsIgnoreCase(nodeConnectorType_2));
1284 Assert.assertTrue(Integer.parseInt(level_2[1]) == nodeConnectorId_2);
1285 level_2 = level_1[1].split("\\|");
1286 Assert.assertTrue(level_2[0].equalsIgnoreCase(nodeType_2));
1287 Assert.assertTrue(Integer.parseInt(level_2[1]) == nodeId_2);
1289 // === test DELETE method for deleteUserLink()
1290 String userName = "userLink_1";
1291 result = getJsonResult(baseURL + "/userLink/" + userName, "DELETE");
1292 Assert.assertTrue(httpResponseCode == 204);
1294 // execute another getUserLinks() request to verify that userLink_1 is
1296 result = getJsonResult(baseURL + "/userLinks", "GET");
1297 Assert.assertTrue(httpResponseCode == 200);
1299 System.out.println("result:" + result);
1301 jt = new JSONTokener(result);
1302 json = new JSONObject(jt);
1304 if (json.length() != 0) {
1305 if (json.get("userLinks") instanceof JSONArray) {
1306 ja = json.getJSONArray("userLinks");
1307 for (int i = 0; i < ja.length(); i++) {
1308 userlink = ja.getJSONObject(i);
1309 Assert.assertFalse(userlink.getString("name").equalsIgnoreCase("userLink_1"));
1312 userlink = json.getJSONObject("userLinks");
1313 Assert.assertFalse(userlink.getString("name").equalsIgnoreCase("userLink_1"));
1317 // Configure the OSGi container
1319 public Option[] config() {
1322 systemProperty("logback.configurationFile").value(
1323 "file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml"),
1324 // To start OSGi console for inspection remotely
1325 systemProperty("osgi.console").value("2401"),
1326 systemProperty("org.eclipse.gemini.web.tomcat.config.path").value(
1327 PathUtils.getBaseDir() + "/src/test/resources/tomcat-server.xml"),
1329 // setting default level. Jersey bundles will need to be started
1331 systemProperty("osgi.bundles.defaultStartLevel").value("4"),
1333 // Set the systemPackages (used by clustering)
1334 systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),
1335 mavenBundle("org.slf4j", "jcl-over-slf4j").versionAsInProject(),
1336 mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),
1337 mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),
1338 mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(),
1339 mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(),
1340 mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),
1341 mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
1343 // the plugin stub to get data for the tests
1344 mavenBundle("org.opendaylight.controller", "protocol_plugins.stub").versionAsInProject(),
1346 // List all the opendaylight modules
1347 mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(),
1348 mavenBundle("org.opendaylight.controller", "configuration.implementation").versionAsInProject(),
1349 mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),
1350 mavenBundle("org.opendaylight.controller", "containermanager.it.implementation").versionAsInProject(),
1351 mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(),
1352 mavenBundle("org.opendaylight.controller", "clustering.services-implementation").versionAsInProject(),
1353 mavenBundle("org.opendaylight.controller", "security").versionAsInProject().noStart(),
1354 mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),
1355 mavenBundle("org.opendaylight.controller", "sal.implementation").versionAsInProject(),
1356 mavenBundle("org.opendaylight.controller", "sal.connection").versionAsInProject(),
1357 mavenBundle("org.opendaylight.controller", "sal.connection.implementation").versionAsInProject(),
1358 mavenBundle("org.opendaylight.controller", "switchmanager").versionAsInProject(),
1359 mavenBundle("org.opendaylight.controller", "connectionmanager").versionAsInProject(),
1360 mavenBundle("org.opendaylight.controller", "connectionmanager.implementation").versionAsInProject(),
1361 mavenBundle("org.opendaylight.controller", "switchmanager.implementation").versionAsInProject(),
1362 mavenBundle("org.opendaylight.controller", "forwardingrulesmanager").versionAsInProject(),
1363 mavenBundle("org.opendaylight.controller",
1364 "forwardingrulesmanager.implementation").versionAsInProject(),
1365 mavenBundle("org.opendaylight.controller", "statisticsmanager").versionAsInProject(),
1366 mavenBundle("org.opendaylight.controller", "statisticsmanager.implementation").versionAsInProject(),
1367 mavenBundle("org.opendaylight.controller", "arphandler").versionAsInProject(),
1368 mavenBundle("org.opendaylight.controller", "hosttracker").versionAsInProject(),
1369 mavenBundle("org.opendaylight.controller", "hosttracker.implementation").versionAsInProject(),
1370 mavenBundle("org.opendaylight.controller", "arphandler").versionAsInProject(),
1371 mavenBundle("org.opendaylight.controller", "routing.dijkstra_implementation").versionAsInProject(),
1372 mavenBundle("org.opendaylight.controller", "topologymanager").versionAsInProject(),
1373 mavenBundle("org.opendaylight.controller", "usermanager").versionAsInProject(),
1374 mavenBundle("org.opendaylight.controller", "usermanager.implementation").versionAsInProject(),
1375 mavenBundle("org.opendaylight.controller", "logging.bridge").versionAsInProject(),
1376 // mavenBundle("org.opendaylight.controller", "clustering.test").versionAsInProject(),
1377 mavenBundle("org.opendaylight.controller", "forwarding.staticrouting").versionAsInProject(),
1378 mavenBundle("org.opendaylight.controller", "bundlescanner").versionAsInProject(),
1379 mavenBundle("org.opendaylight.controller", "bundlescanner.implementation").versionAsInProject(),
1380 mavenBundle("org.opendaylight.controller", "commons.httpclient").versionAsInProject(),
1382 // Northbound bundles
1383 mavenBundle("org.opendaylight.controller", "commons.northbound").versionAsInProject(),
1384 mavenBundle("org.opendaylight.controller", "forwarding.staticrouting.northbound").versionAsInProject(),
1385 mavenBundle("org.opendaylight.controller", "statistics.northbound").versionAsInProject(),
1386 mavenBundle("org.opendaylight.controller", "topology.northbound").versionAsInProject(),
1387 mavenBundle("org.opendaylight.controller", "hosttracker.northbound").versionAsInProject(),
1388 mavenBundle("org.opendaylight.controller", "switchmanager.northbound").versionAsInProject(),
1389 mavenBundle("org.opendaylight.controller", "flowprogrammer.northbound").versionAsInProject(),
1390 mavenBundle("org.opendaylight.controller", "subnets.northbound").versionAsInProject(),
1392 mavenBundle("com.fasterxml.jackson.core", "jackson-annotations").versionAsInProject(),
1393 mavenBundle("com.fasterxml.jackson.core", "jackson-core").versionAsInProject(),
1394 mavenBundle("com.fasterxml.jackson.core", "jackson-databind").versionAsInProject(),
1395 mavenBundle("com.fasterxml.jackson.jaxrs", "jackson-jaxrs-json-provider").versionAsInProject(),
1396 mavenBundle("com.fasterxml.jackson.jaxrs", "jackson-jaxrs-base").versionAsInProject(),
1397 mavenBundle("com.fasterxml.jackson.module", "jackson-module-jaxb-annotations").versionAsInProject(),
1399 mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),
1401 mavenBundle("commons-io", "commons-io").versionAsInProject(),
1403 mavenBundle("commons-fileupload", "commons-fileupload").versionAsInProject(),
1405 mavenBundle("equinoxSDK381", "javax.servlet").versionAsInProject(),
1406 mavenBundle("equinoxSDK381", "javax.servlet.jsp").versionAsInProject(),
1407 mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(),
1408 mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(),
1409 mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(),
1410 mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(),
1411 mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(),
1412 mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(),
1413 mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(),
1414 mavenBundle("equinoxSDK381", "org.eclipse.equinox.cm").versionAsInProject(),
1415 mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(),
1416 mavenBundle("equinoxSDK381", "org.eclipse.equinox.launcher").versionAsInProject(),
1418 mavenBundle("geminiweb", "org.eclipse.gemini.web.core").versionAsInProject(),
1419 mavenBundle("geminiweb", "org.eclipse.gemini.web.extender").versionAsInProject(),
1420 mavenBundle("geminiweb", "org.eclipse.gemini.web.tomcat").versionAsInProject(),
1421 mavenBundle("geminiweb", "org.eclipse.virgo.kernel.equinox.extensions").versionAsInProject().noStart(),
1422 mavenBundle("geminiweb", "org.eclipse.virgo.util.common").versionAsInProject(),
1423 mavenBundle("geminiweb", "org.eclipse.virgo.util.io").versionAsInProject(),
1424 mavenBundle("geminiweb", "org.eclipse.virgo.util.math").versionAsInProject(),
1425 mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi").versionAsInProject(),
1426 mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi.manifest").versionAsInProject(),
1427 mavenBundle("geminiweb", "org.eclipse.virgo.util.parser.manifest").versionAsInProject(),
1429 mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
1430 mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager.shell").versionAsInProject(),
1432 mavenBundle("com.google.code.gson", "gson").versionAsInProject(),
1433 mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec").versionAsInProject(),
1434 mavenBundle("org.apache.felix", "org.apache.felix.fileinstall").versionAsInProject(),
1435 mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),
1436 mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
1437 mavenBundle("virgomirror", "org.eclipse.jdt.core.compiler.batch").versionAsInProject(),
1438 mavenBundle("eclipselink", "javax.persistence").versionAsInProject(),
1439 mavenBundle("eclipselink", "javax.resource").versionAsInProject(),
1441 mavenBundle("orbit", "javax.activation").versionAsInProject(),
1442 mavenBundle("orbit", "javax.annotation").versionAsInProject(),
1443 mavenBundle("orbit", "javax.ejb").versionAsInProject(),
1444 mavenBundle("orbit", "javax.el").versionAsInProject(),
1445 mavenBundle("orbit", "javax.mail.glassfish").versionAsInProject(),
1446 mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(),
1447 mavenBundle("orbit", "org.apache.catalina").versionAsInProject(),
1448 // these are bundle fragments that can't be started on its own
1449 mavenBundle("orbit", "org.apache.catalina.ha").versionAsInProject().noStart(),
1450 mavenBundle("orbit", "org.apache.catalina.tribes").versionAsInProject().noStart(),
1451 mavenBundle("orbit", "org.apache.coyote").versionAsInProject().noStart(),
1452 mavenBundle("orbit", "org.apache.jasper").versionAsInProject().noStart(),
1454 mavenBundle("orbit", "org.apache.el").versionAsInProject(),
1455 mavenBundle("orbit", "org.apache.juli.extras").versionAsInProject(),
1456 mavenBundle("orbit", "org.apache.tomcat.api").versionAsInProject(),
1457 mavenBundle("orbit", "org.apache.tomcat.util").versionAsInProject().noStart(),
1458 mavenBundle("orbit", "javax.servlet.jsp.jstl").versionAsInProject(),
1459 mavenBundle("orbit", "javax.servlet.jsp.jstl.impl").versionAsInProject(),
1461 mavenBundle("org.ops4j.pax.exam", "pax-exam-container-native").versionAsInProject(),
1462 mavenBundle("org.ops4j.pax.exam", "pax-exam-junit4").versionAsInProject(),
1463 mavenBundle("org.ops4j.pax.exam", "pax-exam-link-mvn").versionAsInProject(),
1464 mavenBundle("org.ops4j.pax.url", "pax-url-aether").versionAsInProject(),
1466 mavenBundle("org.ow2.asm", "asm-all").versionAsInProject(),
1468 mavenBundle("org.springframework", "org.springframework.asm").versionAsInProject(),
1469 mavenBundle("org.springframework", "org.springframework.aop").versionAsInProject(),
1470 mavenBundle("org.springframework", "org.springframework.context").versionAsInProject(),
1471 mavenBundle("org.springframework", "org.springframework.context.support").versionAsInProject(),
1472 mavenBundle("org.springframework", "org.springframework.core").versionAsInProject(),
1473 mavenBundle("org.springframework", "org.springframework.beans").versionAsInProject(),
1474 mavenBundle("org.springframework", "org.springframework.expression").versionAsInProject(),
1475 mavenBundle("org.springframework", "org.springframework.web").versionAsInProject(),
1477 mavenBundle("org.aopalliance", "com.springsource.org.aopalliance").versionAsInProject(),
1478 mavenBundle("org.springframework", "org.springframework.web.servlet").versionAsInProject(),
1479 mavenBundle("org.springframework.security", "spring-security-config").versionAsInProject(),
1480 mavenBundle("org.springframework.security", "spring-security-core").versionAsInProject(),
1481 mavenBundle("org.springframework.security", "spring-security-web").versionAsInProject(),
1482 mavenBundle("org.springframework.security", "spring-security-taglibs").versionAsInProject(),
1483 mavenBundle("org.springframework", "org.springframework.transaction").versionAsInProject(),
1485 mavenBundle("org.ow2.chameleon.management", "chameleon-mbeans").versionAsInProject(),
1486 mavenBundle("org.opendaylight.controller.thirdparty", "net.sf.jung2").versionAsInProject(),
1487 mavenBundle("org.opendaylight.controller.thirdparty", "com.sun.jersey.jersey-servlet")
1488 .versionAsInProject(),
1489 mavenBundle("org.opendaylight.controller.thirdparty", "org.apache.catalina.filters.CorsFilter")
1490 .versionAsInProject().noStart(),
1492 // Jersey needs to be started before the northbound application
1493 // bundles, using a lower start level
1494 mavenBundle("com.sun.jersey", "jersey-client").versionAsInProject(),
1495 mavenBundle("com.sun.jersey", "jersey-server").versionAsInProject().startLevel(2),
1496 mavenBundle("com.sun.jersey", "jersey-core").versionAsInProject().startLevel(2),