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.io.BufferedReader;
12 import java.io.InputStream;
13 import java.io.InputStreamReader;
14 import java.io.OutputStreamWriter;
15 import java.net.HttpURLConnection;
17 import java.nio.charset.Charset;
18 import java.util.ArrayList;
19 import java.util.Arrays;
20 import java.util.HashSet;
21 import java.util.List;
24 import javax.inject.Inject;
26 import org.apache.commons.codec.binary.Base64;
27 import org.codehaus.jettison.json.JSONArray;
28 import org.codehaus.jettison.json.JSONException;
29 import org.codehaus.jettison.json.JSONObject;
30 import org.codehaus.jettison.json.JSONTokener;
31 import org.junit.Assert;
32 import org.junit.Before;
33 import org.junit.Test;
34 import org.junit.runner.RunWith;
35 import org.opendaylight.controller.hosttracker.IfIptoHost;
36 import org.opendaylight.controller.sal.core.Bandwidth;
37 import org.opendaylight.controller.sal.core.ConstructionException;
38 import org.opendaylight.controller.sal.core.Edge;
39 import org.opendaylight.controller.sal.core.Latency;
40 import org.opendaylight.controller.sal.core.Node;
41 import org.opendaylight.controller.sal.core.NodeConnector;
42 import org.opendaylight.controller.sal.core.Property;
43 import org.opendaylight.controller.sal.core.State;
44 import org.opendaylight.controller.sal.core.UpdateType;
45 import org.opendaylight.controller.sal.topology.IListenTopoUpdates;
46 import org.opendaylight.controller.sal.topology.TopoEdgeUpdate;
47 import org.opendaylight.controller.switchmanager.IInventoryListener;
48 import org.opendaylight.controller.usermanager.IUserManager;
49 import org.ops4j.pax.exam.Option;
50 import org.ops4j.pax.exam.junit.Configuration;
51 import org.ops4j.pax.exam.junit.PaxExam;
52 import org.ops4j.pax.exam.util.PathUtils;
53 import org.osgi.framework.Bundle;
54 import org.osgi.framework.BundleContext;
55 import org.osgi.framework.ServiceReference;
56 import org.slf4j.Logger;
57 import org.slf4j.LoggerFactory;
59 @RunWith(PaxExam.class)
60 public class NorthboundIT {
61 private final Logger log = LoggerFactory.getLogger(NorthboundIT.class);
62 // get the OSGI bundle context
64 private BundleContext bc;
65 private IUserManager userManager = null;
66 private IInventoryListener invtoryListener = null;
67 private IListenTopoUpdates topoUpdates = null;
69 private final Boolean debugMsg = false;
71 private String stateToString(int state) {
75 case Bundle.INSTALLED:
79 case Bundle.UNINSTALLED:
82 return "Not CONVERTED";
87 public void areWeReady() {
89 boolean debugit = false;
90 Bundle b[] = bc.getBundles();
91 for (Bundle element : b) {
92 int state = element.getState();
93 if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {
94 log.debug("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state));
99 log.debug("Do some debugging because some bundle is " + "unresolved");
101 // Assert if true, if false we are good to go!
102 assertFalse(debugit);
104 ServiceReference r = bc.getServiceReference(IUserManager.class.getName());
106 this.userManager = (IUserManager) bc.getService(r);
108 // If UserManager is null, cannot login to run tests.
109 assertNotNull(this.userManager);
111 r = bc.getServiceReference(IfIptoHost.class.getName());
113 this.invtoryListener = (IInventoryListener) bc.getService(r);
116 // If inventoryListener is null, cannot run hosttracker tests.
117 assertNotNull(this.invtoryListener);
119 r = bc.getServiceReference(IListenTopoUpdates.class.getName());
121 this.topoUpdates = (IListenTopoUpdates) bc.getService(r);
124 // If topologyManager is null, cannot run topology North tests.
125 assertNotNull(this.topoUpdates);
129 // static variable to pass response code from getJsonResult()
130 private static Integer httpResponseCode = null;
132 private String getJsonResult(String restUrl) {
133 return getJsonResult(restUrl, "GET", null);
136 private String getJsonResult(String restUrl, String method) {
137 return getJsonResult(restUrl, method, null);
140 private String getJsonResult(String restUrl, String method, String body) {
141 // initialize response code to indicate error
142 httpResponseCode = 400;
145 System.out.println("HTTP method: " + method + " url: " + restUrl.toString());
147 System.out.println("body: " + body);
152 URL url = new URL(restUrl);
153 this.userManager.getAuthorizationList();
154 this.userManager.authenticate("admin", "admin");
155 String authString = "admin:admin";
156 byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
157 String authStringEnc = new String(authEncBytes);
159 HttpURLConnection connection = (HttpURLConnection) url.openConnection();
160 connection.setRequestMethod(method);
161 connection.setRequestProperty("Authorization", "Basic " + authStringEnc);
162 connection.setRequestProperty("Content-Type", "application/json");
163 connection.setRequestProperty("Accept", "application/json");
166 connection.setDoOutput(true);
167 OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream());
171 connection.connect();
172 connection.getContentType();
174 // Response code for success should be 2xx
175 httpResponseCode = connection.getResponseCode();
176 if (httpResponseCode > 299) {
177 return httpResponseCode.toString();
181 System.out.println("HTTP response code: " + connection.getResponseCode());
182 System.out.println("HTTP response message: " + connection.getResponseMessage());
185 InputStream is = connection.getInputStream();
186 BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
187 StringBuilder sb = new StringBuilder();
189 while ((cp = rd.read()) != -1) {
190 sb.append((char) cp);
193 connection.disconnect();
195 System.out.println("Response : "+sb.toString());
197 return sb.toString();
198 } catch (Exception e) {
203 private void testNodeProperties(JSONObject node, Integer nodeId, String nodeType, Integer timestamp,
204 String timestampName, Integer actionsValue, Integer capabilitiesValue, Integer tablesValue,
205 Integer buffersValue) throws JSONException {
207 JSONObject nodeInfo = node.getJSONObject("node");
208 Assert.assertEquals(nodeId, (Integer) nodeInfo.getInt("id"));
209 Assert.assertEquals(nodeType, nodeInfo.getString("type"));
211 JSONArray propsArray = node.getJSONArray("properties");
213 for (int j = 0; j < propsArray.length(); j++) {
214 JSONObject properties = propsArray.getJSONObject(j);
215 String propName = properties.getString("name");
216 if (propName.equals("timeStamp")) {
217 if (timestamp == null || timestampName == null) {
218 Assert.assertFalse("Timestamp exist", true);
220 Assert.assertEquals(timestamp, (Integer) properties.getInt("value"));
221 Assert.assertEquals(timestampName, properties.getString("timestampName"));
224 if (propName.equals("actions")) {
225 if (actionsValue == null) {
226 Assert.assertFalse("Actions exist", true);
228 Assert.assertEquals(actionsValue, (Integer) properties.getInt("value"));
231 if (propName.equals("capabilities")) {
232 if (capabilitiesValue == null) {
233 Assert.assertFalse("Capabilities exist", true);
235 Assert.assertEquals(capabilitiesValue, (Integer) properties.getInt("value"));
238 if (propName.equals("tables")) {
239 if (tablesValue == null) {
240 Assert.assertFalse("Tables exist", true);
242 Assert.assertEquals(tablesValue, (Integer) properties.getInt("value"));
245 if (propName.equals("buffers")) {
246 if (buffersValue == null) {
247 Assert.assertFalse("Buffers exist", true);
249 Assert.assertEquals(buffersValue, (Integer) properties.getInt("value"));
255 private void testNodeConnectorProperties(JSONObject nodeConnectorProperties, Integer ncId, String ncType,
256 Integer nodeId, String nodeType, Integer state, Integer capabilities, Integer bandwidth)
257 throws JSONException {
259 JSONObject nodeConnector = nodeConnectorProperties.getJSONObject("nodeconnector");
260 JSONObject node = nodeConnector.getJSONObject("node");
262 Assert.assertEquals(ncId, (Integer) nodeConnector.getInt("id"));
263 Assert.assertEquals(ncType, nodeConnector.getString("type"));
264 Assert.assertEquals(nodeId, (Integer) node.getInt("id"));
265 Assert.assertEquals(nodeType, node.getString("type"));
267 JSONArray propsArray = nodeConnectorProperties.getJSONArray("properties");
268 for (int j = 0; j < propsArray.length(); j++) {
269 JSONObject properties = propsArray.getJSONObject(j);
270 String propName = properties.getString("name");
271 if (propName.equals("state")) {
273 Assert.assertFalse("State exist", true);
275 Assert.assertEquals(state, (Integer) properties.getInt("value"));
278 if (propName.equals("capabilities")) {
279 if (capabilities == null) {
280 Assert.assertFalse("Capabilities exist", true);
282 Assert.assertEquals(capabilities, (Integer) properties.getInt("value"));
285 if (propName.equals("bandwidth")) {
286 if (bandwidth == null) {
287 Assert.assertFalse("bandwidth exist", true);
289 Assert.assertEquals(bandwidth, (Integer) properties.getInt("value"));
296 public void testSubnetsNorthbound() throws JSONException, ConstructionException {
297 System.out.println("Starting Subnets JAXB client.");
298 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/subnetservice/";
300 String name1 = "testSubnet1";
301 String subnet1 = "1.1.1.1/24";
303 String name2 = "testSubnet2";
304 String subnet2 = "2.2.2.2/24";
306 String name3 = "testSubnet3";
307 String subnet3 = "3.3.3.3/24";
310 * Create the node connector string list for the two subnets as:
311 * 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"};
312 * 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"};
314 Node node2 = new Node(Node.NodeIDType.OPENFLOW, 2L);
315 List<String> portList2 = new ArrayList<String>();
316 NodeConnector nc21 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)1, node2);
317 NodeConnector nc22 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)2, node2);
318 NodeConnector nc23 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)3, node2);
319 NodeConnector nc24 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)3, node2);
320 portList2.add(nc21.toString());
321 portList2.add(nc22.toString());
322 portList2.add(nc23.toString());
323 portList2.add(nc24.toString());
325 List<String> portList3 = new ArrayList<String>();
326 Node node3 = new Node(Node.NodeIDType.OPENFLOW, 3L);
327 NodeConnector nc31 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)1, node3);
328 NodeConnector nc32 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)2, node3);
329 NodeConnector nc33 = new NodeConnector(NodeConnector.NodeConnectorIDType.OPENFLOW, (short)3, node3);
330 portList3.add(nc31.toString());
331 portList3.add(nc32.toString());
332 portList3.add(nc33.toString());
334 // Test GET subnets in default container
335 String result = getJsonResult(baseURL + "default/subnets");
336 JSONTokener jt = new JSONTokener(result);
337 JSONObject json = new JSONObject(jt);
338 JSONArray subnetConfigs = json.getJSONArray("subnetConfig");
339 Assert.assertEquals(subnetConfigs.length(), 0);
341 // Test GET subnet1 expecting 404
342 result = getJsonResult(baseURL + "default/subnet/" + name1);
343 Assert.assertEquals(404, httpResponseCode.intValue());
346 JSONObject jo = new JSONObject().put("name", name1).put("subnet", subnet1);
347 // execute HTTP request and verify response code
348 result = getJsonResult(baseURL + "default/subnet/" + name1, "PUT", jo.toString());
349 Assert.assertTrue(httpResponseCode == 201);
352 result = getJsonResult(baseURL + "default/subnet/" + name1);
353 jt = new JSONTokener(result);
354 json = new JSONObject(jt);
355 Assert.assertEquals(200, httpResponseCode.intValue());
356 Assert.assertEquals(name1, json.getString("name"));
357 Assert.assertEquals(subnet1, json.getString("subnet"));
360 JSONObject jo2 = new JSONObject().put("name", name2).put("subnet", subnet2).put("nodeConnectors", portList2);
361 // execute HTTP request and verify response code
362 result = getJsonResult(baseURL + "default/subnet/" + name2, "PUT", jo2.toString());
363 Assert.assertEquals(201, httpResponseCode.intValue());
365 JSONObject jo3 = new JSONObject().put("name", name3).put("subnet", subnet3);
366 // execute HTTP request and verify response code
367 result = getJsonResult(baseURL + "default/subnet/" + name3, "PUT", jo3.toString());
368 Assert.assertEquals(201, httpResponseCode.intValue());
369 // Test POST subnet3 (modify port list: add)
370 JSONObject jo3New = new JSONObject().put("name", name3).put("subnet", subnet3).put("nodeConnectors", portList3);
371 // execute HTTP request and verify response code
372 result = getJsonResult(baseURL + "default/subnet/" + name3, "POST", jo3New.toString());
373 Assert.assertEquals(200, httpResponseCode.intValue());
375 // Test GET all subnets in default container
376 result = getJsonResult(baseURL + "default/subnets");
377 jt = new JSONTokener(result);
378 json = new JSONObject(jt);
379 JSONArray subnetConfigArray = json.getJSONArray("subnetConfig");
380 JSONObject subnetConfig;
381 Assert.assertEquals(3, subnetConfigArray.length());
382 for (int i = 0; i < subnetConfigArray.length(); i++) {
383 subnetConfig = subnetConfigArray.getJSONObject(i);
384 if (subnetConfig.getString("name").equals(name1)) {
385 Assert.assertEquals(subnet1, subnetConfig.getString("subnet"));
386 } else if (subnetConfig.getString("name").equals(name2)) {
387 Assert.assertEquals(subnet2, subnetConfig.getString("subnet"));
388 JSONArray portListGet = subnetConfig.getJSONArray("nodeConnectors");
389 Assert.assertEquals(portList2.get(0), portListGet.get(0));
390 Assert.assertEquals(portList2.get(1), portListGet.get(1));
391 Assert.assertEquals(portList2.get(2), portListGet.get(2));
392 Assert.assertEquals(portList2.get(3), portListGet.get(3));
393 } else if (subnetConfig.getString("name").equals(name3)) {
394 Assert.assertEquals(subnet3, subnetConfig.getString("subnet"));
395 JSONArray portListGet = subnetConfig.getJSONArray("nodeConnectors");
396 Assert.assertEquals(portList3.get(0), portListGet.get(0));
397 Assert.assertEquals(portList3.get(1), portListGet.get(1));
398 Assert.assertEquals(portList3.get(2), portListGet.get(2));
400 // Unexpected config name
401 Assert.assertTrue(false);
405 // Test POST subnet2 (modify port list: remove one port only)
406 List<String> newPortList2 = new ArrayList<String>(portList2);
407 newPortList2.remove(3);
408 JSONObject jo2New = new JSONObject().put("name", name2).put("subnet", subnet2).put("nodeConnectors", newPortList2);
409 // execute HTTP request and verify response code
410 result = getJsonResult(baseURL + "default/subnet/" + name2, "POST", jo2New.toString());
411 Assert.assertEquals(200, httpResponseCode.intValue());
413 // Test GET subnet2: verify contains only the first three ports
414 result = getJsonResult(baseURL + "default/subnet/" + name2);
415 jt = new JSONTokener(result);
416 subnetConfig = new JSONObject(jt);
417 Assert.assertEquals(200, httpResponseCode.intValue());
418 JSONArray portListGet2 = subnetConfig.getJSONArray("nodeConnectors");
419 Assert.assertEquals(portList2.get(0), portListGet2.get(0));
420 Assert.assertEquals(portList2.get(1), portListGet2.get(1));
421 Assert.assertEquals(portList2.get(2), portListGet2.get(2));
422 Assert.assertTrue(portListGet2.length() == 3);
424 // Test DELETE subnet1
425 result = getJsonResult(baseURL + "default/subnet/" + name1, "DELETE");
426 Assert.assertEquals(204, httpResponseCode.intValue());
428 // Test GET deleted subnet1
429 result = getJsonResult(baseURL + "default/subnet/" + name1);
430 Assert.assertEquals(404, httpResponseCode.intValue());
432 // TEST PUT bad subnet, expect 400, validate JSON exception mapper
433 JSONObject joBad = new JSONObject().put("foo", "bar");
434 result = getJsonResult(baseURL + "default/subnet/foo", "PUT", joBad.toString());
435 Assert.assertEquals(400, httpResponseCode.intValue());
439 public void testStaticRoutingNorthbound() throws JSONException {
440 System.out.println("Starting StaticRouting JAXB client.");
441 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/staticroute/";
443 String name1 = "testRoute1";
444 String prefix1 = "192.168.1.1/24";
445 String nextHop1 = "0.0.0.0";
446 String name2 = "testRoute2";
447 String prefix2 = "192.168.1.1/16";
448 String nextHop2 = "1.1.1.1";
450 // Test GET static routes in default container, expecting no results
451 String result = getJsonResult(baseURL + "default/routes");
452 JSONTokener jt = new JSONTokener(result);
453 JSONObject json = new JSONObject(jt);
454 JSONArray staticRoutes = json.getJSONArray("staticRoute");
455 Assert.assertEquals(staticRoutes.length(), 0);
457 // Test insert static route
458 String requestBody = "{\"name\":\"" + name1 + "\", \"prefix\":\"" + prefix1 + "\", \"nextHop\":\"" + nextHop1
460 result = getJsonResult(baseURL + "default/route/" + name1, "PUT", requestBody);
461 Assert.assertEquals(201, httpResponseCode.intValue());
463 requestBody = "{\"name\":\"" + name2 + "\", \"prefix\":\"" + prefix2 + "\", \"nextHop\":\"" + nextHop2 + "\"}";
464 result = getJsonResult(baseURL + "default/route/" + name2, "PUT", requestBody);
465 Assert.assertEquals(201, httpResponseCode.intValue());
467 // Test Get all static routes
468 result = getJsonResult(baseURL + "default/routes");
469 jt = new JSONTokener(result);
470 json = new JSONObject(jt);
471 JSONArray staticRouteArray = json.getJSONArray("staticRoute");
472 Assert.assertEquals(2, staticRouteArray.length());
474 for (int i = 0; i < staticRoutes.length(); i++) {
475 route = staticRoutes.getJSONObject(i);
476 if (route.getString("name").equals(name1)) {
477 Assert.assertEquals(prefix1, route.getString("prefix"));
478 Assert.assertEquals(nextHop1, route.getString("nextHop"));
479 } else if (route.getString("name").equals(name2)) {
480 Assert.assertEquals(prefix2, route.getString("prefix"));
481 Assert.assertEquals(nextHop2, route.getString("nextHop"));
483 // static route has unknown name
484 Assert.assertTrue(false);
488 // Test get specific static route
489 result = getJsonResult(baseURL + "default/route/" + name1);
490 jt = new JSONTokener(result);
491 json = new JSONObject(jt);
493 Assert.assertEquals(name1, json.getString("name"));
494 Assert.assertEquals(prefix1, json.getString("prefix"));
495 Assert.assertEquals(nextHop1, json.getString("nextHop"));
497 result = getJsonResult(baseURL + "default/route/" + name2);
498 jt = new JSONTokener(result);
499 json = new JSONObject(jt);
501 Assert.assertEquals(name2, json.getString("name"));
502 Assert.assertEquals(prefix2, json.getString("prefix"));
503 Assert.assertEquals(nextHop2, json.getString("nextHop"));
505 // Test delete static route
506 result = getJsonResult(baseURL + "default/route/" + name1, "DELETE");
507 Assert.assertEquals(204, httpResponseCode.intValue());
509 result = getJsonResult(baseURL + "default/routes");
510 jt = new JSONTokener(result);
511 json = new JSONObject(jt);
513 staticRouteArray = json.getJSONArray("staticRoute");
514 JSONObject singleStaticRoute = staticRouteArray.getJSONObject(0);
515 Assert.assertEquals(name2, singleStaticRoute.getString("name"));
520 public void testSwitchManager() throws JSONException {
521 System.out.println("Starting SwitchManager JAXB client.");
522 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/switchmanager/default/";
524 // define Node/NodeConnector attributes for test
525 int nodeId_1 = 51966;
528 int nodeConnectorId_1 = 51966;
529 int nodeConnectorId_2 = 12;
530 int nodeConnectorId_3 = 34;
531 String nodeType = "STUB";
532 String ncType = "STUB";
533 int timestamp_1 = 100000;
534 String timestampName_1 = "connectedSince";
535 int actionsValue_1 = 2;
536 int capabilitiesValue_1 = 3;
537 int tablesValue_1 = 1;
538 int buffersValue_1 = 1;
540 int ncCapabilities = 1;
541 int ncBandwidth = 1000000000;
543 // Test GET all nodes
545 String result = getJsonResult(baseURL + "nodes");
546 JSONTokener jt = new JSONTokener(result);
547 JSONObject json = new JSONObject(jt);
549 // Test for first node
550 JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1);
551 Assert.assertNotNull(node);
552 testNodeProperties(node, nodeId_1, nodeType, timestamp_1, timestampName_1, actionsValue_1, capabilitiesValue_1,
553 tablesValue_1, buffersValue_1);
555 // Test 2nd node, properties of 2nd node same as first node
556 node = getJsonInstance(json, "nodeProperties", nodeId_2);
557 Assert.assertNotNull(node);
558 testNodeProperties(node, nodeId_2, nodeType, timestamp_1, timestampName_1, actionsValue_1, capabilitiesValue_1,
559 tablesValue_1, buffersValue_1);
561 // Test 3rd node, properties of 3rd node same as first node
562 node = getJsonInstance(json, "nodeProperties", nodeId_3);
563 Assert.assertNotNull(node);
564 testNodeProperties(node, nodeId_3, nodeType, timestamp_1, timestampName_1, actionsValue_1, capabilitiesValue_1,
565 tablesValue_1, buffersValue_1);
567 // Test GET nodeConnectors of a node
569 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
570 jt = new JSONTokener(result);
571 json = new JSONObject(jt);
572 JSONArray nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
573 JSONObject nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
575 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, ncState,
576 ncCapabilities, ncBandwidth);
579 result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
580 jt = new JSONTokener(result);
581 json = new JSONObject(jt);
583 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
584 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
587 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
588 ncCapabilities, ncBandwidth);
591 result = getJsonResult(baseURL + "node/STUB/" + nodeId_3);
592 jt = new JSONTokener(result);
593 json = new JSONObject(jt);
595 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
596 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
597 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_3, ncType, nodeId_3, nodeType, ncState,
598 ncCapabilities, ncBandwidth);
600 // Test add property to node
601 // Add Tier and Description property to node1
602 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 + "/property/tier/1001", "PUT");
603 Assert.assertEquals(201, httpResponseCode.intValue());
604 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1 + "/property/description/node1", "PUT");
605 Assert.assertEquals(201, httpResponseCode.intValue());
607 // Test for first node
608 result = getJsonResult(baseURL + "nodes");
609 jt = new JSONTokener(result);
610 json = new JSONObject(jt);
611 node = getJsonInstance(json, "nodeProperties", nodeId_1);
612 Assert.assertNotNull(node);
614 JSONArray propsArray = node.getJSONArray("properties");
616 for (int j = 0; j < propsArray.length(); j++) {
617 JSONObject properties = propsArray.getJSONObject(j);
618 String propName = properties.getString("name");
619 if (propName.equals("tier")) {
620 Assert.assertEquals(1001, properties.getInt("value"));
622 if (propName.equals("description")) {
623 Assert.assertEquals("node1", properties.getString("value"));
627 // Test delete nodeConnector property
628 // Delete state property of nodeconnector1
629 result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1 + "/STUB/" + nodeConnectorId_1
630 + "/property/state", "DELETE");
631 Assert.assertEquals(204, httpResponseCode.intValue());
633 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
634 jt = new JSONTokener(result);
635 json = new JSONObject(jt);
636 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
637 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
639 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, null,
640 ncCapabilities, ncBandwidth);
642 // Delete capabilities property of nodeconnector2
643 result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_2 + "/STUB/" + nodeConnectorId_2
644 + "/property/capabilities", "DELETE");
645 Assert.assertEquals(204, httpResponseCode.intValue());
647 result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
648 jt = new JSONTokener(result);
649 json = new JSONObject(jt);
650 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
651 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
653 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
656 // Test PUT nodeConnector property
657 int newBandwidth = 1001;
659 // Add Name/Bandwidth property to nodeConnector1
660 result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1 + "/STUB/" + nodeConnectorId_1
661 + "/property/bandwidth/" + newBandwidth, "PUT");
662 Assert.assertEquals(201, httpResponseCode.intValue());
664 result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
665 jt = new JSONTokener(result);
666 json = new JSONObject(jt);
667 nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
668 nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
670 // Check for new bandwidth value, state value removed from previous
672 testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, null,
673 ncCapabilities, newBandwidth);
678 public void testStatistics() throws JSONException {
679 final String actionTypes[] = { "DROP", "LOOPBACK", "FLOOD", "FLOOD_ALL", "CONTROLLER", "SW_PATH", "HW_PATH", "OUTPUT",
680 "SET_DL_SRC", "SET_DL_DST", "SET_DL_TYPE", "SET_VLAN_ID", "SET_VLAN_PCP", "SET_VLAN_CFI", "POP_VLAN", "PUSH_VLAN",
681 "SET_NW_SRC", "SET_NW_DST", "SET_NW_TOS", "SET_TP_SRC", "SET_TP_DST" };
682 System.out.println("Starting Statistics JAXB client.");
684 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/statistics/default/";
686 String result = getJsonResult(baseURL + "flow");
687 JSONTokener jt = new JSONTokener(result);
688 JSONObject json = new JSONObject(jt);
689 JSONObject flowStatistics = getJsonInstance(json, "flowStatistics", 0xCAFE);
690 JSONObject node = flowStatistics.getJSONObject("node");
691 // test that node was returned properly
692 Assert.assertTrue(node.getInt("id") == 0xCAFE);
693 Assert.assertEquals(node.getString("type"), "STUB");
695 // test that flow statistics results are correct
696 JSONArray flowStats = flowStatistics.getJSONArray("flowStatistic");
697 for (int i = 0; i < flowStats.length(); i++) {
699 JSONObject flowStat = flowStats.getJSONObject(i);
700 testFlowStat(flowStat, actionTypes[i], i);
704 // for /controller/nb/v2/statistics/default/port
705 result = getJsonResult(baseURL + "port");
706 jt = new JSONTokener(result);
707 json = new JSONObject(jt);
708 JSONObject portStatistics = getJsonInstance(json, "portStatistics", 0xCAFE);
709 JSONObject node2 = portStatistics.getJSONObject("node");
710 // test that node was returned properly
711 Assert.assertTrue(node2.getInt("id") == 0xCAFE);
712 Assert.assertEquals(node2.getString("type"), "STUB");
714 // test that port statistic results are correct
715 JSONArray portStatArray = portStatistics.getJSONArray("portStatistic");
716 JSONObject portStat = portStatArray.getJSONObject(0);
717 Assert.assertTrue(portStat.getInt("receivePackets") == 250);
718 Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
719 Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
720 Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
721 Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
722 Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
723 Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
724 Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
725 Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
726 Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
727 Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
728 Assert.assertTrue(portStat.getInt("collisionCount") == 4);
730 // test for getting one specific node's stats
731 result = getJsonResult(baseURL + "flow/node/STUB/51966");
732 jt = new JSONTokener(result);
733 json = new JSONObject(jt);
734 node = json.getJSONObject("node");
735 // test that node was returned properly
736 Assert.assertTrue(node.getInt("id") == 0xCAFE);
737 Assert.assertEquals(node.getString("type"), "STUB");
739 // test that flow statistics results are correct
740 flowStats = json.getJSONArray("flowStatistic");
741 for (int i = 0; i < flowStats.length(); i++) {
742 JSONObject flowStat = flowStats.getJSONObject(i);
743 testFlowStat(flowStat, actionTypes[i], i);
746 result = getJsonResult(baseURL + "port/node/STUB/51966");
747 jt = new JSONTokener(result);
748 json = new JSONObject(jt);
749 node2 = json.getJSONObject("node");
750 // test that node was returned properly
751 Assert.assertTrue(node2.getInt("id") == 0xCAFE);
752 Assert.assertEquals(node2.getString("type"), "STUB");
754 // test that port statistic results are correct
755 portStatArray = json.getJSONArray("portStatistic");
756 portStat = portStatArray.getJSONObject(0);
758 Assert.assertTrue(portStat.getInt("receivePackets") == 250);
759 Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
760 Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
761 Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
762 Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
763 Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
764 Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
765 Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
766 Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
767 Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
768 Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
769 Assert.assertTrue(portStat.getInt("collisionCount") == 4);
772 private void testFlowStat(JSONObject flowStat, String actionType, int actIndex) throws JSONException {
773 Assert.assertTrue(flowStat.getInt("tableId") == 1);
774 Assert.assertTrue(flowStat.getInt("durationSeconds") == 40);
775 Assert.assertTrue(flowStat.getInt("durationNanoseconds") == 400);
776 Assert.assertTrue(flowStat.getInt("packetCount") == 200);
777 Assert.assertTrue(flowStat.getInt("byteCount") == 100);
779 // test that flow information is correct
780 JSONObject flow = flowStat.getJSONObject("flow");
781 Assert.assertTrue(flow.getInt("priority") == (3500 + actIndex));
782 Assert.assertTrue(flow.getInt("idleTimeout") == 1000);
783 Assert.assertTrue(flow.getInt("hardTimeout") == 2000);
784 Assert.assertTrue(flow.getInt("id") == 12345);
786 JSONArray matches = (flow.getJSONObject("match").getJSONArray("matchField"));
787 Assert.assertEquals(matches.length(), 1);
788 JSONObject match = matches.getJSONObject(0);
789 Assert.assertTrue(match.getString("type").equals("NW_DST"));
790 Assert.assertTrue(match.getString("value").equals("1.1.1.1"));
792 JSONArray actionsArray = flow.getJSONArray("actions");
793 Assert.assertEquals(actionsArray.length(), 1);
794 JSONObject act = actionsArray.getJSONObject(0);
795 Assert.assertTrue(act.getString("type").equals(actionType));
797 if (act.getString("type").equals("OUTPUT")) {
798 JSONObject port = act.getJSONObject("port");
799 JSONObject port_node = port.getJSONObject("node");
800 Assert.assertTrue(port.getInt("id") == 51966);
801 Assert.assertTrue(port.getString("type").equals("STUB"));
802 Assert.assertTrue(port_node.getInt("id") == 51966);
803 Assert.assertTrue(port_node.getString("type").equals("STUB"));
806 if (act.getString("type").equals("SET_DL_SRC")) {
807 byte srcMatch[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2, (byte) 1 };
808 String src = act.getString("address");
809 byte srcBytes[] = new byte[5];
810 srcBytes[0] = Byte.parseByte(src.substring(0, 2));
811 srcBytes[1] = Byte.parseByte(src.substring(2, 4));
812 srcBytes[2] = Byte.parseByte(src.substring(4, 6));
813 srcBytes[3] = Byte.parseByte(src.substring(6, 8));
814 srcBytes[4] = Byte.parseByte(src.substring(8, 10));
815 Assert.assertTrue(Arrays.equals(srcBytes, srcMatch));
818 if (act.getString("type").equals("SET_DL_DST")) {
819 byte dstMatch[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
820 String dst = act.getString("address");
821 byte dstBytes[] = new byte[5];
822 dstBytes[0] = Byte.parseByte(dst.substring(0, 2));
823 dstBytes[1] = Byte.parseByte(dst.substring(2, 4));
824 dstBytes[2] = Byte.parseByte(dst.substring(4, 6));
825 dstBytes[3] = Byte.parseByte(dst.substring(6, 8));
826 dstBytes[4] = Byte.parseByte(dst.substring(8, 10));
827 Assert.assertTrue(Arrays.equals(dstBytes, dstMatch));
829 if (act.getString("type").equals("SET_DL_TYPE")) {
830 Assert.assertTrue(act.getInt("dlType") == 10);
832 if (act.getString("type").equals("SET_VLAN_ID")) {
833 Assert.assertTrue(act.getInt("vlanId") == 2);
835 if (act.getString("type").equals("SET_VLAN_PCP")) {
836 Assert.assertTrue(act.getInt("pcp") == 3);
838 if (act.getString("type").equals("SET_VLAN_CFI")) {
839 Assert.assertTrue(act.getInt("cfi") == 1);
842 if (act.getString("type").equals("SET_NW_SRC")) {
843 Assert.assertTrue(act.getString("address").equals("2.2.2.2"));
845 if (act.getString("type").equals("SET_NW_DST")) {
846 Assert.assertTrue(act.getString("address").equals("1.1.1.1"));
849 if (act.getString("type").equals("PUSH_VLAN")) {
850 int head = act.getInt("VlanHeader");
851 // parsing vlan header
852 int id = head & 0xfff;
853 int cfi = (head >> 12) & 0x1;
854 int pcp = (head >> 13) & 0x7;
855 int tag = (head >> 16) & 0xffff;
856 Assert.assertTrue(id == 1234);
857 Assert.assertTrue(cfi == 1);
858 Assert.assertTrue(pcp == 1);
859 Assert.assertTrue(tag == 0x8100);
861 if (act.getString("type").equals("SET_NW_TOS")) {
862 Assert.assertTrue(act.getInt("tos") == 16);
864 if (act.getString("type").equals("SET_TP_SRC")) {
865 Assert.assertTrue(act.getInt("port") == 4201);
867 if (act.getString("type").equals("SET_TP_DST")) {
868 Assert.assertTrue(act.getInt("port") == 8080);
873 public void testFlowProgrammer() throws JSONException {
874 System.out.println("Starting FlowProgrammer JAXB client.");
875 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/flowprogrammer/default/";
876 // Attempt to get a flow that doesn't exit. Should return 404
878 String result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "GET");
879 Assert.assertTrue(result.equals("404"));
882 String fc = "{\"name\":\"test1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
883 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "PUT", fc);
884 Assert.assertTrue(httpResponseCode == 201);
886 // test get returns flow that was added.
887 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "GET");
888 // check that result came out fine.
889 Assert.assertTrue(httpResponseCode == 200);
890 JSONTokener jt = new JSONTokener(result);
891 JSONObject json = new JSONObject(jt);
892 Assert.assertEquals(json.getString("name"), "test1");
893 JSONArray actionsArray = json.getJSONArray("actions");
894 Assert.assertEquals(actionsArray.getString(0), "DROP");
895 Assert.assertEquals(json.getString("installInHw"), "true");
896 JSONObject node = json.getJSONObject("node");
897 Assert.assertEquals(node.getString("type"), "STUB");
898 Assert.assertEquals(node.getString("id"), "51966");
899 // test adding same flow again fails due to repeat name..return 409
901 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test1", "PUT", fc);
902 Assert.assertTrue(result.equals("409"));
904 fc = "{\"name\":\"test2\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
905 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test2", "PUT", fc);
906 // test should return 409 for error due to same flow being added.
907 Assert.assertTrue(result.equals("409"));
909 // add second flow that's different
910 fc = "{\"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
911 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test2", "PUT", fc);
912 Assert.assertTrue(httpResponseCode == 201);
914 // check that request returns both flows given node.
915 result = getJsonResult(baseURL + "node/STUB/51966/", "GET");
916 jt = new JSONTokener(result);
917 json = new JSONObject(jt);
918 Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
919 JSONArray ja = json.getJSONArray("flowConfig");
920 Integer count = ja.length();
921 Assert.assertTrue(count == 2);
923 // check that request returns both flows given just container.
924 result = getJsonResult(baseURL);
925 jt = new JSONTokener(result);
926 json = new JSONObject(jt);
927 Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
928 ja = json.getJSONArray("flowConfig");
930 Assert.assertTrue(count == 2);
932 // delete a flow, check that it's no longer in list.
933 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test2", "DELETE");
934 Assert.assertTrue(httpResponseCode == 204);
936 result = getJsonResult(baseURL + "node/STUB/51966/staticFlow/test2", "GET");
937 Assert.assertTrue(result.equals("404"));
940 // method to extract a JSONObject with specified node ID from a JSONObject
941 // that may contain an array of JSONObjects
942 // This is specifically written for statistics manager northbound REST
944 // array_name should be either "flowStatistics" or "portStatistics"
945 private JSONObject getJsonInstance(JSONObject json, String array_name, Integer nodeId) throws JSONException {
946 JSONObject result = null;
947 if (json.get(array_name) instanceof JSONArray) {
948 JSONArray json_array = json.getJSONArray(array_name);
949 for (int i = 0; i < json_array.length(); i++) {
950 result = json_array.getJSONObject(i);
951 Integer nid = result.getJSONObject("node").getInt("id");
952 if (nid.equals(nodeId)) {
957 result = json.getJSONObject(array_name);
958 Integer nid = result.getJSONObject("node").getInt("id");
959 if (!nid.equals(nodeId)) {
966 // a class to construct query parameter for HTTP request
967 private class QueryParameter {
968 StringBuilder queryString = null;
971 QueryParameter(String key, String value) {
972 queryString = new StringBuilder();
973 queryString.append("?").append(key).append("=").append(value);
976 // method to add more query parameter
977 QueryParameter add(String key, String value) {
978 this.queryString.append("&").append(key).append("=").append(value);
982 // method to get the query parameter string
984 return this.queryString.toString();
990 public void testHostTracker() throws JSONException {
992 System.out.println("Starting HostTracker JAXB client.");
994 // setup 2 host models for @POST method
996 String networkAddress_1 = "192.168.0.8";
997 String dataLayerAddress_1 = "11:22:33:44:55:66";
998 String nodeType_1 = "STUB";
999 Integer nodeId_1 = 3366;
1000 String nodeConnectorType_1 = "STUB";
1001 Integer nodeConnectorId_1 = 12;
1005 String networkAddress_2 = "10.1.1.1";
1006 String dataLayerAddress_2 = "1A:2B:3C:4D:5E:6F";
1007 String nodeType_2 = "STUB";
1008 Integer nodeId_2 = 4477;
1009 String nodeConnectorType_2 = "STUB";
1010 Integer nodeConnectorId_2 = 34;
1011 String vlan_2 = "123";
1013 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/hosttracker/default";
1015 // test PUT method: addHost()
1016 JSONObject fc_json = new JSONObject();
1017 fc_json.put("dataLayerAddress", dataLayerAddress_1);
1018 fc_json.put("nodeType", nodeType_1);
1019 fc_json.put("nodeId", nodeId_1);
1020 fc_json.put("nodeConnectorType", nodeType_1);
1021 fc_json.put("nodeConnectorId", nodeConnectorId_1.toString());
1022 fc_json.put("vlan", vlan_1);
1023 fc_json.put("staticHost", "true");
1024 fc_json.put("networkAddress", networkAddress_1);
1026 String result = getJsonResult(baseURL + "/address/" + networkAddress_1, "PUT", fc_json.toString());
1027 Assert.assertTrue(httpResponseCode == 201);
1029 fc_json = new JSONObject();
1030 fc_json.put("dataLayerAddress", dataLayerAddress_2);
1031 fc_json.put("nodeType", nodeType_2);
1032 fc_json.put("nodeId", nodeId_2);
1033 fc_json.put("nodeConnectorType", nodeType_2);
1034 fc_json.put("nodeConnectorId", nodeConnectorId_2.toString());
1035 fc_json.put("vlan", vlan_2);
1036 fc_json.put("staticHost", "true");
1037 fc_json.put("networkAddress", networkAddress_2);
1039 result = getJsonResult(baseURL + "/address/" + networkAddress_2 , "PUT", fc_json.toString());
1040 Assert.assertTrue(httpResponseCode == 201);
1042 // define variables for decoding returned strings
1043 String networkAddress;
1046 // the two hosts should be in inactive host DB
1047 // test GET method: getInactiveHosts()
1048 result = getJsonResult(baseURL + "/hosts/inactive", "GET");
1049 Assert.assertTrue(httpResponseCode == 200);
1051 JSONTokener jt = new JSONTokener(result);
1052 JSONObject json = new JSONObject(jt);
1053 // there should be at least two hosts in the DB
1054 Assert.assertTrue(json.get("hostConfig") instanceof JSONArray);
1055 JSONArray ja = json.getJSONArray("hostConfig");
1056 Integer count = ja.length();
1057 Assert.assertTrue(count == 2);
1059 for (int i = 0; i < count; i++) {
1060 host_jo = ja.getJSONObject(i);
1061 networkAddress = host_jo.getString("networkAddress");
1062 if (networkAddress.equalsIgnoreCase(networkAddress_1)) {
1063 Assert.assertTrue(host_jo.getString("dataLayerAddress").equalsIgnoreCase(dataLayerAddress_1));
1064 Assert.assertTrue(host_jo.getString("nodeConnectorType").equalsIgnoreCase(nodeConnectorType_1));
1065 Assert.assertTrue(host_jo.getInt("nodeConnectorId") == nodeConnectorId_1);
1066 Assert.assertTrue(host_jo.getString("nodeType").equalsIgnoreCase(nodeType_1));
1067 Assert.assertTrue(host_jo.getInt("nodeId") == nodeId_1);
1068 Assert.assertTrue(host_jo.getString("vlan").equals("0"));
1069 Assert.assertTrue(host_jo.getBoolean("staticHost"));
1070 } else if (networkAddress.equalsIgnoreCase(networkAddress_2)) {
1071 Assert.assertTrue(host_jo.getString("dataLayerAddress").equalsIgnoreCase(dataLayerAddress_2));
1072 Assert.assertTrue(host_jo.getString("nodeConnectorType").equalsIgnoreCase(nodeConnectorType_2));
1073 Assert.assertTrue(host_jo.getInt("nodeConnectorId") == nodeConnectorId_2);
1074 Assert.assertTrue(host_jo.getString("nodeType").equalsIgnoreCase(nodeType_2));
1075 Assert.assertTrue(host_jo.getInt("nodeId") == nodeId_2);
1076 Assert.assertTrue(host_jo.getString("vlan").equalsIgnoreCase(vlan_2));
1077 Assert.assertTrue(host_jo.getBoolean("staticHost"));
1079 Assert.assertTrue(false);
1083 // test GET method: getActiveHosts() - no host expected
1084 result = getJsonResult(baseURL + "/hosts/active", "GET");
1085 Assert.assertTrue(httpResponseCode == 200);
1087 jt = new JSONTokener(result);
1088 json = new JSONObject(jt);
1089 Assert.assertFalse(hostInJson(json, networkAddress_1));
1090 Assert.assertFalse(hostInJson(json, networkAddress_2));
1092 // put the 1st host into active host DB
1096 nd = new Node(nodeType_1, nodeId_1);
1097 ndc = new NodeConnector(nodeConnectorType_1, nodeConnectorId_1, nd);
1098 this.invtoryListener.notifyNodeConnector(ndc, UpdateType.ADDED, null);
1099 } catch (ConstructionException e) {
1104 // verify the host shows up in active host DB
1106 result = getJsonResult(baseURL + "/hosts/active", "GET");
1107 Assert.assertTrue(httpResponseCode == 200);
1109 jt = new JSONTokener(result);
1110 json = new JSONObject(jt);
1112 Assert.assertTrue(hostInJson(json, networkAddress_1));
1114 // test GET method for getHostDetails()
1116 result = getJsonResult(baseURL + "/address/" + networkAddress_1, "GET");
1117 Assert.assertTrue(httpResponseCode == 200);
1119 jt = new JSONTokener(result);
1120 json = new JSONObject(jt);
1122 Assert.assertFalse(json.length() == 0);
1124 Assert.assertTrue(json.getString("dataLayerAddress").equalsIgnoreCase(dataLayerAddress_1));
1125 Assert.assertTrue(json.getString("nodeConnectorType").equalsIgnoreCase(nodeConnectorType_1));
1126 Assert.assertTrue(json.getInt("nodeConnectorId") == nodeConnectorId_1);
1127 Assert.assertTrue(json.getString("nodeType").equalsIgnoreCase(nodeType_1));
1128 Assert.assertTrue(json.getInt("nodeId") == nodeId_1);
1129 Assert.assertTrue(json.getString("vlan").equals("0"));
1130 Assert.assertTrue(json.getBoolean("staticHost"));
1132 // test DELETE method for deleteFlow()
1134 result = getJsonResult(baseURL + "/address/" + networkAddress_1, "DELETE");
1135 Assert.assertTrue(httpResponseCode == 204);
1137 // verify host_1 removed from active host DB
1138 // test GET method: getActiveHosts() - no host expected
1140 result = getJsonResult(baseURL + "/hosts/active", "GET");
1141 Assert.assertTrue(httpResponseCode == 200);
1143 jt = new JSONTokener(result);
1144 json = new JSONObject(jt);
1146 Assert.assertFalse(hostInJson(json, networkAddress_1));
1150 private Boolean hostInJson(JSONObject json, String hostIp) throws JSONException {
1151 // input JSONObject may be empty
1152 if (json.length() == 0) {
1155 if (json.get("hostConfig") instanceof JSONArray) {
1156 JSONArray ja = json.getJSONArray("hostConfig");
1157 for (int i = 0; i < ja.length(); i++) {
1158 String na = ja.getJSONObject(i).getString("networkAddress");
1159 if (na.equalsIgnoreCase(hostIp)) {
1165 JSONObject ja = json.getJSONObject("hostConfig");
1166 String na = ja.getString("networkAddress");
1167 return (na.equalsIgnoreCase(hostIp)) ? true : false;
1172 public void testTopology() throws JSONException, ConstructionException {
1173 System.out.println("Starting Topology JAXB client.");
1174 String baseURL = "http://127.0.0.1:8080/controller/nb/v2/topology/default";
1176 // === test GET method for getTopology()
1177 short state_1 = State.EDGE_UP, state_2 = State.EDGE_DOWN;
1178 long bw_1 = Bandwidth.BW10Gbps, bw_2 = Bandwidth.BW100Mbps;
1179 long lat_1 = Latency.LATENCY100ns, lat_2 = Latency.LATENCY1ms;
1180 String nodeType = "STUB";
1181 String nodeConnType = "STUB";
1182 int headNC1_nodeId = 1, headNC1_nodeConnId = 11;
1183 int tailNC1_nodeId = 2, tailNC1_nodeConnId = 22;
1184 int headNC2_nodeId = 2, headNC2_nodeConnId = 21;
1185 int tailNC2_nodeId = 1, tailNC2_nodeConnId = 12;
1187 List<TopoEdgeUpdate> topoedgeupdateList = new ArrayList<TopoEdgeUpdate>();
1188 NodeConnector headnc1 = new NodeConnector(nodeConnType, headNC1_nodeConnId, new Node(nodeType, headNC1_nodeId));
1189 NodeConnector tailnc1 = new NodeConnector(nodeConnType, tailNC1_nodeConnId, new Node(nodeType, tailNC1_nodeId));
1190 Edge e1 = new Edge(tailnc1, headnc1);
1191 Set<Property> props_1 = new HashSet<Property>();
1192 props_1.add(new State(state_1));
1193 props_1.add(new Bandwidth(bw_1));
1194 props_1.add(new Latency(lat_1));
1195 TopoEdgeUpdate teu1 = new TopoEdgeUpdate(e1, props_1, UpdateType.ADDED);
1196 topoedgeupdateList.add(teu1);
1198 NodeConnector headnc2 = new NodeConnector(nodeConnType, headNC2_nodeConnId, new Node(nodeType, headNC2_nodeId));
1199 NodeConnector tailnc2 = new NodeConnector(nodeConnType, tailNC2_nodeConnId, new Node(nodeType, tailNC2_nodeId));
1200 Edge e2 = new Edge(tailnc2, headnc2);
1201 Set<Property> props_2 = new HashSet<Property>();
1202 props_2.add(new State(state_2));
1203 props_2.add(new Bandwidth(bw_2));
1204 props_2.add(new Latency(lat_2));
1206 TopoEdgeUpdate teu2 = new TopoEdgeUpdate(e2, props_2, UpdateType.ADDED);
1207 topoedgeupdateList.add(teu2);
1209 topoUpdates.edgeUpdate(topoedgeupdateList);
1212 String result = getJsonResult(baseURL, "GET");
1213 Assert.assertTrue(httpResponseCode == 200);
1215 System.out.println("Get Topology: " + result);
1218 // returned data must be an array of edges
1219 JSONTokener jt = new JSONTokener(result);
1220 JSONObject json = new JSONObject(jt);
1221 Assert.assertTrue(json.get("edgeProperties") instanceof JSONArray);
1222 JSONArray ja = json.getJSONArray("edgeProperties");
1224 for (int i = 0; i < ja.length(); i++) {
1225 JSONObject edgeProp = ja.getJSONObject(i);
1226 JSONObject edge = edgeProp.getJSONObject("edge");
1227 JSONObject tailNC = edge.getJSONObject("tailNodeConnector");
1228 JSONObject tailNode = tailNC.getJSONObject("node");
1230 JSONObject headNC = edge.getJSONObject("headNodeConnector");
1231 JSONObject headNode = headNC.getJSONObject("node");
1233 JSONArray propsArray = edgeProp.getJSONArray("properties");
1235 JSONObject bandw = null;
1236 JSONObject stt = null;
1237 JSONObject ltc = null;
1239 for (int j = 0; j < propsArray.length(); j++) {
1240 JSONObject props = propsArray.getJSONObject(j);
1241 String propName = props.getString("name");
1242 if (propName.equals("bandwidth")) {
1245 if (propName.equals("state")) {
1248 if (propName.equals("latency")) {
1253 if (headNC.getInt("id") == headNC1_nodeConnId) {
1254 Assert.assertEquals(headNode.getString("type"), nodeType);
1255 Assert.assertEquals(headNode.getLong("id"), headNC1_nodeId);
1256 Assert.assertEquals(headNC.getString("type"), nodeConnType);
1257 Assert.assertEquals(tailNode.getString("type"),nodeType);
1258 Assert.assertEquals(tailNode.getString("type"), nodeConnType);
1259 Assert.assertEquals(tailNC.getLong("id"), tailNC1_nodeConnId);
1260 Assert.assertEquals(bandw.getLong("value"), bw_1);
1261 Assert.assertTrue((short) stt.getInt("value") == state_1);
1262 Assert.assertEquals(ltc.getLong("value"), lat_1);
1263 } else if (headNC.getInt("id") == headNC2_nodeConnId) {
1264 Assert.assertEquals(headNode.getString("type"),nodeType);
1265 Assert.assertEquals(headNode.getLong("id"), headNC2_nodeId);
1266 Assert.assertEquals(headNC.getString("type"), nodeConnType);
1267 Assert.assertEquals(tailNode.getString("type"), nodeType);
1268 Assert.assertTrue(tailNode.getInt("id") == tailNC2_nodeId);
1269 Assert.assertEquals(tailNC.getString("type"), nodeConnType);
1270 Assert.assertEquals(tailNC.getLong("id"), tailNC2_nodeConnId);
1271 Assert.assertEquals(bandw.getLong("value"), bw_2);
1272 Assert.assertTrue((short) stt.getInt("value") == state_2);
1273 Assert.assertEquals(ltc.getLong("value"), lat_2);
1277 // === test POST method for addUserLink()
1278 // define 2 sample nodeConnectors for user link configuration tests
1279 String nodeType_1 = "STUB";
1280 Integer nodeId_1 = 3366;
1281 String nodeConnectorType_1 = "STUB";
1282 Integer nodeConnectorId_1 = 12;
1284 String nodeType_2 = "STUB";
1285 Integer nodeId_2 = 4477;
1286 String nodeConnectorType_2 = "STUB";
1287 Integer nodeConnectorId_2 = 34;
1289 JSONObject jo = new JSONObject()
1290 .put("name", "userLink_1")
1291 .put("srcNodeConnector",
1292 nodeConnectorType_1 + "|" + nodeConnectorId_1 + "@" + nodeType_1 + "|" + nodeId_1)
1293 .put("dstNodeConnector",
1294 nodeConnectorType_2 + "|" + nodeConnectorId_2 + "@" + nodeType_2 + "|" + nodeId_2);
1295 // execute HTTP request and verify response code
1296 result = getJsonResult(baseURL + "/userLink/userLink_1", "PUT", jo.toString());
1297 Assert.assertTrue(httpResponseCode == 201);
1299 // === test GET method for getUserLinks()
1300 result = getJsonResult(baseURL + "/userLinks", "GET");
1301 Assert.assertTrue(httpResponseCode == 200);
1303 System.out.println("result:" + result);
1306 jt = new JSONTokener(result);
1307 json = new JSONObject(jt);
1309 // should have at least one object returned
1310 Assert.assertFalse(json.length() == 0);
1311 JSONObject userlink = new JSONObject();
1313 if (json.get("userLinks") instanceof JSONArray) {
1314 ja = json.getJSONArray("userLinks");
1316 for (i = 0; i < ja.length(); i++) {
1317 userlink = ja.getJSONObject(i);
1318 if (userlink.getString("name").equalsIgnoreCase("userLink_1")) {
1322 Assert.assertFalse(i == ja.length());
1324 userlink = json.getJSONObject("userLinks");
1325 Assert.assertTrue(userlink.getString("name").equalsIgnoreCase("userLink_1"));
1328 String[] level_1, level_2;
1329 level_1 = userlink.getString("srcNodeConnector").split("\\@");
1330 level_2 = level_1[0].split("\\|");
1331 Assert.assertTrue(level_2[0].equalsIgnoreCase(nodeConnectorType_1));
1332 Assert.assertTrue(Integer.parseInt(level_2[1]) == nodeConnectorId_1);
1333 level_2 = level_1[1].split("\\|");
1334 Assert.assertTrue(level_2[0].equalsIgnoreCase(nodeType_1));
1335 Assert.assertTrue(Integer.parseInt(level_2[1]) == nodeId_1);
1336 level_1 = userlink.getString("dstNodeConnector").split("\\@");
1337 level_2 = level_1[0].split("\\|");
1338 Assert.assertTrue(level_2[0].equalsIgnoreCase(nodeConnectorType_2));
1339 Assert.assertTrue(Integer.parseInt(level_2[1]) == nodeConnectorId_2);
1340 level_2 = level_1[1].split("\\|");
1341 Assert.assertTrue(level_2[0].equalsIgnoreCase(nodeType_2));
1342 Assert.assertTrue(Integer.parseInt(level_2[1]) == nodeId_2);
1344 // === test DELETE method for deleteUserLink()
1345 String userName = "userLink_1";
1346 result = getJsonResult(baseURL + "/userLink/" + userName, "DELETE");
1347 Assert.assertTrue(httpResponseCode == 204);
1349 // execute another getUserLinks() request to verify that userLink_1 is
1351 result = getJsonResult(baseURL + "/userLinks", "GET");
1352 Assert.assertTrue(httpResponseCode == 200);
1354 System.out.println("result:" + result);
1356 jt = new JSONTokener(result);
1357 json = new JSONObject(jt);
1359 if (json.length() != 0) {
1360 if (json.get("userLinks") instanceof JSONArray) {
1361 ja = json.getJSONArray("userLinks");
1362 for (int i = 0; i < ja.length(); i++) {
1363 userlink = ja.getJSONObject(i);
1364 Assert.assertFalse(userlink.getString("name").equalsIgnoreCase("userLink_1"));
1367 userlink = json.getJSONObject("userLinks");
1368 Assert.assertFalse(userlink.getString("name").equalsIgnoreCase("userLink_1"));
1373 // Configure the OSGi container
1375 public Option[] config() {
1378 systemProperty("logback.configurationFile").value(
1379 "file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml"),
1380 // To start OSGi console for inspection remotely
1381 systemProperty("osgi.console").value("2401"),
1382 systemProperty("org.eclipse.gemini.web.tomcat.config.path").value(
1383 PathUtils.getBaseDir() + "/src/test/resources/tomcat-server.xml"),
1385 // setting default level. Jersey bundles will need to be started
1387 systemProperty("osgi.bundles.defaultStartLevel").value("4"),
1389 // Set the systemPackages (used by clustering)
1390 systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),
1391 mavenBundle("org.slf4j", "jcl-over-slf4j").versionAsInProject(),
1392 mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),
1393 mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),
1394 mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(),
1395 mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(),
1396 mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),
1397 mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
1399 // the plugin stub to get data for the tests
1400 mavenBundle("org.opendaylight.controller", "protocol_plugins.stub").versionAsInProject(),
1402 // List all the opendaylight modules
1403 mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(),
1404 mavenBundle("org.opendaylight.controller", "configuration.implementation").versionAsInProject(),
1405 mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),
1406 mavenBundle("org.opendaylight.controller", "containermanager.it.implementation").versionAsInProject(),
1407 mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(),
1408 mavenBundle("org.opendaylight.controller", "clustering.services-implementation").versionAsInProject(),
1409 mavenBundle("org.opendaylight.controller", "security").versionAsInProject().noStart(),
1410 mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),
1411 mavenBundle("org.opendaylight.controller", "sal.implementation").versionAsInProject(),
1412 mavenBundle("org.opendaylight.controller", "sal.connection").versionAsInProject(),
1413 mavenBundle("org.opendaylight.controller", "sal.connection.implementation").versionAsInProject(),
1414 mavenBundle("org.opendaylight.controller", "switchmanager").versionAsInProject(),
1415 mavenBundle("org.opendaylight.controller", "connectionmanager").versionAsInProject(),
1416 mavenBundle("org.opendaylight.controller", "connectionmanager.implementation").versionAsInProject(),
1417 mavenBundle("org.opendaylight.controller", "switchmanager.implementation").versionAsInProject(),
1418 mavenBundle("org.opendaylight.controller", "forwardingrulesmanager").versionAsInProject(),
1419 mavenBundle("org.opendaylight.controller",
1420 "forwardingrulesmanager.implementation").versionAsInProject(),
1421 mavenBundle("org.opendaylight.controller", "statisticsmanager").versionAsInProject(),
1422 mavenBundle("org.opendaylight.controller", "statisticsmanager.implementation").versionAsInProject(),
1423 mavenBundle("org.opendaylight.controller", "arphandler").versionAsInProject(),
1424 mavenBundle("org.opendaylight.controller", "hosttracker").versionAsInProject(),
1425 mavenBundle("org.opendaylight.controller", "hosttracker.implementation").versionAsInProject(),
1426 mavenBundle("org.opendaylight.controller", "arphandler").versionAsInProject(),
1427 mavenBundle("org.opendaylight.controller", "routing.dijkstra_implementation").versionAsInProject(),
1428 mavenBundle("org.opendaylight.controller", "topologymanager").versionAsInProject(),
1429 mavenBundle("org.opendaylight.controller", "usermanager").versionAsInProject(),
1430 mavenBundle("org.opendaylight.controller", "usermanager.implementation").versionAsInProject(),
1431 mavenBundle("org.opendaylight.controller", "logging.bridge").versionAsInProject(),
1432 // mavenBundle("org.opendaylight.controller", "clustering.test").versionAsInProject(),
1433 mavenBundle("org.opendaylight.controller", "forwarding.staticrouting").versionAsInProject(),
1434 mavenBundle("org.opendaylight.controller", "bundlescanner").versionAsInProject(),
1435 mavenBundle("org.opendaylight.controller", "bundlescanner.implementation").versionAsInProject(),
1437 // Northbound bundles
1438 mavenBundle("org.opendaylight.controller", "commons.northbound").versionAsInProject(),
1439 mavenBundle("org.opendaylight.controller", "forwarding.staticrouting.northbound").versionAsInProject(),
1440 mavenBundle("org.opendaylight.controller", "statistics.northbound").versionAsInProject(),
1441 mavenBundle("org.opendaylight.controller", "topology.northbound").versionAsInProject(),
1442 mavenBundle("org.opendaylight.controller", "hosttracker.northbound").versionAsInProject(),
1443 mavenBundle("org.opendaylight.controller", "switchmanager.northbound").versionAsInProject(),
1444 mavenBundle("org.opendaylight.controller", "flowprogrammer.northbound").versionAsInProject(),
1445 mavenBundle("org.opendaylight.controller", "subnets.northbound").versionAsInProject(),
1447 mavenBundle("org.codehaus.jackson", "jackson-mapper-asl").versionAsInProject(),
1448 mavenBundle("org.codehaus.jackson", "jackson-core-asl").versionAsInProject(),
1449 mavenBundle("org.codehaus.jackson", "jackson-jaxrs").versionAsInProject(),
1450 mavenBundle("org.codehaus.jackson", "jackson-xc").versionAsInProject(),
1451 mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),
1453 mavenBundle("commons-io", "commons-io").versionAsInProject(),
1455 mavenBundle("commons-fileupload", "commons-fileupload").versionAsInProject(),
1457 mavenBundle("equinoxSDK381", "javax.servlet").versionAsInProject(),
1458 mavenBundle("equinoxSDK381", "javax.servlet.jsp").versionAsInProject(),
1459 mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(),
1460 mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(),
1461 mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(),
1462 mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(),
1463 mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(),
1464 mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(),
1465 mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(),
1466 mavenBundle("equinoxSDK381", "org.eclipse.equinox.cm").versionAsInProject(),
1467 mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(),
1468 mavenBundle("equinoxSDK381", "org.eclipse.equinox.launcher").versionAsInProject(),
1470 mavenBundle("geminiweb", "org.eclipse.gemini.web.core").versionAsInProject(),
1471 mavenBundle("geminiweb", "org.eclipse.gemini.web.extender").versionAsInProject(),
1472 mavenBundle("geminiweb", "org.eclipse.gemini.web.tomcat").versionAsInProject(),
1473 mavenBundle("geminiweb", "org.eclipse.virgo.kernel.equinox.extensions").versionAsInProject().noStart(),
1474 mavenBundle("geminiweb", "org.eclipse.virgo.util.common").versionAsInProject(),
1475 mavenBundle("geminiweb", "org.eclipse.virgo.util.io").versionAsInProject(),
1476 mavenBundle("geminiweb", "org.eclipse.virgo.util.math").versionAsInProject(),
1477 mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi").versionAsInProject(),
1478 mavenBundle("geminiweb", "org.eclipse.virgo.util.osgi.manifest").versionAsInProject(),
1479 mavenBundle("geminiweb", "org.eclipse.virgo.util.parser.manifest").versionAsInProject(),
1481 mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager").versionAsInProject(),
1482 mavenBundle("org.apache.felix", "org.apache.felix.dependencymanager.shell").versionAsInProject(),
1484 mavenBundle("com.google.code.gson", "gson").versionAsInProject(),
1485 mavenBundle("org.jboss.spec.javax.transaction", "jboss-transaction-api_1.1_spec").versionAsInProject(),
1486 mavenBundle("org.apache.felix", "org.apache.felix.fileinstall").versionAsInProject(),
1487 mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),
1488 mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
1489 mavenBundle("virgomirror", "org.eclipse.jdt.core.compiler.batch").versionAsInProject(),
1490 mavenBundle("eclipselink", "javax.persistence").versionAsInProject(),
1491 mavenBundle("eclipselink", "javax.resource").versionAsInProject(),
1493 mavenBundle("orbit", "javax.activation").versionAsInProject(),
1494 mavenBundle("orbit", "javax.annotation").versionAsInProject(),
1495 mavenBundle("orbit", "javax.ejb").versionAsInProject(),
1496 mavenBundle("orbit", "javax.el").versionAsInProject(),
1497 mavenBundle("orbit", "javax.mail.glassfish").versionAsInProject(),
1498 mavenBundle("orbit", "javax.xml.rpc").versionAsInProject(),
1499 mavenBundle("orbit", "org.apache.catalina").versionAsInProject(),
1500 // these are bundle fragments that can't be started on its own
1501 mavenBundle("orbit", "org.apache.catalina.ha").versionAsInProject().noStart(),
1502 mavenBundle("orbit", "org.apache.catalina.tribes").versionAsInProject().noStart(),
1503 mavenBundle("orbit", "org.apache.coyote").versionAsInProject().noStart(),
1504 mavenBundle("orbit", "org.apache.jasper").versionAsInProject().noStart(),
1506 mavenBundle("orbit", "org.apache.el").versionAsInProject(),
1507 mavenBundle("orbit", "org.apache.juli.extras").versionAsInProject(),
1508 mavenBundle("orbit", "org.apache.tomcat.api").versionAsInProject(),
1509 mavenBundle("orbit", "org.apache.tomcat.util").versionAsInProject().noStart(),
1510 mavenBundle("orbit", "javax.servlet.jsp.jstl").versionAsInProject(),
1511 mavenBundle("orbit", "javax.servlet.jsp.jstl.impl").versionAsInProject(),
1513 mavenBundle("org.ops4j.pax.exam", "pax-exam-container-native").versionAsInProject(),
1514 mavenBundle("org.ops4j.pax.exam", "pax-exam-junit4").versionAsInProject(),
1515 mavenBundle("org.ops4j.pax.exam", "pax-exam-link-mvn").versionAsInProject(),
1516 mavenBundle("org.ops4j.pax.url", "pax-url-aether").versionAsInProject(),
1518 mavenBundle("org.ow2.asm", "asm-all").versionAsInProject(),
1520 mavenBundle("org.springframework", "org.springframework.asm").versionAsInProject(),
1521 mavenBundle("org.springframework", "org.springframework.aop").versionAsInProject(),
1522 mavenBundle("org.springframework", "org.springframework.context").versionAsInProject(),
1523 mavenBundle("org.springframework", "org.springframework.context.support").versionAsInProject(),
1524 mavenBundle("org.springframework", "org.springframework.core").versionAsInProject(),
1525 mavenBundle("org.springframework", "org.springframework.beans").versionAsInProject(),
1526 mavenBundle("org.springframework", "org.springframework.expression").versionAsInProject(),
1527 mavenBundle("org.springframework", "org.springframework.web").versionAsInProject(),
1529 mavenBundle("org.aopalliance", "com.springsource.org.aopalliance").versionAsInProject(),
1530 mavenBundle("org.springframework", "org.springframework.web.servlet").versionAsInProject(),
1531 mavenBundle("org.springframework.security", "spring-security-config").versionAsInProject(),
1532 mavenBundle("org.springframework.security", "spring-security-core").versionAsInProject(),
1533 mavenBundle("org.springframework.security", "spring-security-web").versionAsInProject(),
1534 mavenBundle("org.springframework.security", "spring-security-taglibs").versionAsInProject(),
1535 mavenBundle("org.springframework", "org.springframework.transaction").versionAsInProject(),
1537 mavenBundle("org.ow2.chameleon.management", "chameleon-mbeans").versionAsInProject(),
1538 mavenBundle("org.opendaylight.controller.thirdparty", "net.sf.jung2").versionAsInProject(),
1539 mavenBundle("org.opendaylight.controller.thirdparty", "com.sun.jersey.jersey-servlet")
1540 .versionAsInProject(),
1541 mavenBundle("org.opendaylight.controller.thirdparty", "org.apache.catalina.filters.CorsFilter")
1542 .versionAsInProject().noStart(),
1544 // Jersey needs to be started before the northbound application
1545 // bundles, using a lower start level
1546 mavenBundle("com.sun.jersey", "jersey-client").versionAsInProject(),
1547 mavenBundle("com.sun.jersey", "jersey-server").versionAsInProject().startLevel(2),
1548 mavenBundle("com.sun.jersey", "jersey-core").versionAsInProject().startLevel(2),
1549 mavenBundle("com.sun.jersey", "jersey-json").versionAsInProject().startLevel(2), junitBundles());