1 package org.opendaylight.controller.northbound.integrationtest;
3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory;
5 import org.osgi.framework.ServiceReference;
6 import org.osgi.framework.Bundle;
7 import javax.inject.Inject;
9 import org.junit.Assert;
10 import org.junit.Test;
11 import org.junit.Before;
12 import org.junit.runner.RunWith;
13 import org.ops4j.pax.exam.junit.PaxExam;
14 import org.osgi.framework.BundleContext;
15 import static org.junit.Assert.*;
16 import org.ops4j.pax.exam.junit.Configuration;
17 import static org.ops4j.pax.exam.CoreOptions.*;
18 import org.ops4j.pax.exam.Option;
19 import org.ops4j.pax.exam.util.PathUtils;
20 import java.io.BufferedReader;
21 import java.io.InputStream;
22 import java.io.InputStreamReader;
23 import java.io.OutputStreamWriter;
24 import java.net.HttpURLConnection;
26 import java.nio.charset.Charset;
27 import java.util.Arrays;
29 import org.apache.commons.codec.binary.Base64;
31 import org.codehaus.jettison.json.JSONArray;
32 import org.codehaus.jettison.json.JSONException;
33 import org.codehaus.jettison.json.JSONObject;
34 import org.codehaus.jettison.json.JSONTokener;
36 import org.opendaylight.controller.hosttracker.IfIptoHost;
37 import org.opendaylight.controller.sal.core.ConstructionException;
38 import org.opendaylight.controller.sal.core.Node;
39 import org.opendaylight.controller.sal.core.NodeConnector;
40 import org.opendaylight.controller.sal.core.UpdateType;
41 import org.opendaylight.controller.switchmanager.IInventoryListener;
42 import org.opendaylight.controller.usermanager.IUserManager;
44 @RunWith(PaxExam.class)
45 public class NorthboundIT {
46 private Logger log = LoggerFactory.getLogger(NorthboundIT.class);
47 // get the OSGI bundle context
49 private BundleContext bc;
50 private IUserManager users = null;
51 private IInventoryListener invtoryListener = null;
53 private String stateToString(int state) {
57 case Bundle.INSTALLED:
61 case Bundle.UNINSTALLED:
64 return "Not CONVERTED";
69 public void areWeReady() {
71 boolean debugit = false;
72 Bundle b[] = bc.getBundles();
73 for (int i = 0; i < b.length; i++) {
74 int state = b[i].getState();
75 if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {
76 log.debug("Bundle:" + b[i].getSymbolicName() + " state:"
77 + stateToString(state));
82 log.debug("Do some debugging because some bundle is "
85 // Assert if true, if false we are good to go!
88 ServiceReference r = bc.getServiceReference(IUserManager.class
91 this.users = (IUserManager) bc.getService(r);
93 // If UserManager is null, cannot login to run tests.
94 assertNotNull(this.users);
96 r = bc.getServiceReference(IfIptoHost.class.getName());
98 this.invtoryListener = (IInventoryListener) bc.getService(r);
101 // If inventoryListener is null, cannot run hosttracker tests.
102 assertNotNull(this.invtoryListener);
106 // static variable to pass response code from getJsonResult()
107 private static Integer httpResponseCode = null;
109 private String getJsonResult(String restUrl) {
110 return getJsonResult(restUrl, "GET", null);
113 private String getJsonResult(String restUrl, String method) {
114 return getJsonResult(restUrl, method, null);
117 private String getJsonResult(String restUrl, String method, String body) {
118 // initialize response code to indicate error
119 httpResponseCode = 400;
122 URL url = new URL(restUrl);
123 this.users.getAuthorizationList();
124 this.users.authenticate("admin", "admin");
125 String authString = "admin:admin";
126 byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
127 String authStringEnc = new String(authEncBytes);
129 HttpURLConnection connection = (HttpURLConnection) url
131 connection.setRequestMethod(method);
132 connection.setRequestProperty("Authorization", "Basic "
134 connection.setRequestProperty("Content-Type", "application/json");
135 connection.setRequestProperty("Accept", "application/json");
138 connection.setDoOutput(true);
139 OutputStreamWriter wr = new OutputStreamWriter(
140 connection.getOutputStream());
144 connection.connect();
145 connection.getContentType();
147 // Response code for success should be 2xx
148 httpResponseCode = connection.getResponseCode();
149 if (httpResponseCode > 299)
150 return httpResponseCode.toString();
152 InputStream is = connection.getInputStream();
153 BufferedReader rd = new BufferedReader(new InputStreamReader(is,
154 Charset.forName("UTF-8")));
155 StringBuilder sb = new StringBuilder();
157 while ((cp = rd.read()) != -1) {
158 sb.append((char) cp);
161 connection.disconnect();
162 return sb.toString();
163 } catch (Exception e) {
168 private void testNodeProperties(JSONObject node, Integer nodeId,
169 String nodeType, Integer timestamp, String timestampName,
170 Integer actionsValue, Integer capabilitiesValue,
171 Integer tablesValue, Integer buffersValue) throws JSONException {
173 JSONObject nodeInfo = node.getJSONObject("node");
174 Assert.assertEquals(nodeId, (Integer) nodeInfo.getInt("@id"));
175 Assert.assertEquals(nodeType, nodeInfo.getString("@type"));
177 JSONObject properties = node.getJSONObject("properties");
179 if (timestamp == null || timestampName == null) {
180 Assert.assertFalse(properties.has("timeStamp"));
184 (Integer) properties.getJSONObject("timeStamp").getInt(
188 properties.getJSONObject("timeStamp").getString(
191 if (actionsValue == null) {
192 Assert.assertFalse(properties.has("actions"));
194 Assert.assertEquals(actionsValue, (Integer) properties
195 .getJSONObject("actions").getInt("actionsValue"));
197 if (capabilitiesValue == null) {
198 Assert.assertFalse(properties.has("capabilities"));
200 Assert.assertEquals(capabilitiesValue, (Integer) properties
201 .getJSONObject("capabilities").getInt("capabilitiesValue"));
203 if (tablesValue == null) {
204 Assert.assertFalse(properties.has("tables"));
206 Assert.assertEquals(tablesValue, (Integer) properties
207 .getJSONObject("tables").getInt("tablesValue"));
209 if (buffersValue == null) {
210 Assert.assertFalse(properties.has("buffers"));
212 Assert.assertEquals(buffersValue, (Integer) properties
213 .getJSONObject("buffers").getInt("buffersValue"));
217 private void testNodeConnectorProperties(
218 JSONObject nodeConnectorProperties, Integer ncId, String ncType,
219 Integer nodeId, String nodeType, Integer state,
220 Integer capabilities, Integer bandwidth) throws JSONException {
222 JSONObject nodeConnector = nodeConnectorProperties
223 .getJSONObject("nodeconnector");
224 JSONObject node = nodeConnector.getJSONObject("node");
225 JSONObject properties = nodeConnectorProperties
226 .getJSONObject("properties");
228 Assert.assertEquals(ncId, (Integer) nodeConnector.getInt("@id"));
229 Assert.assertEquals(ncType, nodeConnector.getString("@type"));
230 Assert.assertEquals(nodeId, (Integer) node.getInt("@id"));
231 Assert.assertEquals(nodeType, node.getString("@type"));
233 Assert.assertFalse(properties.has("state"));
237 (Integer) properties.getJSONObject("state").getInt(
240 if (capabilities == null) {
241 Assert.assertFalse(properties.has("capabilities"));
243 Assert.assertEquals(capabilities, (Integer) properties
244 .getJSONObject("capabilities").getInt("capabilitiesValue"));
246 if (bandwidth == null) {
247 Assert.assertFalse(properties.has("bandwidth"));
251 (Integer) properties.getJSONObject("bandwidth").getInt(
258 public void testSubnetsNorthbound() throws JSONException {
259 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/subnet/";
261 String name1 = "testSubnet1";
262 String subnet1 = "1.1.1.1/24";
263 String name2 = "testSubnet2";
264 String subnet2 = "2.2.2.2/24";
266 // Test GET subnets in default container
267 String result = getJsonResult(baseURL + "default");
268 JSONTokener jt = new JSONTokener(result);
269 JSONObject json = new JSONObject(jt);
270 Assert.assertEquals("{}", result);
272 // Test GET subnet1 expecting 404
273 result = getJsonResult(baseURL + "default/" + name1);
274 Assert.assertEquals(404, httpResponseCode.intValue());
277 String queryParameter = new QueryParameter("subnetName", name1).add(
278 "subnet", subnet1).getString();
279 result = getJsonResult(baseURL + "default/" + name1 + queryParameter,
281 Assert.assertEquals(201, httpResponseCode.intValue());
284 result = getJsonResult(baseURL + "default/" + name1);
285 jt = new JSONTokener(result);
286 json = new JSONObject(jt);
287 Assert.assertEquals(200, httpResponseCode.intValue());
288 Assert.assertEquals(name1, json.getString("@name"));
289 Assert.assertEquals(subnet1, json.getString("@subnet"));
292 queryParameter = new QueryParameter("subnetName", name2).add("subnet",
293 subnet2).getString();
294 result = getJsonResult(baseURL + "default/" + name2 + queryParameter,
296 Assert.assertEquals(201, httpResponseCode.intValue());
298 // Test GET all subnets in default container
299 result = getJsonResult(baseURL + "default");
300 jt = new JSONTokener(result);
301 json = new JSONObject(jt);
302 JSONArray subnetConfigArray = json.getJSONArray("subnetConfig");
303 JSONObject subnetConfig;
304 Assert.assertEquals(2, subnetConfigArray.length());
305 for (int i = 0; i < subnetConfigArray.length(); i++) {
306 subnetConfig = subnetConfigArray.getJSONObject(i);
307 if (subnetConfig.getString("@name").equals(name1)) {
308 Assert.assertEquals(subnet1, subnetConfig.getString("@subnet"));
309 } else if (subnetConfig.getString("@name").equals(name2)) {
310 Assert.assertEquals(subnet2, subnetConfig.getString("@subnet"));
312 // Unexpected config name
313 Assert.assertTrue(false);
317 // Test DELETE subnet1
318 result = getJsonResult(baseURL + "default/" + name1, "DELETE");
319 Assert.assertEquals(200, httpResponseCode.intValue());
321 // Test GET deleted subnet1
322 result = getJsonResult(baseURL + "default/" + name1);
323 Assert.assertEquals(404, httpResponseCode.intValue());
328 public void testStaticRoutingNorthbound() throws JSONException {
329 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/staticroute/";
331 String name1 = "testRoute1";
332 String prefix1 = "192.168.1.1/24";
333 String nextHop1 = "0.0.0.0";
334 String name2 = "testRoute2";
335 String prefix2 = "192.168.1.1/16";
336 String nextHop2 = "1.1.1.1";
338 // Test GET static routes in default container, expecting no results
339 String result = getJsonResult(baseURL + "default");
340 JSONTokener jt = new JSONTokener(result);
341 JSONObject json = new JSONObject(jt);
342 Assert.assertEquals("{}", result);
344 // Test insert static route
345 String requestBody = "{\"name\":\"" + name1 + "\", \"prefix\":\""
346 + prefix1 + "\", \"nextHop\":\"" + nextHop1 + "\"}";
347 result = getJsonResult(baseURL + "default/" + name1, "POST",
349 Assert.assertEquals(201, httpResponseCode.intValue());
351 requestBody = "{\"name\":\"" + name2 + "\", \"prefix\":\"" + prefix2
352 + "\", \"nextHop\":\"" + nextHop2 + "\"}";
353 result = getJsonResult(baseURL + "default/" + name2, "POST",
355 Assert.assertEquals(201, httpResponseCode.intValue());
357 // Test Get all static routes
358 result = getJsonResult(baseURL + "default");
359 jt = new JSONTokener(result);
360 json = new JSONObject(jt);
361 JSONArray staticRoutes = json.getJSONArray("staticRoute");
362 Assert.assertEquals(2, staticRoutes.length());
364 for (int i = 0; i < staticRoutes.length(); i++) {
365 route = staticRoutes.getJSONObject(i);
366 if (route.getString("name").equals(name1)) {
367 Assert.assertEquals(prefix1, route.getString("prefix"));
368 Assert.assertEquals(nextHop1, route.getString("nextHop"));
369 } else if (route.getString("name").equals(name2)) {
370 Assert.assertEquals(prefix2, route.getString("prefix"));
371 Assert.assertEquals(nextHop2, route.getString("nextHop"));
373 // static route has unknown name
374 Assert.assertTrue(false);
378 // Test get specific static route
379 result = getJsonResult(baseURL + "default/" + name1);
380 jt = new JSONTokener(result);
381 json = new JSONObject(jt);
383 Assert.assertEquals(name1, json.getString("name"));
384 Assert.assertEquals(prefix1, json.getString("prefix"));
385 Assert.assertEquals(nextHop1, json.getString("nextHop"));
387 result = getJsonResult(baseURL + "default/" + name2);
388 jt = new JSONTokener(result);
389 json = new JSONObject(jt);
391 Assert.assertEquals(name2, json.getString("name"));
392 Assert.assertEquals(prefix2, json.getString("prefix"));
393 Assert.assertEquals(nextHop2, json.getString("nextHop"));
395 // Test delete static route
396 result = getJsonResult(baseURL + "default/" + name1, "DELETE");
397 Assert.assertEquals(200, httpResponseCode.intValue());
399 result = getJsonResult(baseURL + "default");
400 jt = new JSONTokener(result);
401 json = new JSONObject(jt);
402 JSONObject singleStaticRoute = json.getJSONObject("staticRoute");
403 Assert.assertEquals(name2, singleStaticRoute.getString("name"));
408 public void testSwitchManager() throws JSONException {
409 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/switch/default/";
411 // define Node/NodeConnector attributes for test
412 int nodeId_1 = 51966;
415 int nodeConnectorId_1 = 51966;
416 int nodeConnectorId_2 = 12;
417 int nodeConnectorId_3 = 34;
418 String nodeType = "STUB";
419 String ncType = "STUB";
420 int timestamp_1 = 100000;
421 String timestampName_1 = "connectedSince";
422 int actionsValue_1 = 2;
423 int capabilitiesValue_1 = 3;
424 int tablesValue_1 = 1;
425 int buffersValue_1 = 1;
427 int ncCapabilities = 1;
428 int ncBandwidth = 1000000000;
430 // Test GET all nodes
432 String result = getJsonResult(baseURL + "nodes");
433 JSONTokener jt = new JSONTokener(result);
434 JSONObject json = new JSONObject(jt);
436 // Test for first node
437 JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1);
438 Assert.assertNotNull(node);
439 testNodeProperties(node, nodeId_1, nodeType, timestamp_1,
440 timestampName_1, actionsValue_1, capabilitiesValue_1,
441 tablesValue_1, buffersValue_1);
443 // Test 2nd node, properties of 2nd node same as first node
444 node = getJsonInstance(json, "nodeProperties", nodeId_2);
445 Assert.assertNotNull(node);
446 testNodeProperties(node, nodeId_2, nodeType, timestamp_1,
447 timestampName_1, actionsValue_1, capabilitiesValue_1,
448 tablesValue_1, buffersValue_1);
450 // Test 3rd node, properties of 3rd node same as first node
451 node = getJsonInstance(json, "nodeProperties", nodeId_3);
452 Assert.assertNotNull(node);
453 testNodeProperties(node, nodeId_3, nodeType, timestamp_1,
454 timestampName_1, actionsValue_1, capabilitiesValue_1,
455 tablesValue_1, buffersValue_1);
457 // Test GET nodeConnectors of a node
459 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
460 jt = new JSONTokener(result);
461 json = new JSONObject(jt);
462 JSONObject nodeConnectorProperties = json
463 .getJSONObject("nodeConnectorProperties");
465 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1,
466 ncType, nodeId_1, nodeType, ncState, ncCapabilities,
470 result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
471 jt = new JSONTokener(result);
472 json = new JSONObject(jt);
473 nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
475 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2,
476 ncType, nodeId_2, nodeType, ncState, ncCapabilities,
480 result = getJsonResult(baseURL + "node/STUB/" + nodeId_3);
481 jt = new JSONTokener(result);
482 json = new JSONObject(jt);
484 nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
485 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_3,
486 ncType, nodeId_3, nodeType, ncState, ncCapabilities,
489 // Test delete node property
490 // Delete timestamp property from node1
491 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1
492 + "/property/timeStamp", "DELETE");
493 Assert.assertEquals(200, httpResponseCode.intValue());
496 result = getJsonResult(baseURL + "nodes");
497 jt = new JSONTokener(result);
498 json = new JSONObject(jt);
499 node = getJsonInstance(json, "nodeProperties", nodeId_1);
500 Assert.assertNotNull(node);
501 testNodeProperties(node, nodeId_1, nodeType, null, null,
502 actionsValue_1, capabilitiesValue_1, tablesValue_1,
505 // Delete actions property from node2
506 result = getJsonResult(baseURL + "node/STUB/" + nodeId_2
507 + "/property/actions", "DELETE");
508 Assert.assertEquals(200, httpResponseCode.intValue());
511 result = getJsonResult(baseURL + "nodes");
512 jt = new JSONTokener(result);
513 json = new JSONObject(jt);
514 node = getJsonInstance(json, "nodeProperties", nodeId_2);
515 Assert.assertNotNull(node);
516 testNodeProperties(node, nodeId_2, nodeType, timestamp_1,
517 timestampName_1, null, capabilitiesValue_1, tablesValue_1,
520 // Test add property to node
521 // Add Tier and Bandwidth property to node1
522 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1
523 + "/property/tier/1001", "PUT");
524 Assert.assertEquals(201, httpResponseCode.intValue());
525 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1
526 + "/property/bandwidth/1002", "PUT");
527 Assert.assertEquals(201, httpResponseCode.intValue());
529 // Test for first node
530 result = getJsonResult(baseURL + "nodes");
531 jt = new JSONTokener(result);
532 json = new JSONObject(jt);
533 node = getJsonInstance(json, "nodeProperties", nodeId_1);
534 Assert.assertNotNull(node);
535 Assert.assertEquals(1001, node.getJSONObject("properties")
536 .getJSONObject("tier").getInt("tierValue"));
537 Assert.assertEquals(1002, node.getJSONObject("properties")
538 .getJSONObject("bandwidth").getInt("bandwidthValue"));
540 // Test delete nodeConnector property
541 // Delete state property of nodeconnector1
542 result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1
543 + "/STUB/" + nodeConnectorId_1 + "/property/state", "DELETE");
544 Assert.assertEquals(200, httpResponseCode.intValue());
546 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
547 jt = new JSONTokener(result);
548 json = new JSONObject(jt);
549 nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
551 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1,
552 ncType, nodeId_1, nodeType, null, ncCapabilities, ncBandwidth);
554 // Delete capabilities property of nodeconnector2
555 result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_2
556 + "/STUB/" + nodeConnectorId_2 + "/property/capabilities",
558 Assert.assertEquals(200, httpResponseCode.intValue());
560 result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
561 jt = new JSONTokener(result);
562 json = new JSONObject(jt);
563 nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
565 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2,
566 ncType, nodeId_2, nodeType, ncState, null, ncBandwidth);
568 // Test PUT nodeConnector property
569 int newBandwidth = 1001;
571 // Add Name/Bandwidth property to nodeConnector1
572 result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1
573 + "/STUB/" + nodeConnectorId_1 + "/property/bandwidth/"
574 + newBandwidth, "PUT");
575 Assert.assertEquals(201, httpResponseCode.intValue());
577 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
578 jt = new JSONTokener(result);
579 json = new JSONObject(jt);
580 nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
582 // Check for new bandwidth value, state value removed from previous
584 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1,
585 ncType, nodeId_1, nodeType, null, ncCapabilities, newBandwidth);
590 public void testStatistics() throws JSONException {
591 String actionTypes[] = { "drop", "loopback", "flood", "floodAll",
592 "controller", "swPath", "hwPath", "output", "setDlSrc",
593 "setDlDst", "setDlType", "setVlanId", "setVlanPcp",
594 "setVlanCfi", "popVlan", "pushVlan", "setNwSrc", "setNwDst",
595 "setNwTos", "setTpSrc", "setTpDst" };
596 System.out.println("Starting Statistics JAXB client.");
598 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/statistics/default/";
600 String result = getJsonResult(baseURL + "flowstats");
601 JSONTokener jt = new JSONTokener(result);
602 JSONObject json = new JSONObject(jt);
603 JSONObject flowStatistics = getJsonInstance(json, "flowStatistics",
605 JSONObject node = flowStatistics.getJSONObject("node");
606 // test that node was returned properly
607 Assert.assertTrue(node.getInt("@id") == 0xCAFE);
608 Assert.assertTrue(node.getString("@type").equals("STUB"));
610 // test that flow statistics results are correct
611 JSONArray flowStats = flowStatistics.getJSONArray("flowStat");
612 for (int i = 0; i < flowStats.length(); i++) {
614 JSONObject flowStat = flowStats.getJSONObject(i);
615 testFlowStat(flowStat, actionTypes[i]);
619 // for /controller/nb/v2/statistics/default/portstats
620 result = getJsonResult(baseURL + "portstats");
621 jt = new JSONTokener(result);
622 json = new JSONObject(jt);
623 JSONObject portStatistics = getJsonInstance(json, "portStatistics",
625 JSONObject node2 = portStatistics.getJSONObject("node");
626 // test that node was returned properly
627 Assert.assertTrue(node2.getInt("@id") == 0xCAFE);
628 Assert.assertTrue(node2.getString("@type").equals("STUB"));
630 // test that port statistic results are correct
631 JSONObject portStat = portStatistics.getJSONObject("portStat");
632 Assert.assertTrue(portStat.getInt("receivePackets") == 250);
633 Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
634 Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
635 Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
636 Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
637 Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
638 Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
639 Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
640 Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
641 Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
642 Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
643 Assert.assertTrue(portStat.getInt("collisionCount") == 4);
645 // test for getting one specific node's stats
646 result = getJsonResult(baseURL + "flowstats/STUB/51966");
647 jt = new JSONTokener(result);
648 json = new JSONObject(jt);
649 node = json.getJSONObject("node");
650 // test that node was returned properly
651 Assert.assertTrue(node.getInt("@id") == 0xCAFE);
652 Assert.assertTrue(node.getString("@type").equals("STUB"));
654 // test that flow statistics results are correct
655 flowStats = json.getJSONArray("flowStat");
656 for (int i = 0; i < flowStats.length(); i++) {
657 JSONObject flowStat = flowStats.getJSONObject(i);
658 testFlowStat(flowStat, actionTypes[i]);
661 result = getJsonResult(baseURL + "portstats/STUB/51966");
662 jt = new JSONTokener(result);
663 json = new JSONObject(jt);
664 node2 = json.getJSONObject("node");
665 // test that node was returned properly
666 Assert.assertTrue(node2.getInt("@id") == 0xCAFE);
667 Assert.assertTrue(node2.getString("@type").equals("STUB"));
669 // test that port statistic results are correct
670 portStat = json.getJSONObject("portStat");
671 Assert.assertTrue(portStat.getInt("receivePackets") == 250);
672 Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
673 Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
674 Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
675 Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
676 Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
677 Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
678 Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
679 Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
680 Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
681 Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
682 Assert.assertTrue(portStat.getInt("collisionCount") == 4);
685 private void testFlowStat(JSONObject flowStat, String actionType)
686 throws JSONException {
687 Assert.assertTrue(flowStat.getInt("tableId") == 1);
688 Assert.assertTrue(flowStat.getInt("durationSeconds") == 40);
689 Assert.assertTrue(flowStat.getInt("durationNanoseconds") == 400);
690 Assert.assertTrue(flowStat.getInt("packetCount") == 200);
691 Assert.assertTrue(flowStat.getInt("byteCount") == 100);
693 // test that flow information is correct
694 JSONObject flow = flowStat.getJSONObject("flow");
695 Assert.assertTrue(flow.getInt("priority") == 3500);
696 Assert.assertTrue(flow.getInt("idleTimeout") == 1000);
697 Assert.assertTrue(flow.getInt("hardTimeout") == 2000);
698 Assert.assertTrue(flow.getInt("id") == 12345);
700 JSONObject match = (flow.getJSONObject("match")
701 .getJSONObject("matchField"));
702 Assert.assertTrue(match.getString("type").equals("NW_DST"));
703 Assert.assertTrue(match.getString("value").equals("1.1.1.1"));
705 JSONObject act = flow.getJSONObject("actions");
706 Assert.assertTrue(act.getString("@type").equals(actionType));
708 if (act.getString("@type").equals("output")) {
709 JSONObject port = act.getJSONObject("port");
710 JSONObject port_node = port.getJSONObject("node");
711 Assert.assertTrue(port.getInt("@id") == 51966);
712 Assert.assertTrue(port.getString("@type").equals("STUB"));
713 Assert.assertTrue(port_node.getInt("@id") == 51966);
714 Assert.assertTrue(port_node.getString("@type").equals("STUB"));
717 if (act.getString("@type").equals("setDlSrc")) {
718 byte srcMatch[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2,
720 String src = act.getString("address");
721 byte srcBytes[] = new byte[5];
722 srcBytes[0] = Byte.parseByte(src.substring(0, 2));
723 srcBytes[1] = Byte.parseByte(src.substring(2, 4));
724 srcBytes[2] = Byte.parseByte(src.substring(4, 6));
725 srcBytes[3] = Byte.parseByte(src.substring(6, 8));
726 srcBytes[4] = Byte.parseByte(src.substring(8, 10));
727 Assert.assertTrue(Arrays.equals(srcBytes, srcMatch));
730 if (act.getString("@type").equals("setDlDst")) {
731 byte dstMatch[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4,
733 String dst = act.getString("address");
734 byte dstBytes[] = new byte[5];
735 dstBytes[0] = Byte.parseByte(dst.substring(0, 2));
736 dstBytes[1] = Byte.parseByte(dst.substring(2, 4));
737 dstBytes[2] = Byte.parseByte(dst.substring(4, 6));
738 dstBytes[3] = Byte.parseByte(dst.substring(6, 8));
739 dstBytes[4] = Byte.parseByte(dst.substring(8, 10));
740 Assert.assertTrue(Arrays.equals(dstBytes, dstMatch));
742 if (act.getString("@type").equals("setDlType"))
743 Assert.assertTrue(act.getInt("dlType") == 10);
744 if (act.getString("@type").equals("setVlanId"))
745 Assert.assertTrue(act.getInt("vlanId") == 2);
746 if (act.getString("@type").equals("setVlanPcp"))
747 Assert.assertTrue(act.getInt("pcp") == 3);
748 if (act.getString("@type").equals("setVlanCfi"))
749 Assert.assertTrue(act.getInt("cfi") == 1);
751 if (act.getString("@type").equals("setNwSrc"))
752 Assert.assertTrue(act.getString("address").equals("2.2.2.2"));
753 if (act.getString("@type").equals("setNwDst"))
754 Assert.assertTrue(act.getString("address").equals("1.1.1.1"));
756 if (act.getString("@type").equals("pushVlan")) {
757 int head = act.getInt("VlanHeader");
758 // parsing vlan header
759 int id = head & 0xfff;
760 int cfi = (head >> 12) & 0x1;
761 int pcp = (head >> 13) & 0x7;
762 int tag = (head >> 16) & 0xffff;
763 Assert.assertTrue(id == 1234);
764 Assert.assertTrue(cfi == 1);
765 Assert.assertTrue(pcp == 1);
766 Assert.assertTrue(tag == 0x8100);
768 if (act.getString("@type").equals("setNwTos"))
769 Assert.assertTrue(act.getInt("tos") == 16);
770 if (act.getString("@type").equals("setTpSrc"))
771 Assert.assertTrue(act.getInt("port") == 4201);
772 if (act.getString("@type").equals("setTpDst"))
773 Assert.assertTrue(act.getInt("port") == 8080);
777 public void testFlowProgrammer() throws JSONException {
778 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/flow/default/";
779 // Attempt to get a flow that doesn't exit. Should return 404
781 String result = getJsonResult(baseURL + "STUB/51966/test1", "GET");
782 Assert.assertTrue(result.equals("404"));
785 String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
786 result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc);
787 Assert.assertTrue(httpResponseCode == 201);
789 // test get returns flow that was added.
790 result = getJsonResult(baseURL + "STUB/51966/test1", "GET");
791 // check that result came out fine.
792 Assert.assertTrue(httpResponseCode == 200);
793 JSONTokener jt = new JSONTokener(result);
794 JSONObject json = new JSONObject(jt);
795 Assert.assertTrue(json.getString("name").equals("test1"));
796 Assert.assertTrue(json.getString("actions").equals("DROP"));
797 Assert.assertTrue(json.getString("installInHw").equals("true"));
798 JSONObject node = json.getJSONObject("node");
799 Assert.assertTrue(node.getString("@type").equals("STUB"));
800 Assert.assertTrue(node.getString("@id").equals("51966"));
801 // test adding same flow again fails due to repeat name..return 409
803 result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc);
804 Assert.assertTrue(result.equals("409"));
806 fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
807 result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc);
808 // test should return 500 for error due to same flow being added.
809 Assert.assertTrue(result.equals("500"));
811 // add second flow that's different
812 fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
813 result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc);
814 Assert.assertTrue(httpResponseCode == 201);
816 // check that request returns both flows given node.
817 result = getJsonResult(baseURL + "STUB/51966/", "GET");
818 jt = new JSONTokener(result);
819 json = new JSONObject(jt);
820 Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
821 JSONArray ja = json.getJSONArray("flowConfig");
822 Integer count = ja.length();
823 Assert.assertTrue(count == 2);
825 // check that request returns both flows given just container.
826 result = getJsonResult(baseURL);
827 jt = new JSONTokener(result);
828 json = new JSONObject(jt);
829 Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
830 ja = json.getJSONArray("flowConfig");
832 Assert.assertTrue(count == 2);
834 // delete a flow, check that it's no longer in list.
835 result = getJsonResult(baseURL + "STUB/51966/test2", "DELETE");
836 Assert.assertTrue(httpResponseCode == 200);
838 result = getJsonResult(baseURL + "STUB/51966/test2", "GET");
839 Assert.assertTrue(result.equals("404"));
842 // method to extract a JSONObject with specified node ID from a JSONObject
843 // that may contain an array of JSONObjects
844 // This is specifically written for statistics manager northbound REST
846 // array_name should be either "flowStatistics" or "portStatistics"
847 private JSONObject getJsonInstance(JSONObject json, String array_name,
848 Integer nodeId) throws JSONException {
849 JSONObject result = null;
850 if (json.get(array_name) instanceof JSONArray) {
851 JSONArray json_array = json.getJSONArray(array_name);
852 for (int i = 0; i < json_array.length(); i++) {
853 result = json_array.getJSONObject(i);
854 Integer nid = result.getJSONObject("node").getInt("@id");
855 if (nid.equals(nodeId))
859 result = json.getJSONObject(array_name);
860 Integer nid = result.getJSONObject("node").getInt("@id");
861 if (!nid.equals(nodeId))
867 // a class to construct query parameter for HTTP request
868 private class QueryParameter {
869 StringBuilder queryString = null;
872 QueryParameter(String key, String value) {
873 queryString = new StringBuilder();
874 queryString.append("?").append(key).append("=").append(value);
877 // method to add more query parameter
878 QueryParameter add(String key, String value) {
879 this.queryString.append("&").append(key).append("=").append(value);
883 // method to get the query parameter string
885 return this.queryString.toString();
891 public void testHostTracker() throws JSONException {
893 System.out.println("Starting HostTracker JAXB client.");
895 // setup 2 host models for @POST method
897 String networkAddress_1 = "192.168.0.8";
898 String dataLayerAddress_1 = "11:22:33:44:55:66";
899 String nodeType_1 = "STUB";
900 Integer nodeId_1 = 3366;
901 String nodeConnectorType_1 = "STUB";
902 Integer nodeConnectorId_1 = 12;
906 String networkAddress_2 = "10.1.1.1";
907 String dataLayerAddress_2 = "1A:2B:3C:4D:5E:6F";
908 String nodeType_2 = "STUB";
909 Integer nodeId_2 = 4477;
910 String nodeConnectorType_2 = "STUB";
911 Integer nodeConnectorId_2 = 34;
914 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/host/default";
916 // test POST method: addHost()
917 String queryParameter = new QueryParameter("dataLayerAddress",
918 dataLayerAddress_1).add("nodeType", nodeType_1)
919 .add("nodeId", nodeId_1.toString())
920 .add("nodeConnectorType", nodeConnectorType_1)
921 .add("nodeConnectorId", nodeConnectorId_1.toString())
922 .add("vlan", vlan_1).getString();
924 String result = getJsonResult(baseURL + "/" + networkAddress_1
925 + queryParameter, "POST");
926 Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201);
928 // vlan is not passed through query parameter but should be
930 queryParameter = new QueryParameter("dataLayerAddress",
931 dataLayerAddress_2).add("nodeType", nodeType_2)
932 .add("nodeId", nodeId_2.toString())
933 .add("nodeConnectorType", nodeConnectorType_2)
934 .add("nodeConnectorId", nodeConnectorId_2.toString())
937 result = getJsonResult(baseURL + "/" + networkAddress_2
938 + queryParameter, "POST");
939 Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201);
941 // define variables for decoding returned strings
942 String networkAddress;
943 JSONObject host_jo, dl_jo, nc_jo, node_jo;
945 // the two hosts should be in inactive host DB
946 // test GET method: getInactiveHosts()
947 result = getJsonResult(baseURL + "/inactive", "GET");
948 Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
950 JSONTokener jt = new JSONTokener(result);
951 JSONObject json = new JSONObject(jt);
952 // there should be at least two hosts in the DB
953 Assert.assertTrue(json.get("host") instanceof JSONArray);
954 JSONArray ja = json.getJSONArray("host");
955 Integer count = ja.length();
956 Assert.assertTrue(count == 2);
958 for (int i = 0; i < count; i++) {
959 host_jo = ja.getJSONObject(i);
960 dl_jo = host_jo.getJSONObject("dataLayerAddress");
961 nc_jo = host_jo.getJSONObject("nodeConnector");
962 node_jo = nc_jo.getJSONObject("node");
964 networkAddress = host_jo.getString("networkAddress");
965 if (networkAddress.equalsIgnoreCase(networkAddress_1)) {
966 Assert.assertTrue(dl_jo.getString("macAddress")
967 .equalsIgnoreCase(dataLayerAddress_1));
968 Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase(
969 nodeConnectorType_1));
970 Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1);
971 Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase(
973 Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1);
974 Assert.assertTrue(host_jo.getString("vlan").equalsIgnoreCase(
976 } else if (networkAddress.equalsIgnoreCase(networkAddress_2)) {
977 Assert.assertTrue(dl_jo.getString("macAddress")
978 .equalsIgnoreCase(dataLayerAddress_2));
979 Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase(
980 nodeConnectorType_2));
981 Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_2);
982 Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase(
984 Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_2);
985 Assert.assertTrue(host_jo.getString("vlan").equalsIgnoreCase(
988 Assert.assertTrue(false);
992 // test GET method: getActiveHosts() - no host expected
993 result = getJsonResult(baseURL, "GET");
994 Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
996 jt = new JSONTokener(result);
997 json = new JSONObject(jt);
998 Assert.assertFalse(hostInJson(json, networkAddress_1));
999 Assert.assertFalse(hostInJson(json, networkAddress_2));
1001 // put the 1st host into active host DB
1005 nd = new Node(nodeType_1, nodeId_1);
1006 ndc = new NodeConnector(nodeConnectorType_1, nodeConnectorId_1, nd);
1007 this.invtoryListener.notifyNodeConnector(ndc, UpdateType.ADDED,
1009 } catch (ConstructionException e) {
1014 // verify the host shows up in active host DB
1016 result = getJsonResult(baseURL, "GET");
1017 Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
1019 jt = new JSONTokener(result);
1020 json = new JSONObject(jt);
1022 Assert.assertTrue(hostInJson(json, networkAddress_1));
1024 // test GET method for getHostDetails()
1026 result = getJsonResult(baseURL + "/" + networkAddress_1, "GET");
1027 Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
1029 jt = new JSONTokener(result);
1030 json = new JSONObject(jt);
1032 Assert.assertFalse(json.length() == 0);
1034 dl_jo = json.getJSONObject("dataLayerAddress");
1035 nc_jo = json.getJSONObject("nodeConnector");
1036 node_jo = nc_jo.getJSONObject("node");
1038 Assert.assertTrue(json.getString("networkAddress").equalsIgnoreCase(
1040 Assert.assertTrue(dl_jo.getString("macAddress").equalsIgnoreCase(
1041 dataLayerAddress_1));
1042 Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase(
1043 nodeConnectorType_1));
1044 Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1);
1045 Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase(
1047 Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1);
1048 Assert.assertTrue(json.getString("vlan").equalsIgnoreCase(vlan_1));
1050 // test DELETE method for deleteFlow()
1052 result = getJsonResult(baseURL + "/" + networkAddress_1, "DELETE");
1053 Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
1055 // verify host_1 removed from active host DB
1056 // test GET method: getActiveHosts() - no host expected
1058 result = getJsonResult(baseURL, "GET");
1059 Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
1061 jt = new JSONTokener(result);
1062 json = new JSONObject(jt);
1064 Assert.assertFalse(hostInJson(json, networkAddress_1));
1068 private Boolean hostInJson(JSONObject json, String hostIp)
1069 throws JSONException {
1070 // input JSONObject may be empty
1071 if (json.length() == 0) {
1074 if (json.get("host") instanceof JSONArray) {
1075 JSONArray ja = json.getJSONArray("host");
1076 for (int i = 0; i < ja.length(); i++) {
1077 String na = ja.getJSONObject(i).getString("networkAddress");
1078 if (na.equalsIgnoreCase(hostIp))
1083 String na = json.getJSONObject("host").getString("networkAddress");
1084 return (na.equalsIgnoreCase(hostIp)) ? true : false;
1088 // Configure the OSGi container
1090 public Option[] config() {
1093 systemProperty("logback.configurationFile").value(
1094 "file:" + PathUtils.getBaseDir()
1095 + "/src/test/resources/logback.xml"),
1096 // To start OSGi console for inspection remotely
1097 systemProperty("osgi.console").value("2401"),
1098 systemProperty("org.eclipse.gemini.web.tomcat.config.path")
1099 .value(PathUtils.getBaseDir()
1100 + "/src/test/resources/tomcat-server.xml"),
1102 // setting default level. Jersey bundles will need to be started
1104 systemProperty("osgi.bundles.defaultStartLevel").value("4"),
1106 // Set the systemPackages (used by clustering)
1107 systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),
1108 mavenBundle("javax.servlet", "servlet-api", "2.5"),
1110 mavenBundle("org.slf4j", "jcl-over-slf4j", "1.7.2"),
1111 mavenBundle("org.slf4j", "slf4j-api", "1.7.2"),
1112 mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.2"),
1113 mavenBundle("ch.qos.logback", "logback-core", "1.0.9"),
1114 mavenBundle("ch.qos.logback", "logback-classic", "1.0.9"),
1115 mavenBundle("org.apache.commons", "commons-lang3", "3.1"),
1116 mavenBundle("org.apache.felix",
1117 "org.apache.felix.dependencymanager", "3.1.0"),
1119 // the plugin stub to get data for the tests
1120 mavenBundle("org.opendaylight.controller",
1121 "protocol_plugins.stub", "0.4.0-SNAPSHOT"),
1123 // List all the opendaylight modules
1124 mavenBundle("org.opendaylight.controller", "security",
1125 "0.4.0-SNAPSHOT").noStart(),
1126 mavenBundle("org.opendaylight.controller", "sal",
1128 mavenBundle("org.opendaylight.controller",
1129 "sal.implementation", "0.4.0-SNAPSHOT"),
1130 mavenBundle("org.opendaylight.controller", "statisticsmanager",
1132 mavenBundle("org.opendaylight.controller",
1133 "statisticsmanager.implementation", "0.4.0-SNAPSHOT"),
1134 mavenBundle("org.opendaylight.controller", "containermanager",
1136 mavenBundle("org.opendaylight.controller",
1137 "containermanager.implementation", "0.4.0-SNAPSHOT"),
1138 mavenBundle("org.opendaylight.controller",
1139 "forwardingrulesmanager", "0.4.0-SNAPSHOT"),
1140 mavenBundle("org.opendaylight.controller",
1141 "forwardingrulesmanager.implementation",
1143 mavenBundle("org.opendaylight.controller", "arphandler",
1145 mavenBundle("org.opendaylight.controller",
1146 "clustering.services", "0.4.0-SNAPSHOT"),
1147 mavenBundle("org.opendaylight.controller",
1148 "clustering.services-implementation", "0.4.0-SNAPSHOT"),
1149 mavenBundle("org.opendaylight.controller", "switchmanager",
1151 mavenBundle("org.opendaylight.controller",
1152 "switchmanager.implementation", "0.4.0-SNAPSHOT"),
1153 mavenBundle("org.opendaylight.controller", "configuration",
1155 mavenBundle("org.opendaylight.controller",
1156 "configuration.implementation", "0.4.0-SNAPSHOT"),
1157 mavenBundle("org.opendaylight.controller", "hosttracker",
1159 mavenBundle("org.opendaylight.controller",
1160 "hosttracker.implementation", "0.4.0-SNAPSHOT"),
1161 mavenBundle("org.opendaylight.controller", "arphandler",
1163 mavenBundle("org.opendaylight.controller",
1164 "routing.dijkstra_implementation", "0.4.0-SNAPSHOT"),
1165 mavenBundle("org.opendaylight.controller", "topologymanager",
1168 mavenBundle("org.opendaylight.controller", "usermanager",
1170 mavenBundle("org.opendaylight.controller",
1171 "usermanager.implementation", "0.4.0-SNAPSHOT"),
1172 mavenBundle("org.opendaylight.controller", "logging.bridge",
1174 mavenBundle("org.opendaylight.controller", "clustering.test",
1177 mavenBundle("org.opendaylight.controller",
1178 "forwarding.staticrouting", "0.4.0-SNAPSHOT"),
1180 // Northbound bundles
1181 mavenBundle("org.opendaylight.controller",
1182 "commons.northbound", "0.4.0-SNAPSHOT"),
1183 mavenBundle("org.opendaylight.controller",
1184 "forwarding.staticrouting.northbound", "0.4.0-SNAPSHOT"),
1185 mavenBundle("org.opendaylight.controller",
1186 "statistics.northbound", "0.4.0-SNAPSHOT"),
1187 mavenBundle("org.opendaylight.controller",
1188 "topology.northbound", "0.4.0-SNAPSHOT"),
1189 mavenBundle("org.opendaylight.controller",
1190 "hosttracker.northbound", "0.4.0-SNAPSHOT"),
1191 mavenBundle("org.opendaylight.controller",
1192 "switchmanager.northbound", "0.4.0-SNAPSHOT"),
1193 mavenBundle("org.opendaylight.controller",
1194 "flowprogrammer.northbound", "0.4.0-SNAPSHOT"),
1195 mavenBundle("org.opendaylight.controller",
1196 "subnets.northbound", "0.4.0-SNAPSHOT"),
1198 mavenBundle("org.codehaus.jackson", "jackson-mapper-asl",
1200 mavenBundle("org.codehaus.jackson", "jackson-core-asl", "1.9.8"),
1201 mavenBundle("org.codehaus.jackson", "jackson-jaxrs", "1.9.8"),
1202 mavenBundle("org.codehaus.jettison", "jettison", "1.3.3"),
1204 mavenBundle("commons-io", "commons-io", "2.3"),
1206 mavenBundle("commons-fileupload", "commons-fileupload", "1.2.2"),
1208 mavenBundle("equinoxSDK381", "javax.servlet",
1209 "3.0.0.v201112011016"),
1210 mavenBundle("equinoxSDK381", "javax.servlet.jsp",
1211 "2.2.0.v201112011158"),
1212 mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds",
1213 "1.4.0.v20120522-1841"),
1214 mavenBundle("orbit", "javax.xml.rpc", "1.1.0.v201005080400"),
1215 mavenBundle("equinoxSDK381", "org.eclipse.equinox.util",
1216 "1.0.400.v20120522-2049"),
1217 mavenBundle("equinoxSDK381", "org.eclipse.osgi.services",
1218 "3.3.100.v20120522-1822"),
1219 mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command",
1220 "0.8.0.v201108120515"),
1221 mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime",
1222 "0.8.0.v201108120515"),
1223 mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell",
1224 "0.8.0.v201110170705"),
1225 mavenBundle("equinoxSDK381", "org.eclipse.equinox.cm",
1226 "1.0.400.v20120522-1841"),
1227 mavenBundle("equinoxSDK381", "org.eclipse.equinox.console",
1228 "1.0.0.v20120522-1841"),
1229 mavenBundle("equinoxSDK381", "org.eclipse.equinox.launcher",
1230 "1.3.0.v20120522-1813"),
1232 mavenBundle("geminiweb", "org.eclipse.gemini.web.core",
1234 mavenBundle("geminiweb", "org.eclipse.gemini.web.extender",
1236 mavenBundle("geminiweb", "org.eclipse.gemini.web.tomcat",
1238 mavenBundle("geminiweb",
1239 "org.eclipse.virgo.kernel.equinox.extensions",
1240 "3.6.0.RELEASE").noStart(),
1241 mavenBundle("geminiweb", "org.eclipse.virgo.util.common",
1243 mavenBundle("geminiweb", "org.eclipse.virgo.util.io",
1245 mavenBundle("geminiweb", "org.eclipse.virgo.util.math",
1247 mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi",
1249 mavenBundle("geminiweb",
1250 "org.eclipse.virgo.util.osgi.manifest", "3.6.0.RELEASE"),
1251 mavenBundle("geminiweb",
1252 "org.eclipse.virgo.util.parser.manifest",
1255 mavenBundle("org.apache.felix",
1256 "org.apache.felix.dependencymanager", "3.1.0"),
1257 mavenBundle("org.apache.felix",
1258 "org.apache.felix.dependencymanager.shell", "3.0.1"),
1260 mavenBundle("com.google.code.gson", "gson", "2.1"),
1261 mavenBundle("org.jboss.spec.javax.transaction",
1262 "jboss-transaction-api_1.1_spec", "1.0.1.Final"),
1263 mavenBundle("org.apache.felix", "org.apache.felix.fileinstall",
1265 mavenBundle("org.apache.commons", "commons-lang3", "3.1"),
1266 mavenBundle("commons-codec", "commons-codec"),
1267 mavenBundle("virgomirror",
1268 "org.eclipse.jdt.core.compiler.batch",
1269 "3.8.0.I20120518-2145"),
1270 mavenBundle("eclipselink", "javax.persistence",
1271 "2.0.4.v201112161009"),
1273 mavenBundle("orbit", "javax.activation", "1.1.0.v201211130549"),
1274 mavenBundle("orbit", "javax.annotation", "1.1.0.v201209060031"),
1275 mavenBundle("orbit", "javax.ejb", "3.1.1.v201204261316"),
1276 mavenBundle("orbit", "javax.el", "2.2.0.v201108011116"),
1277 mavenBundle("orbit", "javax.mail.glassfish",
1278 "1.4.1.v201108011116"),
1279 mavenBundle("orbit", "javax.xml.rpc", "1.1.0.v201005080400"),
1280 mavenBundle("orbit", "org.apache.catalina",
1281 "7.0.32.v201211201336"),
1282 // these are bundle fragments that can't be started on its own
1283 mavenBundle("orbit", "org.apache.catalina.ha",
1284 "7.0.32.v201211201952").noStart(),
1285 mavenBundle("orbit", "org.apache.catalina.tribes",
1286 "7.0.32.v201211201952").noStart(),
1287 mavenBundle("orbit", "org.apache.coyote",
1288 "7.0.32.v201211201952").noStart(),
1289 mavenBundle("orbit", "org.apache.jasper",
1290 "7.0.32.v201211201952").noStart(),
1292 mavenBundle("orbit", "org.apache.el", "7.0.32.v201211081135"),
1293 mavenBundle("orbit", "org.apache.juli.extras",
1294 "7.0.32.v201211081135"),
1295 mavenBundle("orbit", "org.apache.tomcat.api",
1296 "7.0.32.v201211081135"),
1297 mavenBundle("orbit", "org.apache.tomcat.util",
1298 "7.0.32.v201211201952").noStart(),
1299 mavenBundle("orbit", "javax.servlet.jsp.jstl",
1300 "1.2.0.v201105211821"),
1301 mavenBundle("orbit", "javax.servlet.jsp.jstl.impl",
1302 "1.2.0.v201210211230"),
1304 mavenBundle("org.ops4j.pax.exam", "pax-exam-container-native"),
1305 mavenBundle("org.ops4j.pax.exam", "pax-exam-junit4"),
1306 mavenBundle("org.ops4j.pax.exam", "pax-exam-link-mvn"),
1307 mavenBundle("org.ops4j.pax.url", "pax-url-aether"),
1309 mavenBundle("org.springframework", "org.springframework.asm",
1311 mavenBundle("org.springframework", "org.springframework.aop",
1313 mavenBundle("org.springframework",
1314 "org.springframework.context", "3.1.3.RELEASE"),
1315 mavenBundle("org.springframework",
1316 "org.springframework.context.support", "3.1.3.RELEASE"),
1317 mavenBundle("org.springframework", "org.springframework.core",
1319 mavenBundle("org.springframework", "org.springframework.beans",
1321 mavenBundle("org.springframework",
1322 "org.springframework.expression", "3.1.3.RELEASE"),
1323 mavenBundle("org.springframework", "org.springframework.web",
1326 mavenBundle("org.aopalliance",
1327 "com.springsource.org.aopalliance", "1.0.0"),
1328 mavenBundle("org.springframework",
1329 "org.springframework.web.servlet", "3.1.3.RELEASE"),
1330 mavenBundle("org.springframework.security",
1331 "spring-security-config", "3.1.3.RELEASE"),
1332 mavenBundle("org.springframework.security",
1333 "spring-security-core", "3.1.3.RELEASE"),
1334 mavenBundle("org.springframework.security",
1335 "spring-security-web", "3.1.3.RELEASE"),
1336 mavenBundle("org.springframework.security",
1337 "spring-security-taglibs", "3.1.3.RELEASE"),
1338 mavenBundle("org.springframework",
1339 "org.springframework.transaction", "3.1.3.RELEASE"),
1341 mavenBundle("org.ow2.chameleon.management", "chameleon-mbeans",
1343 mavenBundle("org.opendaylight.controller.thirdparty",
1344 "net.sf.jung2", "2.0.1-SNAPSHOT"),
1345 mavenBundle("org.opendaylight.controller.thirdparty",
1346 "com.sun.jersey.jersey-servlet", "1.17-SNAPSHOT"),
1348 // Jersey needs to be started before the northbound application
1349 // bundles, using a lower start level
1350 mavenBundle("com.sun.jersey", "jersey-client", "1.17"),
1351 mavenBundle("com.sun.jersey", "jersey-server", "1.17")
1353 mavenBundle("com.sun.jersey", "jersey-core", "1.17")
1355 mavenBundle("com.sun.jersey", "jersey-json", "1.17")
1356 .startLevel(2), junitBundles());