Merge "Generation of Notifications and RPCs from YANG"
authorGiovanni Meo <gmeo@cisco.com>
Fri, 14 Jun 2013 11:21:37 +0000 (11:21 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 14 Jun 2013 11:21:37 +0000 (11:21 +0000)
31 files changed:
opendaylight/distribution/opendaylight/pom.xml
opendaylight/hosttracker_new/api/pom.xml
opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/IDevice.java
opendaylight/hosttracker_new/implementation/pom.xml
opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Activator.java
opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Device.java
opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java
opendaylight/hosttracker_new/implementation/src/test/resources/logback.xml [new file with mode: 0644]
opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java
opendaylight/topologymanager/src/test/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImplTest.java
opendaylight/usermanager/api/pom.xml [moved from opendaylight/usermanager/pom.xml with 95% similarity]
opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthResponse.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/AuthResponse.java with 100% similarity]
opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/AuthorizationConfig.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/AuthorizationConfig.java with 89% similarity]
opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IAAAProvider.java with 100% similarity]
opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ISessionManager.java with 100% similarity]
opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/IUserManager.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/IUserManager.java with 97% similarity]
opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/ODLUserLevel.java with 100% similarity]
opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/ServerConfig.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/ServerConfig.java with 97% similarity]
opendaylight/usermanager/api/src/main/java/org/opendaylight/controller/usermanager/UserConfig.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserConfig.java with 99% similarity]
opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java [moved from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/AuthResponseTest.java with 100% similarity]
opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/AuthorizationUserConfigTest.java [moved from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthorizationUserConfigTest.java with 96% similarity]
opendaylight/usermanager/api/src/test/java/org/opendaylight/controller/usermanager/ServerConfigTest.java [moved from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/ServerConfigTest.java with 85% similarity]
opendaylight/usermanager/implementation/pom.xml [new file with mode: 0644]
opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/Activator.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/Activator.java with 100% similarity]
opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUser.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUser.java with 100% similarity]
opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/internal/UserManagerImpl.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/internal/UserManagerImpl.java with 99% similarity]
opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java with 100% similarity]
opendaylight/usermanager/implementation/src/main/java/org/opendaylight/controller/usermanager/security/UserSecurityContextRepository.java [moved from opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/UserSecurityContextRepository.java with 100% similarity]
opendaylight/usermanager/implementation/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java [moved from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/AuthenticatedUserTest.java with 100% similarity]
opendaylight/usermanager/implementation/src/test/java/org/opendaylight/controller/usermanager/internal/UserManagerImplTest.java [moved from opendaylight/usermanager/src/test/java/org/opendaylight/controller/usermanager/internal/UserManagerImplTest.java with 97% similarity]
opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java

index 765dea5..7fac76e 100644 (file)
@@ -57,7 +57,8 @@
     <module>../../statisticsmanager/implementation</module>
     <module>../../statisticsmanager/integrationtest</module>
     <module>../../topologymanager</module>
-    <module>../../usermanager</module>
+    <module>../../usermanager/api</module>
+    <module>../../usermanager/implementation</module>
     <module>../../security</module>
 
 
index a4c2f2e..6a98c71 100644 (file)
@@ -22,8 +22,8 @@
         <configuration>\r
           <instructions>\r
             <Export-Package>\r
-              org.opendaylight.controller.hosttracker_new,\r
-              org.opendaylight.controller.hosttracker_new.hostAware\r
+              org.opendaylight.controller.hosttracker,\r
+              org.opendaylight.controller.hosttracker.hostAware\r
             </Export-Package>\r
             <Import-Package>\r
               org.opendaylight.controller.sal.core,\r
index d9cd3f1..b2ba643 100644 (file)
@@ -35,6 +35,8 @@ package org.opendaylight.controller.hosttracker;
 
 import java.util.Date;
 
+import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
+
 /**
  * Represents an independent device on the network. A device consists of a set
  * of entities, and all the information known about a given device comes only
@@ -132,4 +134,6 @@ public interface IDevice {
      */
     public IEntityClass getEntityClass();
 
+    public HostNodeConnector toHostNodeConnector();
+
 }
index 0201fd8..804f5e3 100644 (file)
@@ -52,7 +52,7 @@
               org.opendaylight.controller.sal.packet.address,
               org.opendaylight.controller.switchmanager,
               org.opendaylight.controller.clustering.services,
-              org.opendaylight.controller.hosttracker_new.hostAware,
+              org.opendaylight.controller.hosttracker.hostAware,
               javax.xml.bind.annotation,
               javax.xml.bind,
               org.apache.felix.dm,
index 631a65a..2cf1c1d 100644 (file)
@@ -13,6 +13,7 @@ import java.util.Hashtable;
 
 import org.apache.felix.dm.Component;
 import org.opendaylight.controller.hosttracker.IDeviceService;
+import org.opendaylight.controller.hosttracker.IfIptoHost;
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
 import org.opendaylight.controller.sal.packet.IDataPacketService;
 import org.opendaylight.controller.sal.packet.IListenDataPacket;
@@ -74,9 +75,11 @@ public class Activator extends ComponentActivatorAbstractBase {
             Dictionary<String, String> props = new Hashtable<String, String>();
             props.put("salListenerName", "devicemanager");
 
-            c.setInterface(new String[] { IDeviceService.class.getName(),
-                    IListenDataPacket.class.getName(),
-                    ITopologyManagerAware.class.getName() }, props);
+            c.setInterface(
+                    new String[] { IDeviceService.class.getName(),
+                            IfIptoHost.class.getName(),
+                            IListenDataPacket.class.getName(),
+                            ITopologyManagerAware.class.getName() }, props);
 
             c.add(createContainerServiceDependency(containerName)
                     .setService(ISwitchManager.class)
index 90911fe..50e77ec 100755 (executable)
@@ -33,6 +33,7 @@
 
 package org.opendaylight.controller.hosttracker.internal;
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -51,6 +52,7 @@ import org.opendaylight.controller.hosttracker.IDeviceService.DeviceField;
 import org.opendaylight.controller.hosttracker.IEntityClass;
 import org.opendaylight.controller.hosttracker.SwitchPort;
 import org.opendaylight.controller.hosttracker.SwitchPort.ErrorStatus;
+import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.utils.HexEncode;
 import org.slf4j.Logger;
@@ -779,6 +781,28 @@ public class Device implements IDevice {
         return true;
     }
 
+    public HostNodeConnector toHostNodeConnector() {
+        Integer[] ipv4s = this.getIPv4Addresses();
+        try {
+            InetAddress ip = InetAddress.getByName(ipv4s[ipv4s.length - 1]
+                    .toString());
+            byte[] macAddr = macLongToByte(this.getMACAddress());
+            HostNodeConnector nc = new HostNodeConnector(macAddr, ip, null,
+                    (short) 0);
+            return nc;
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    private byte[] macLongToByte(long mac) {
+        byte[] macAddr = new byte[6];
+        for (int i = 0; i < 6; i++) {
+            macAddr[5 - i] = (byte) (mac >> (8 * i));
+        }
+        return macAddr;
+    }
+
     @Override
     public String toString() {
         StringBuilder builder = new StringBuilder();
index 8435a94..bda1372 100755 (executable)
@@ -37,6 +37,7 @@ import static org.opendaylight.controller.hosttracker.internal.DeviceManagerImpl
 import static org.opendaylight.controller.hosttracker.internal.DeviceManagerImpl.DeviceUpdate.Change.CHANGE;
 import static org.opendaylight.controller.hosttracker.internal.DeviceManagerImpl.DeviceUpdate.Change.DELETE;
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collection;
@@ -54,6 +55,7 @@ import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
@@ -64,7 +66,9 @@ import org.opendaylight.controller.hosttracker.IDeviceService;
 import org.opendaylight.controller.hosttracker.IEntityClass;
 import org.opendaylight.controller.hosttracker.IEntityClassListener;
 import org.opendaylight.controller.hosttracker.IEntityClassifierService;
+import org.opendaylight.controller.hosttracker.IfIptoHost;
 import org.opendaylight.controller.hosttracker.SwitchPort;
+import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
 import org.opendaylight.controller.sal.core.Edge;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.core.NodeConnector.NodeConnectorIDType;
@@ -79,6 +83,7 @@ import org.opendaylight.controller.sal.topology.TopoEdgeUpdate;
 import org.opendaylight.controller.sal.utils.ListenerDispatcher;
 import org.opendaylight.controller.sal.utils.MultiIterator;
 import org.opendaylight.controller.sal.utils.SingletonTask;
+import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.switchmanager.ISwitchManager;
 import org.opendaylight.controller.topologymanager.ITopologyManager;
 import org.opendaylight.controller.topologymanager.ITopologyManagerAware;
@@ -93,7 +98,7 @@ import org.slf4j.LoggerFactory;
  * @author readams
  */
 public class DeviceManagerImpl implements IDeviceService, IEntityClassListener,
-        IListenDataPacket, ITopologyManagerAware {
+        IListenDataPacket, ITopologyManagerAware, IfIptoHost {
     protected static Logger logger = LoggerFactory
             .getLogger(DeviceManagerImpl.class);
 
@@ -534,6 +539,18 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener,
     // IDeviceManagerService
     // *********************
 
+    void setSwitchManager(ISwitchManager s) {
+        logger.debug("SwitchManager set");
+        this.switchManager = s;
+    }
+
+    void unsetSwitchManager(ISwitchManager s) {
+        if (this.switchManager == s) {
+            logger.debug("SwitchManager removed!");
+            this.switchManager = null;
+        }
+    }
+
     @Override
     public IDevice getDevice(Long deviceKey) {
         return deviceMap.get(deviceKey);
@@ -2043,6 +2060,68 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener,
          */
     }
 
+    @Override
+    public HostNodeConnector hostFind(InetAddress networkAddress) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public HostNodeConnector hostQuery(InetAddress networkAddress) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Future<HostNodeConnector> discoverHost(InetAddress networkAddress) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public List<List<String>> getHostNetworkHierarchy(InetAddress hostAddress) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Set<HostNodeConnector> getAllHosts() {
+        Collection<Device> devices = Collections
+                .unmodifiableCollection(deviceMap.values());
+        Iterator<Device> i = devices.iterator();
+        Set<HostNodeConnector> nc = new HashSet<HostNodeConnector>();
+        while (i.hasNext()) {
+            Device device = i.next();
+            nc.add(device.toHostNodeConnector());
+        }
+        return nc;
+    }
+
+    @Override
+    public Set<HostNodeConnector> getActiveStaticHosts() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Set<HostNodeConnector> getInactiveStaticHosts() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Status addStaticHost(String networkAddress, String dataLayerAddress,
+            NodeConnector nc, String vlan) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Status removeStaticHost(String networkAddress) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
     /**
      * For testing: consolidate the store NOW
      */
diff --git a/opendaylight/hosttracker_new/implementation/src/test/resources/logback.xml b/opendaylight/hosttracker_new/implementation/src/test/resources/logback.xml
new file mode 100644 (file)
index 0000000..5fa21fe
--- /dev/null
@@ -0,0 +1,13 @@
+<configuration scan="true">\r
+\r
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">\r
+    <encoder>\r
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n\r
+      </pattern>\r
+    </encoder>\r
+  </appender>\r
+\r
+  <root level="error">\r
+    <appender-ref ref="STDOUT" />\r
+  </root>\r
+</configuration>\r
index 1127259..0acedce 100644 (file)
@@ -257,7 +257,87 @@ public class NorthboundIT {
     }
 
     @Test
-    public void testSwitchManager() {
+    public void testStaticRoutingNorthbound() throws JSONException {
+        String baseURL = "http://127.0.0.1:8080/controller/nb/v2/staticroute/";
+
+        String name1 = "testRoute1";
+        String prefix1 = "192.168.1.1/24";
+        String nextHop1 = "0.0.0.0";
+        String name2 = "testRoute2";
+        String prefix2 = "192.168.1.1/16";
+        String nextHop2 = "1.1.1.1";
+
+        // Test GET static routes in default container, expecting no results
+        String result = getJsonResult(baseURL + "default");
+        JSONTokener jt = new JSONTokener(result);
+        JSONObject json = new JSONObject(jt);
+        Assert.assertEquals("{}", result);
+
+        // Test insert static route
+        String requestBody = "{\"name\":\"" + name1 + "\", \"prefix\":\""
+                + prefix1 + "\", \"nextHop\":\"" + nextHop1 + "\"}";
+        result = getJsonResult(baseURL + "default/" + name1, "POST",
+                requestBody);
+        Assert.assertEquals(201, httpResponseCode.intValue());
+
+        requestBody = "{\"name\":\"" + name2 + "\", \"prefix\":\"" + prefix2
+                + "\", \"nextHop\":\"" + nextHop2 + "\"}";
+        result = getJsonResult(baseURL + "default/" + name2, "POST",
+                requestBody);
+        Assert.assertEquals(201, httpResponseCode.intValue());
+
+        // Test Get all static routes
+        result = getJsonResult(baseURL + "default");
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        JSONArray staticRoutes = json.getJSONArray("staticRoute");
+        Assert.assertEquals(2, staticRoutes.length());
+        JSONObject route;
+        for (int i = 0; i < staticRoutes.length(); i++) {
+            route = staticRoutes.getJSONObject(i);
+            if (route.getString("name").equals(name1)) {
+                Assert.assertEquals(prefix1, route.getString("prefix"));
+                Assert.assertEquals(nextHop1, route.getString("nextHop"));
+            } else if (route.getString("name").equals(name2)) {
+                Assert.assertEquals(prefix2, route.getString("prefix"));
+                Assert.assertEquals(nextHop2, route.getString("nextHop"));
+            } else {
+                // static route has unknown name
+                Assert.assertTrue(false);
+            }
+        }
+
+        // Test get specific static route
+        result = getJsonResult(baseURL + "default/" + name1);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+
+        Assert.assertEquals(name1, json.getString("name"));
+        Assert.assertEquals(prefix1, json.getString("prefix"));
+        Assert.assertEquals(nextHop1, json.getString("nextHop"));
+
+        result = getJsonResult(baseURL + "default/" + name2);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+
+        Assert.assertEquals(name2, json.getString("name"));
+        Assert.assertEquals(prefix2, json.getString("prefix"));
+        Assert.assertEquals(nextHop2, json.getString("nextHop"));
+
+        // Test delete static route
+        result = getJsonResult(baseURL + "default/" + name1, "DELETE");
+        Assert.assertEquals(200, httpResponseCode.intValue());
+
+        result = getJsonResult(baseURL + "default");
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        JSONObject singleStaticRoute = json.getJSONObject("staticRoute");
+        Assert.assertEquals(name2, singleStaticRoute.getString("name"));
+
+    }
+
+    @Test
+    public void testSwitchManager() throws JSONException {
         String baseURL = "http://127.0.0.1:8080/controller/nb/v2/switch/default/";
 
         // define Node/NodeConnector attributes for test
@@ -280,203 +360,166 @@ public class NorthboundIT {
         int ncBandwidth = 1000000000;
 
         // Test GET all nodes
-        try {
-            String result = getJsonResult(baseURL + "nodes");
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-
-            // Test for first node
-            JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1);
-            Assert.assertNotNull(node);
-            testNodeProperties(node, nodeId_1, nodeType, timestamp_1,
-                    timestampName_1, actionsValue_1, capabilitiesValue_1,
-                    tablesValue_1, buffersValue_1);
-
-            // Test 2nd node, properties of 2nd node same as first node
-            node = getJsonInstance(json, "nodeProperties", nodeId_2);
-            Assert.assertNotNull(node);
-            testNodeProperties(node, nodeId_2, nodeType, timestamp_1,
-                    timestampName_1, actionsValue_1, capabilitiesValue_1,
-                    tablesValue_1, buffersValue_1);
-
-            // Test 3rd node, properties of 3rd node same as first node
-            node = getJsonInstance(json, "nodeProperties", nodeId_3);
-            Assert.assertNotNull(node);
-            testNodeProperties(node, nodeId_3, nodeType, timestamp_1,
-                    timestampName_1, actionsValue_1, capabilitiesValue_1,
-                    tablesValue_1, buffersValue_1);
 
-        } catch (Exception e) {
-            Assert.assertTrue(false);
-        }
+        String result = getJsonResult(baseURL + "nodes");
+        JSONTokener jt = new JSONTokener(result);
+        JSONObject json = new JSONObject(jt);
+
+        // Test for first node
+        JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1);
+        Assert.assertNotNull(node);
+        testNodeProperties(node, nodeId_1, nodeType, timestamp_1,
+                timestampName_1, actionsValue_1, capabilitiesValue_1,
+                tablesValue_1, buffersValue_1);
+
+        // Test 2nd node, properties of 2nd node same as first node
+        node = getJsonInstance(json, "nodeProperties", nodeId_2);
+        Assert.assertNotNull(node);
+        testNodeProperties(node, nodeId_2, nodeType, timestamp_1,
+                timestampName_1, actionsValue_1, capabilitiesValue_1,
+                tablesValue_1, buffersValue_1);
+
+        // Test 3rd node, properties of 3rd node same as first node
+        node = getJsonInstance(json, "nodeProperties", nodeId_3);
+        Assert.assertNotNull(node);
+        testNodeProperties(node, nodeId_3, nodeType, timestamp_1,
+                timestampName_1, actionsValue_1, capabilitiesValue_1,
+                tablesValue_1, buffersValue_1);
 
         // Test GET nodeConnectors of a node
-        try {
-            //Test first node
-            String result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-            JSONObject nodeConnectorProperties = json
-                    .getJSONObject("nodeConnectorProperties");
-
-            testNodeConnectorProperties(nodeConnectorProperties,
-                    nodeConnectorId_1, ncType, nodeId_1, nodeType, ncState,
-                    ncCapabilities, ncBandwidth);
-
-            //Test second node
-            result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
-            jt = new JSONTokener(result);
-            json = new JSONObject(jt);
-            nodeConnectorProperties = json
-                    .getJSONObject("nodeConnectorProperties");
-
-            testNodeConnectorProperties(nodeConnectorProperties,
-                    nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
-                    ncCapabilities, ncBandwidth);
-
-            //Test third node
-            result = getJsonResult(baseURL + "node/STUB/" + nodeId_3);
-            jt = new JSONTokener(result);
-            json = new JSONObject(jt);
-
-            nodeConnectorProperties = json
-                    .getJSONObject("nodeConnectorProperties");
-            testNodeConnectorProperties(nodeConnectorProperties,
-                    nodeConnectorId_3, ncType, nodeId_3, nodeType, ncState,
-                    ncCapabilities, ncBandwidth);
-
-        } catch (Exception e) {
-            Assert.assertTrue(false);
-        }
+        // Test first node
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        JSONObject nodeConnectorProperties = json
+                .getJSONObject("nodeConnectorProperties");
+
+        testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1,
+                ncType, nodeId_1, nodeType, ncState, ncCapabilities,
+                ncBandwidth);
+
+        // Test second node
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+
+        testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2,
+                ncType, nodeId_2, nodeType, ncState, ncCapabilities,
+                ncBandwidth);
+
+        // Test third node
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_3);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+
+        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+        testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_3,
+                ncType, nodeId_3, nodeType, ncState, ncCapabilities,
+                ncBandwidth);
 
         // Test delete node property
-        try {
-            // Delete timestamp property from node1
-            String result = getJsonResult(baseURL + "node/STUB/" + nodeId_1
-                    + "/property/timeStamp", "DELETE");
-            Assert.assertEquals(200, httpResponseCode.intValue());
-
-            // Check node1
-            result = getJsonResult(baseURL + "nodes");
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-            JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1);
-            Assert.assertNotNull(node);
-            testNodeProperties(node, nodeId_1, nodeType, null, null,
-                    actionsValue_1, capabilitiesValue_1, tablesValue_1,
-                    buffersValue_1);
-
-            // Delete actions property from node2
-            result = getJsonResult(baseURL + "node/STUB/" + nodeId_2
-                    + "/property/actions", "DELETE");
-            Assert.assertEquals(200, httpResponseCode.intValue());
-
-            // Check node2
-            result = getJsonResult(baseURL + "nodes");
-            jt = new JSONTokener(result);
-            json = new JSONObject(jt);
-            node = getJsonInstance(json, "nodeProperties", nodeId_2);
-            Assert.assertNotNull(node);
-            testNodeProperties(node, nodeId_2, nodeType, timestamp_1,
-                    timestampName_1, null, capabilitiesValue_1, tablesValue_1,
-                    buffersValue_1);
-
-        } catch (Exception e) {
-            Assert.assertTrue(false);
-        }
+        // Delete timestamp property from node1
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_1
+                + "/property/timeStamp", "DELETE");
+        Assert.assertEquals(200, httpResponseCode.intValue());
+
+        // Check node1
+        result = getJsonResult(baseURL + "nodes");
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        node = getJsonInstance(json, "nodeProperties", nodeId_1);
+        Assert.assertNotNull(node);
+        testNodeProperties(node, nodeId_1, nodeType, null, null,
+                actionsValue_1, capabilitiesValue_1, tablesValue_1,
+                buffersValue_1);
+
+        // Delete actions property from node2
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_2
+                + "/property/actions", "DELETE");
+        Assert.assertEquals(200, httpResponseCode.intValue());
+
+        // Check node2
+        result = getJsonResult(baseURL + "nodes");
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        node = getJsonInstance(json, "nodeProperties", nodeId_2);
+        Assert.assertNotNull(node);
+        testNodeProperties(node, nodeId_2, nodeType, timestamp_1,
+                timestampName_1, null, capabilitiesValue_1, tablesValue_1,
+                buffersValue_1);
 
         // Test add property to node
-        try {
-            // Add Tier and Bandwidth property to node1
-            String result = getJsonResult(baseURL + "node/STUB/" + nodeId_1
-                    + "/property/tier/1001", "PUT");
-            Assert.assertEquals(201, httpResponseCode.intValue());
-            result = getJsonResult(baseURL + "node/STUB/" + nodeId_1
-                    + "/property/bandwidth/1002", "PUT");
-            Assert.assertEquals(201, httpResponseCode.intValue());
-
-            // Test for first node
-            result = getJsonResult(baseURL + "nodes");
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-            JSONObject node = getJsonInstance(json, "nodeProperties", nodeId_1);
-            Assert.assertNotNull(node);
-            Assert.assertEquals(1001, node.getJSONObject("properties")
-                    .getJSONObject("tier").getInt("tierValue"));
-            Assert.assertEquals(1002, node.getJSONObject("properties")
-                    .getJSONObject("bandwidth").getInt("bandwidthValue"));
-
-        } catch (Exception e) {
-            Assert.assertTrue(false);
-        }
+        // Add Tier and Bandwidth property to node1
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_1
+                + "/property/tier/1001", "PUT");
+        Assert.assertEquals(201, httpResponseCode.intValue());
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_1
+                + "/property/bandwidth/1002", "PUT");
+        Assert.assertEquals(201, httpResponseCode.intValue());
+
+        // Test for first node
+        result = getJsonResult(baseURL + "nodes");
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        node = getJsonInstance(json, "nodeProperties", nodeId_1);
+        Assert.assertNotNull(node);
+        Assert.assertEquals(1001, node.getJSONObject("properties")
+                .getJSONObject("tier").getInt("tierValue"));
+        Assert.assertEquals(1002, node.getJSONObject("properties")
+                .getJSONObject("bandwidth").getInt("bandwidthValue"));
 
         // Test delete nodeConnector property
-        try {
-            // Delete state property of nodeconnector1
-            String result = getJsonResult(baseURL + "nodeconnector/STUB/"
-                    + nodeId_1 + "/STUB/" + nodeConnectorId_1
-                    + "/property/state", "DELETE");
-            Assert.assertEquals(200, httpResponseCode.intValue());
-
-            result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-            JSONObject nodeConnectorProperties = json
-                    .getJSONObject("nodeConnectorProperties");
-
-            testNodeConnectorProperties(nodeConnectorProperties,
-                    nodeConnectorId_1, ncType, nodeId_1, nodeType, null,
-                    ncCapabilities, ncBandwidth);
-
-            // Delete capabilities property of nodeconnector2
-            result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_2
-                    + "/STUB/" + nodeConnectorId_2 + "/property/capabilities",
-                    "DELETE");
-            Assert.assertEquals(200, httpResponseCode.intValue());
-
-            result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
-            jt = new JSONTokener(result);
-            json = new JSONObject(jt);
-            nodeConnectorProperties = json
-                    .getJSONObject("nodeConnectorProperties");
-
-            testNodeConnectorProperties(nodeConnectorProperties,
-                    nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
-                    null, ncBandwidth);
+        // Delete state property of nodeconnector1
+        result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1
+                + "/STUB/" + nodeConnectorId_1 + "/property/state", "DELETE");
+        Assert.assertEquals(200, httpResponseCode.intValue());
 
-        } catch (Exception e) {
-            Assert.assertTrue(false);
-        }
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+
+        testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1,
+                ncType, nodeId_1, nodeType, null, ncCapabilities, ncBandwidth);
+
+        // Delete capabilities property of nodeconnector2
+        result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_2
+                + "/STUB/" + nodeConnectorId_2 + "/property/capabilities",
+                "DELETE");
+        Assert.assertEquals(200, httpResponseCode.intValue());
+
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+
+        testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2,
+                ncType, nodeId_2, nodeType, ncState, null, ncBandwidth);
 
         // Test PUT nodeConnector property
-        try {
-            int newBandwidth = 1001;
-
-            // Add Name/Bandwidth property to nodeConnector1
-            String result = getJsonResult(baseURL + "nodeconnector/STUB/"
-                    + nodeId_1 + "/STUB/" + nodeConnectorId_1
-                    + "/property/bandwidth/" + newBandwidth, "PUT");
-            Assert.assertEquals(201, httpResponseCode.intValue());
-
-            result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-            JSONObject nodeConnectorProperties = json
-                    .getJSONObject("nodeConnectorProperties");
-
-            // Check for new bandwidth value, state value removed from previous
-            // test
-            testNodeConnectorProperties(nodeConnectorProperties,
-                    nodeConnectorId_1, ncType, nodeId_1, nodeType, null,
-                    ncCapabilities, newBandwidth);
+        int newBandwidth = 1001;
+
+        // Add Name/Bandwidth property to nodeConnector1
+        result = getJsonResult(baseURL + "nodeconnector/STUB/" + nodeId_1
+                + "/STUB/" + nodeConnectorId_1 + "/property/bandwidth/"
+                + newBandwidth, "PUT");
+        Assert.assertEquals(201, httpResponseCode.intValue());
+
+        result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+
+        // Check for new bandwidth value, state value removed from previous
+        // test
+        testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1,
+                ncType, nodeId_1, nodeType, null, ncCapabilities, newBandwidth);
 
-        } catch (Exception e) {
-            Assert.assertTrue(false);
-        }
     }
 
     @Test
-    public void testStatistics() {
+    public void testStatistics() throws JSONException {
         String actionTypes[] = { "drop", "loopback", "flood", "floodAll",
                 "controller", "swPath", "hwPath", "output", "setDlSrc",
                 "setDlDst", "setDlType", "setVlanId", "setVlanPcp",
@@ -485,262 +528,247 @@ public class NorthboundIT {
         System.out.println("Starting Statistics JAXB client.");
 
         String baseURL = "http://127.0.0.1:8080/controller/nb/v2/statistics/default/";
-        try {
-            String result = getJsonResult(baseURL + "flowstats");
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-            JSONObject flowStatistics = getJsonInstance(json, "flowStatistics",
-                    0xCAFE);
-            JSONObject node = flowStatistics.getJSONObject("node");
-            // test that node was returned properly
-            Assert.assertTrue(node.getInt("@id") == 0xCAFE);
-            Assert.assertTrue(node.getString("@type").equals("STUB"));
-
-            // test that flow statistics results are correct
-            JSONArray flowStats = flowStatistics.getJSONArray("flowStat");
-            for (int i = 0; i < flowStats.length(); i++) {
-
-                JSONObject flowStat = flowStats.getJSONObject(i);
-                testFlowStat(flowStat, actionTypes[i]);
 
-            }
+        String result = getJsonResult(baseURL + "flowstats");
+        JSONTokener jt = new JSONTokener(result);
+        JSONObject json = new JSONObject(jt);
+        JSONObject flowStatistics = getJsonInstance(json, "flowStatistics",
+                0xCAFE);
+        JSONObject node = flowStatistics.getJSONObject("node");
+        // test that node was returned properly
+        Assert.assertTrue(node.getInt("@id") == 0xCAFE);
+        Assert.assertTrue(node.getString("@type").equals("STUB"));
 
-            // for /controller/nb/v2/statistics/default/portstats
-            result = getJsonResult(baseURL + "portstats");
-            jt = new JSONTokener(result);
-            json = new JSONObject(jt);
-            JSONObject portStatistics = getJsonInstance(json, "portStatistics",
-                    0xCAFE);
-            JSONObject node2 = portStatistics.getJSONObject("node");
-            // test that node was returned properly
-            Assert.assertTrue(node2.getInt("@id") == 0xCAFE);
-            Assert.assertTrue(node2.getString("@type").equals("STUB"));
-
-            // test that port statistic results are correct
-            JSONObject portStat = portStatistics.getJSONObject("portStat");
-            Assert.assertTrue(portStat.getInt("receivePackets") == 250);
-            Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
-            Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
-            Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
-            Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
-            Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
-            Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
-            Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
-            Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
-            Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
-            Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
-            Assert.assertTrue(portStat.getInt("collisionCount") == 4);
-
-            // test for getting one specific node's stats
-            result = getJsonResult(baseURL + "flowstats/STUB/51966");
-            jt = new JSONTokener(result);
-            json = new JSONObject(jt);
-            node = json.getJSONObject("node");
-            // test that node was returned properly
-            Assert.assertTrue(node.getInt("@id") == 0xCAFE);
-            Assert.assertTrue(node.getString("@type").equals("STUB"));
-
-            // test that flow statistics results are correct
-            flowStats = json.getJSONArray("flowStat");
-            for (int i = 0; i < flowStats.length(); i++) {
-                JSONObject flowStat = flowStats.getJSONObject(i);
-                testFlowStat(flowStat, actionTypes[i]);
-            }
+        // test that flow statistics results are correct
+        JSONArray flowStats = flowStatistics.getJSONArray("flowStat");
+        for (int i = 0; i < flowStats.length(); i++) {
 
-            result = getJsonResult(baseURL + "portstats/STUB/51966");
-            jt = new JSONTokener(result);
-            json = new JSONObject(jt);
-            node2 = json.getJSONObject("node");
-            // test that node was returned properly
-            Assert.assertTrue(node2.getInt("@id") == 0xCAFE);
-            Assert.assertTrue(node2.getString("@type").equals("STUB"));
-
-            // test that port statistic results are correct
-            portStat = json.getJSONObject("portStat");
-            Assert.assertTrue(portStat.getInt("receivePackets") == 250);
-            Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
-            Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
-            Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
-            Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
-            Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
-            Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
-            Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
-            Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
-            Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
-            Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
-            Assert.assertTrue(portStat.getInt("collisionCount") == 4);
+            JSONObject flowStat = flowStats.getJSONObject(i);
+            testFlowStat(flowStat, actionTypes[i]);
 
-        } catch (Exception e) {
-            // Got an unexpected exception
-            Assert.assertTrue(false);
+        }
 
+        // for /controller/nb/v2/statistics/default/portstats
+        result = getJsonResult(baseURL + "portstats");
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        JSONObject portStatistics = getJsonInstance(json, "portStatistics",
+                0xCAFE);
+        JSONObject node2 = portStatistics.getJSONObject("node");
+        // test that node was returned properly
+        Assert.assertTrue(node2.getInt("@id") == 0xCAFE);
+        Assert.assertTrue(node2.getString("@type").equals("STUB"));
+
+        // test that port statistic results are correct
+        JSONObject portStat = portStatistics.getJSONObject("portStat");
+        Assert.assertTrue(portStat.getInt("receivePackets") == 250);
+        Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
+        Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
+        Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
+        Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
+        Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
+        Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
+        Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
+        Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
+        Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
+        Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
+        Assert.assertTrue(portStat.getInt("collisionCount") == 4);
+
+        // test for getting one specific node's stats
+        result = getJsonResult(baseURL + "flowstats/STUB/51966");
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        node = json.getJSONObject("node");
+        // test that node was returned properly
+        Assert.assertTrue(node.getInt("@id") == 0xCAFE);
+        Assert.assertTrue(node.getString("@type").equals("STUB"));
+
+        // test that flow statistics results are correct
+        flowStats = json.getJSONArray("flowStat");
+        for (int i = 0; i < flowStats.length(); i++) {
+            JSONObject flowStat = flowStats.getJSONObject(i);
+            testFlowStat(flowStat, actionTypes[i]);
         }
+
+        result = getJsonResult(baseURL + "portstats/STUB/51966");
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        node2 = json.getJSONObject("node");
+        // test that node was returned properly
+        Assert.assertTrue(node2.getInt("@id") == 0xCAFE);
+        Assert.assertTrue(node2.getString("@type").equals("STUB"));
+
+        // test that port statistic results are correct
+        portStat = json.getJSONObject("portStat");
+        Assert.assertTrue(portStat.getInt("receivePackets") == 250);
+        Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
+        Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
+        Assert.assertTrue(portStat.getInt("transmitBytes") == 5000);
+        Assert.assertTrue(portStat.getInt("receiveDrops") == 2);
+        Assert.assertTrue(portStat.getInt("transmitDrops") == 50);
+        Assert.assertTrue(portStat.getInt("receiveErrors") == 3);
+        Assert.assertTrue(portStat.getInt("transmitErrors") == 10);
+        Assert.assertTrue(portStat.getInt("receiveFrameError") == 5);
+        Assert.assertTrue(portStat.getInt("receiveOverRunError") == 6);
+        Assert.assertTrue(portStat.getInt("receiveCrcError") == 1);
+        Assert.assertTrue(portStat.getInt("collisionCount") == 4);
     }
 
-    private void testFlowStat(JSONObject flowStat, String actionType) {
-        try {
-            Assert.assertTrue(flowStat.getInt("tableId") == 1);
-            Assert.assertTrue(flowStat.getInt("durationSeconds") == 40);
-            Assert.assertTrue(flowStat.getInt("durationNanoseconds") == 400);
-            Assert.assertTrue(flowStat.getInt("packetCount") == 200);
-            Assert.assertTrue(flowStat.getInt("byteCount") == 100);
-
-            // test that flow information is correct
-            JSONObject flow = flowStat.getJSONObject("flow");
-            Assert.assertTrue(flow.getInt("priority") == 3500);
-            Assert.assertTrue(flow.getInt("idleTimeout") == 1000);
-            Assert.assertTrue(flow.getInt("hardTimeout") == 2000);
-            Assert.assertTrue(flow.getInt("id") == 12345);
-
-            JSONObject match = (flow.getJSONObject("match")
-                    .getJSONObject("matchField"));
-            Assert.assertTrue(match.getString("type").equals("NW_DST"));
-            Assert.assertTrue(match.getString("value").equals("1.1.1.1"));
-
-            JSONObject act = flow.getJSONObject("actions");
-            Assert.assertTrue(act.getString("@type").equals(actionType));
-
-            if (act.getString("@type").equals("output")) {
-                JSONObject port = act.getJSONObject("port");
-                JSONObject port_node = port.getJSONObject("node");
-                Assert.assertTrue(port.getInt("@id") == 51966);
-                Assert.assertTrue(port.getString("@type").equals("STUB"));
-                Assert.assertTrue(port_node.getInt("@id") == 51966);
-                Assert.assertTrue(port_node.getString("@type").equals("STUB"));
-            }
+    private void testFlowStat(JSONObject flowStat, String actionType)
+            throws JSONException {
+        Assert.assertTrue(flowStat.getInt("tableId") == 1);
+        Assert.assertTrue(flowStat.getInt("durationSeconds") == 40);
+        Assert.assertTrue(flowStat.getInt("durationNanoseconds") == 400);
+        Assert.assertTrue(flowStat.getInt("packetCount") == 200);
+        Assert.assertTrue(flowStat.getInt("byteCount") == 100);
+
+        // test that flow information is correct
+        JSONObject flow = flowStat.getJSONObject("flow");
+        Assert.assertTrue(flow.getInt("priority") == 3500);
+        Assert.assertTrue(flow.getInt("idleTimeout") == 1000);
+        Assert.assertTrue(flow.getInt("hardTimeout") == 2000);
+        Assert.assertTrue(flow.getInt("id") == 12345);
+
+        JSONObject match = (flow.getJSONObject("match")
+                .getJSONObject("matchField"));
+        Assert.assertTrue(match.getString("type").equals("NW_DST"));
+        Assert.assertTrue(match.getString("value").equals("1.1.1.1"));
+
+        JSONObject act = flow.getJSONObject("actions");
+        Assert.assertTrue(act.getString("@type").equals(actionType));
+
+        if (act.getString("@type").equals("output")) {
+            JSONObject port = act.getJSONObject("port");
+            JSONObject port_node = port.getJSONObject("node");
+            Assert.assertTrue(port.getInt("@id") == 51966);
+            Assert.assertTrue(port.getString("@type").equals("STUB"));
+            Assert.assertTrue(port_node.getInt("@id") == 51966);
+            Assert.assertTrue(port_node.getString("@type").equals("STUB"));
+        }
 
-            if (act.getString("@type").equals("setDlSrc")) {
-                byte srcMatch[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2,
-                        (byte) 1 };
-                String src = act.getString("address");
-                byte srcBytes[] = new byte[5];
-                srcBytes[0] = Byte.parseByte(src.substring(0, 2));
-                srcBytes[1] = Byte.parseByte(src.substring(2, 4));
-                srcBytes[2] = Byte.parseByte(src.substring(4, 6));
-                srcBytes[3] = Byte.parseByte(src.substring(6, 8));
-                srcBytes[4] = Byte.parseByte(src.substring(8, 10));
-                Assert.assertTrue(Arrays.equals(srcBytes, srcMatch));
-            }
+        if (act.getString("@type").equals("setDlSrc")) {
+            byte srcMatch[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2,
+                    (byte) 1 };
+            String src = act.getString("address");
+            byte srcBytes[] = new byte[5];
+            srcBytes[0] = Byte.parseByte(src.substring(0, 2));
+            srcBytes[1] = Byte.parseByte(src.substring(2, 4));
+            srcBytes[2] = Byte.parseByte(src.substring(4, 6));
+            srcBytes[3] = Byte.parseByte(src.substring(6, 8));
+            srcBytes[4] = Byte.parseByte(src.substring(8, 10));
+            Assert.assertTrue(Arrays.equals(srcBytes, srcMatch));
+        }
 
-            if (act.getString("@type").equals("setDlDst")) {
-                byte dstMatch[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4,
-                        (byte) 5 };
-                String dst = act.getString("address");
-                byte dstBytes[] = new byte[5];
-                dstBytes[0] = Byte.parseByte(dst.substring(0, 2));
-                dstBytes[1] = Byte.parseByte(dst.substring(2, 4));
-                dstBytes[2] = Byte.parseByte(dst.substring(4, 6));
-                dstBytes[3] = Byte.parseByte(dst.substring(6, 8));
-                dstBytes[4] = Byte.parseByte(dst.substring(8, 10));
-                Assert.assertTrue(Arrays.equals(dstBytes, dstMatch));
-            }
-            if (act.getString("@type").equals("setDlType"))
-                Assert.assertTrue(act.getInt("dlType") == 10);
-            if (act.getString("@type").equals("setVlanId"))
-                Assert.assertTrue(act.getInt("vlanId") == 2);
-            if (act.getString("@type").equals("setVlanPcp"))
-                Assert.assertTrue(act.getInt("pcp") == 3);
-            if (act.getString("@type").equals("setVlanCfi"))
-                Assert.assertTrue(act.getInt("cfi") == 1);
-
-            if (act.getString("@type").equals("setNwSrc"))
-                Assert.assertTrue(act.getString("address").equals("2.2.2.2"));
-            if (act.getString("@type").equals("setNwDst"))
-                Assert.assertTrue(act.getString("address").equals("1.1.1.1"));
-
-            if (act.getString("@type").equals("pushVlan")) {
-                int head = act.getInt("VlanHeader");
-                // parsing vlan header
-                int id = head & 0xfff;
-                int cfi = (head >> 12) & 0x1;
-                int pcp = (head >> 13) & 0x7;
-                int tag = (head >> 16) & 0xffff;
-                Assert.assertTrue(id == 1234);
-                Assert.assertTrue(cfi == 1);
-                Assert.assertTrue(pcp == 1);
-                Assert.assertTrue(tag == 0x8100);
-            }
-            if (act.getString("@type").equals("setNwTos"))
-                Assert.assertTrue(act.getInt("tos") == 16);
-            if (act.getString("@type").equals("setTpSrc"))
-                Assert.assertTrue(act.getInt("port") == 4201);
-            if (act.getString("@type").equals("setTpDst"))
-                Assert.assertTrue(act.getInt("port") == 8080);
-        } catch (Exception e) {
-            Assert.assertTrue(false);
+        if (act.getString("@type").equals("setDlDst")) {
+            byte dstMatch[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4,
+                    (byte) 5 };
+            String dst = act.getString("address");
+            byte dstBytes[] = new byte[5];
+            dstBytes[0] = Byte.parseByte(dst.substring(0, 2));
+            dstBytes[1] = Byte.parseByte(dst.substring(2, 4));
+            dstBytes[2] = Byte.parseByte(dst.substring(4, 6));
+            dstBytes[3] = Byte.parseByte(dst.substring(6, 8));
+            dstBytes[4] = Byte.parseByte(dst.substring(8, 10));
+            Assert.assertTrue(Arrays.equals(dstBytes, dstMatch));
+        }
+        if (act.getString("@type").equals("setDlType"))
+            Assert.assertTrue(act.getInt("dlType") == 10);
+        if (act.getString("@type").equals("setVlanId"))
+            Assert.assertTrue(act.getInt("vlanId") == 2);
+        if (act.getString("@type").equals("setVlanPcp"))
+            Assert.assertTrue(act.getInt("pcp") == 3);
+        if (act.getString("@type").equals("setVlanCfi"))
+            Assert.assertTrue(act.getInt("cfi") == 1);
+
+        if (act.getString("@type").equals("setNwSrc"))
+            Assert.assertTrue(act.getString("address").equals("2.2.2.2"));
+        if (act.getString("@type").equals("setNwDst"))
+            Assert.assertTrue(act.getString("address").equals("1.1.1.1"));
+
+        if (act.getString("@type").equals("pushVlan")) {
+            int head = act.getInt("VlanHeader");
+            // parsing vlan header
+            int id = head & 0xfff;
+            int cfi = (head >> 12) & 0x1;
+            int pcp = (head >> 13) & 0x7;
+            int tag = (head >> 16) & 0xffff;
+            Assert.assertTrue(id == 1234);
+            Assert.assertTrue(cfi == 1);
+            Assert.assertTrue(pcp == 1);
+            Assert.assertTrue(tag == 0x8100);
         }
+        if (act.getString("@type").equals("setNwTos"))
+            Assert.assertTrue(act.getInt("tos") == 16);
+        if (act.getString("@type").equals("setTpSrc"))
+            Assert.assertTrue(act.getInt("port") == 4201);
+        if (act.getString("@type").equals("setTpDst"))
+            Assert.assertTrue(act.getInt("port") == 8080);
     }
 
     @Test
-    public void testFlowProgrammer() {
-        try {
-            String baseURL = "http://127.0.0.1:8080/controller/nb/v2/flow/default/";
-            // Attempt to get a flow that doesn't exit. Should return 404
-            // status.
-            String result = getJsonResult(baseURL + "STUB/51966/test1", "GET");
-            Assert.assertTrue(result.equals("404"));
-
-            // test add flow1
-            String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
-            result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc);
-            Assert.assertTrue(httpResponseCode == 201);
-
-            // test get returns flow that was added.
-            result = getJsonResult(baseURL + "STUB/51966/test1", "GET");
-            // check that result came out fine.
-            Assert.assertTrue(httpResponseCode == 200);
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-            Assert.assertTrue(json.getString("name").equals("test1"));
-            Assert.assertTrue(json.getString("actions").equals("DROP"));
-            Assert.assertTrue(json.getString("installInHw").equals("true"));
-            JSONObject node = json.getJSONObject("node");
-            Assert.assertTrue(node.getString("@type").equals("STUB"));
-            Assert.assertTrue(node.getString("@id").equals("51966"));
-            // test adding same flow again fails due to repeat name..return 409
-            // code
-            result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc);
-            Assert.assertTrue(result.equals("409"));
-
-            fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
-            result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc);
-            // test should return 500 for error due to same flow being added.
-            Assert.assertTrue(result.equals("500"));
-
-            // add second flow that's different
-            fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
-            result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc);
-            Assert.assertTrue(httpResponseCode == 201);
-
-            // check that request returns both flows given node.
-            result = getJsonResult(baseURL + "STUB/51966/", "GET");
-            jt = new JSONTokener(result);
-            json = new JSONObject(jt);
-            Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
-            JSONArray ja = json.getJSONArray("flowConfig");
-            Integer count = ja.length();
-            Assert.assertTrue(count == 2);
-
-            // check that request returns both flows given just container.
-            result = getJsonResult(baseURL);
-            jt = new JSONTokener(result);
-            json = new JSONObject(jt);
-            Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
-            ja = json.getJSONArray("flowConfig");
-            count = ja.length();
-            Assert.assertTrue(count == 2);
-
-            // delete a flow, check that it's no longer in list.
-            result = getJsonResult(baseURL + "STUB/51966/test2", "DELETE");
-            Assert.assertTrue(httpResponseCode == 200);
-
-            result = getJsonResult(baseURL + "STUB/51966/test2", "GET");
-            Assert.assertTrue(result.equals("404"));
-
-        } catch (Exception e) {
-            Assert.assertTrue(false);
-        }
-
+    public void testFlowProgrammer() throws JSONException {
+        String baseURL = "http://127.0.0.1:8080/controller/nb/v2/flow/default/";
+        // Attempt to get a flow that doesn't exit. Should return 404
+        // status.
+        String result = getJsonResult(baseURL + "STUB/51966/test1", "GET");
+        Assert.assertTrue(result.equals("404"));
+
+        // test add flow1
+        String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
+        result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc);
+        Assert.assertTrue(httpResponseCode == 201);
+
+        // test get returns flow that was added.
+        result = getJsonResult(baseURL + "STUB/51966/test1", "GET");
+        // check that result came out fine.
+        Assert.assertTrue(httpResponseCode == 200);
+        JSONTokener jt = new JSONTokener(result);
+        JSONObject json = new JSONObject(jt);
+        Assert.assertTrue(json.getString("name").equals("test1"));
+        Assert.assertTrue(json.getString("actions").equals("DROP"));
+        Assert.assertTrue(json.getString("installInHw").equals("true"));
+        JSONObject node = json.getJSONObject("node");
+        Assert.assertTrue(node.getString("@type").equals("STUB"));
+        Assert.assertTrue(node.getString("@id").equals("51966"));
+        // test adding same flow again fails due to repeat name..return 409
+        // code
+        result = getJsonResult(baseURL + "STUB/51966/test1", "POST", fc);
+        Assert.assertTrue(result.equals("409"));
+
+        fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
+        result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc);
+        // test should return 500 for error due to same flow being added.
+        Assert.assertTrue(result.equals("500"));
+
+        // add second flow that's different
+        fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"@id\":\"51966\",\"@type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
+        result = getJsonResult(baseURL + "STUB/51966/test2", "POST", fc);
+        Assert.assertTrue(httpResponseCode == 201);
+
+        // check that request returns both flows given node.
+        result = getJsonResult(baseURL + "STUB/51966/", "GET");
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
+        JSONArray ja = json.getJSONArray("flowConfig");
+        Integer count = ja.length();
+        Assert.assertTrue(count == 2);
+
+        // check that request returns both flows given just container.
+        result = getJsonResult(baseURL);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        Assert.assertTrue(json.get("flowConfig") instanceof JSONArray);
+        ja = json.getJSONArray("flowConfig");
+        count = ja.length();
+        Assert.assertTrue(count == 2);
+
+        // delete a flow, check that it's no longer in list.
+        result = getJsonResult(baseURL + "STUB/51966/test2", "DELETE");
+        Assert.assertTrue(httpResponseCode == 200);
+
+        result = getJsonResult(baseURL + "STUB/51966/test2", "GET");
+        Assert.assertTrue(result.equals("404"));
     }
 
     // method to extract a JSONObject with specified node ID from a JSONObject
@@ -792,7 +820,7 @@ public class NorthboundIT {
     }
 
     @Test
-    public void testHostTracker() {
+    public void testHostTracker() throws JSONException {
 
         System.out.println("Starting HostTracker JAXB client.");
 
@@ -818,34 +846,29 @@ public class NorthboundIT {
         String baseURL = "http://127.0.0.1:8080/controller/nb/v2/host/default";
 
         // test POST method: addHost()
-        try {
-            String queryParameter = new QueryParameter("dataLayerAddress",
-                    dataLayerAddress_1).add("nodeType", nodeType_1)
-                    .add("nodeId", nodeId_1.toString())
-                    .add("nodeConnectorType", nodeConnectorType_1)
-                    .add("nodeConnectorId", nodeConnectorId_1.toString())
-                    .add("vlan", vlan_1).getString();
-
-            String result = getJsonResult(baseURL + "/" + networkAddress_1
-                    + queryParameter, "POST");
-            Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201);
-
-            // vlan is not passed through query parameter but should be
-            // defaulted to "0"
-            queryParameter = new QueryParameter("dataLayerAddress",
-                    dataLayerAddress_2).add("nodeType", nodeType_2)
-                    .add("nodeId", nodeId_2.toString())
-                    .add("nodeConnectorType", nodeConnectorType_2)
-                    .add("nodeConnectorId", nodeConnectorId_2.toString())
-                    .getString();
-
-            result = getJsonResult(baseURL + "/" + networkAddress_2
-                    + queryParameter, "POST");
-            Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201);
-        } catch (Exception e) {
-            // Got an unexpected exception
-            Assert.assertTrue(false);
-        }
+        String queryParameter = new QueryParameter("dataLayerAddress",
+                dataLayerAddress_1).add("nodeType", nodeType_1)
+                .add("nodeId", nodeId_1.toString())
+                .add("nodeConnectorType", nodeConnectorType_1)
+                .add("nodeConnectorId", nodeConnectorId_1.toString())
+                .add("vlan", vlan_1).getString();
+
+        String result = getJsonResult(baseURL + "/" + networkAddress_1
+                + queryParameter, "POST");
+        Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201);
+
+        // vlan is not passed through query parameter but should be
+        // defaulted to "0"
+        queryParameter = new QueryParameter("dataLayerAddress",
+                dataLayerAddress_2).add("nodeType", nodeType_2)
+                .add("nodeId", nodeId_2.toString())
+                .add("nodeConnectorType", nodeConnectorType_2)
+                .add("nodeConnectorId", nodeConnectorId_2.toString())
+                .getString();
+
+        result = getJsonResult(baseURL + "/" + networkAddress_2
+                + queryParameter, "POST");
+        Assert.assertTrue(httpResponseCode.intValue() == (Integer) 201);
 
         // define variables for decoding returned strings
         String networkAddress;
@@ -853,69 +876,59 @@ public class NorthboundIT {
 
         // the two hosts should be in inactive host DB
         // test GET method: getInactiveHosts()
-        try {
-            String result = getJsonResult(baseURL + "/inactive", "GET");
-            Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
+        result = getJsonResult(baseURL + "/inactive", "GET");
+        Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
+
+        JSONTokener jt = new JSONTokener(result);
+        JSONObject json = new JSONObject(jt);
+        // there should be at least two hosts in the DB
+        Assert.assertTrue(json.get("host") instanceof JSONArray);
+        JSONArray ja = json.getJSONArray("host");
+        Integer count = ja.length();
+        Assert.assertTrue(count == 2);
+
+        for (int i = 0; i < count; i++) {
+            host_jo = ja.getJSONObject(i);
+            dl_jo = host_jo.getJSONObject("dataLayerAddress");
+            nc_jo = host_jo.getJSONObject("nodeConnector");
+            node_jo = nc_jo.getJSONObject("node");
 
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-            // there should be at least two hosts in the DB
-            Assert.assertTrue(json.get("host") instanceof JSONArray);
-            JSONArray ja = json.getJSONArray("host");
-            Integer count = ja.length();
-            Assert.assertTrue(count == 2);
-
-            for (int i = 0; i < count; i++) {
-                host_jo = ja.getJSONObject(i);
-                dl_jo = host_jo.getJSONObject("dataLayerAddress");
-                nc_jo = host_jo.getJSONObject("nodeConnector");
-                node_jo = nc_jo.getJSONObject("node");
-
-                networkAddress = host_jo.getString("networkAddress");
-                if (networkAddress.equalsIgnoreCase(networkAddress_1)) {
-                    Assert.assertTrue(dl_jo.getString("macAddress")
-                            .equalsIgnoreCase(dataLayerAddress_1));
-                    Assert.assertTrue(nc_jo.getString("@type")
-                            .equalsIgnoreCase(nodeConnectorType_1));
-                    Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1);
-                    Assert.assertTrue(node_jo.getString("@type")
-                            .equalsIgnoreCase(nodeType_1));
-                    Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1);
-                    Assert.assertTrue(host_jo.getString("vlan")
-                            .equalsIgnoreCase(vlan_1));
-                } else if (networkAddress.equalsIgnoreCase(networkAddress_2)) {
-                    Assert.assertTrue(dl_jo.getString("macAddress")
-                            .equalsIgnoreCase(dataLayerAddress_2));
-                    Assert.assertTrue(nc_jo.getString("@type")
-                            .equalsIgnoreCase(nodeConnectorType_2));
-                    Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_2);
-                    Assert.assertTrue(node_jo.getString("@type")
-                            .equalsIgnoreCase(nodeType_2));
-                    Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_2);
-                    Assert.assertTrue(host_jo.getString("vlan")
-                            .equalsIgnoreCase(vlan_2));
-                } else {
-                    Assert.assertTrue(false);
-                }
+            networkAddress = host_jo.getString("networkAddress");
+            if (networkAddress.equalsIgnoreCase(networkAddress_1)) {
+                Assert.assertTrue(dl_jo.getString("macAddress")
+                        .equalsIgnoreCase(dataLayerAddress_1));
+                Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase(
+                        nodeConnectorType_1));
+                Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1);
+                Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase(
+                        nodeType_1));
+                Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1);
+                Assert.assertTrue(host_jo.getString("vlan").equalsIgnoreCase(
+                        vlan_1));
+            } else if (networkAddress.equalsIgnoreCase(networkAddress_2)) {
+                Assert.assertTrue(dl_jo.getString("macAddress")
+                        .equalsIgnoreCase(dataLayerAddress_2));
+                Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase(
+                        nodeConnectorType_2));
+                Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_2);
+                Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase(
+                        nodeType_2));
+                Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_2);
+                Assert.assertTrue(host_jo.getString("vlan").equalsIgnoreCase(
+                        vlan_2));
+            } else {
+                Assert.assertTrue(false);
             }
-        } catch (Exception e) {
-            // Got an unexpected exception
-            Assert.assertTrue(false);
         }
 
         // test GET method: getActiveHosts() - no host expected
-        try {
-            String result = getJsonResult(baseURL, "GET");
-            Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
+        result = getJsonResult(baseURL, "GET");
+        Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
 
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
-            Assert.assertFalse(hostInJson(json, networkAddress_1));
-            Assert.assertFalse(hostInJson(json, networkAddress_2));
-        } catch (Exception e) {
-            // Got an unexpected exception
-            Assert.assertTrue(false);
-        }
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+        Assert.assertFalse(hostInJson(json, networkAddress_1));
+        Assert.assertFalse(hostInJson(json, networkAddress_2));
 
         // put the 1st host into active host DB
         Node nd;
@@ -931,75 +944,57 @@ public class NorthboundIT {
         }
 
         // verify the host shows up in active host DB
-        try {
-            String result = getJsonResult(baseURL, "GET");
-            Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
 
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
+        result = getJsonResult(baseURL, "GET");
+        Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
 
-            Assert.assertTrue(hostInJson(json, networkAddress_1));
-        } catch (Exception e) {
-            // Got an unexpected exception
-            Assert.assertTrue(false);
-        }
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+
+        Assert.assertTrue(hostInJson(json, networkAddress_1));
 
         // test GET method for getHostDetails()
-        try {
-            String result = getJsonResult(baseURL + "/" + networkAddress_1,
-                    "GET");
-            Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
 
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
+        result = getJsonResult(baseURL + "/" + networkAddress_1, "GET");
+        Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
 
-            Assert.assertFalse(json.length() == 0);
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
 
-            dl_jo = json.getJSONObject("dataLayerAddress");
-            nc_jo = json.getJSONObject("nodeConnector");
-            node_jo = nc_jo.getJSONObject("node");
+        Assert.assertFalse(json.length() == 0);
 
-            Assert.assertTrue(json.getString("networkAddress")
-                    .equalsIgnoreCase(networkAddress_1));
-            Assert.assertTrue(dl_jo.getString("macAddress").equalsIgnoreCase(
-                    dataLayerAddress_1));
-            Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase(
-                    nodeConnectorType_1));
-            Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1);
-            Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase(
-                    nodeType_1));
-            Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1);
-            Assert.assertTrue(json.getString("vlan").equalsIgnoreCase(vlan_1));
-        } catch (Exception e) {
-            // Got an unexpected exception
-            Assert.assertTrue(false);
-        }
+        dl_jo = json.getJSONObject("dataLayerAddress");
+        nc_jo = json.getJSONObject("nodeConnector");
+        node_jo = nc_jo.getJSONObject("node");
+
+        Assert.assertTrue(json.getString("networkAddress").equalsIgnoreCase(
+                networkAddress_1));
+        Assert.assertTrue(dl_jo.getString("macAddress").equalsIgnoreCase(
+                dataLayerAddress_1));
+        Assert.assertTrue(nc_jo.getString("@type").equalsIgnoreCase(
+                nodeConnectorType_1));
+        Assert.assertTrue(Integer.parseInt(nc_jo.getString("@id")) == nodeConnectorId_1);
+        Assert.assertTrue(node_jo.getString("@type").equalsIgnoreCase(
+                nodeType_1));
+        Assert.assertTrue(Integer.parseInt(node_jo.getString("@id")) == nodeId_1);
+        Assert.assertTrue(json.getString("vlan").equalsIgnoreCase(vlan_1));
 
         // test DELETE method for deleteFlow()
-        try {
-            String result = getJsonResult(baseURL + "/" + networkAddress_1,
-                    "DELETE");
-            Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
 
-        } catch (Exception e) {
-            // Got an unexpected exception
-            Assert.assertTrue(false);
-        }
+        result = getJsonResult(baseURL + "/" + networkAddress_1, "DELETE");
+        Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
 
         // verify host_1 removed from active host DB
         // test GET method: getActiveHosts() - no host expected
-        try {
-            String result = getJsonResult(baseURL, "GET");
-            Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
 
-            JSONTokener jt = new JSONTokener(result);
-            JSONObject json = new JSONObject(jt);
+        result = getJsonResult(baseURL, "GET");
+        Assert.assertTrue(httpResponseCode.intValue() == (Integer) 200);
+
+        jt = new JSONTokener(result);
+        json = new JSONObject(jt);
+
+        Assert.assertFalse(hostInJson(json, networkAddress_1));
 
-            Assert.assertFalse(hostInJson(json, networkAddress_1));
-        } catch (Exception e) {
-            // Got an unexpected exception
-            Assert.assertTrue(false);
-        }
     }
 
     private Boolean hostInJson(JSONObject json, String hostIp)
@@ -1104,6 +1099,8 @@ public class NorthboundIT {
 
                 mavenBundle("org.opendaylight.controller", "usermanager",
                         "0.4.0-SNAPSHOT"),
+                mavenBundle("org.opendaylight.controller",
+                        "usermanager.implementation", "0.4.0-SNAPSHOT"),
                 mavenBundle("org.opendaylight.controller", "logging.bridge",
                         "0.4.0-SNAPSHOT"),
                 mavenBundle("org.opendaylight.controller", "clustering.test",
@@ -1290,4 +1287,4 @@ public class NorthboundIT {
                 mavenBundle("com.sun.jersey", "jersey-json", "1.17")
                         .startLevel(2), junitBundles());
     }
-}
\ No newline at end of file
+}
index 850563f..65487a6 100644 (file)
@@ -73,16 +73,16 @@ public class TopologyManagerImplTest {
             NodeConnector tailnc1 = NodeConnectorCreator
                     .createOFNodeConnector((short) (i + 10),
                             NodeCreator.createOFNode((long) (i + 10)));
-            Edge e1 = new Edge(headnc1, tailnc1);
+            Edge e1 = new Edge(tailnc1, headnc1);
             TopoEdgeUpdate teu1 = new TopoEdgeUpdate(e1, props,
                     UpdateType.ADDED);
             topoedgeupdateList.add(teu1);
 
-            NodeConnector headnc2 = NodeConnectorCreator.createOFNodeConnector(
-                    (short) (i + 1), headnc1.getNode());
             NodeConnector tailnc2 = NodeConnectorCreator.createOFNodeConnector(
+                    (short) (i + 1), headnc1.getNode());
+            NodeConnector headnc2 = NodeConnectorCreator.createOFNodeConnector(
                     (short) (i + 11), tailnc1.getNode());
-            Edge e2 = new Edge(headnc2, tailnc2);
+            Edge e2 = new Edge(tailnc2, headnc2);
             TopoEdgeUpdate teu2 = new TopoEdgeUpdate(e2, props,
                     UpdateType.ADDED);
             topoedgeupdateList.add(teu2);
@@ -111,25 +111,12 @@ public class TopologyManagerImplTest {
                         .longValue();
                 Long tailNcId = ((Short) edge.getTailNodeConnector().getID())
                         .longValue();
-                if (nodeId == 1 || nodeId == 3 || nodeId == 5) {
-                    Assert.assertTrue((headNcId.equals(nodeId) && tailNcId
-                            .equals(nodeId + 10))
-                            || (headNcId.equals(nodeId + 10) && tailNcId
-                                    .equals(nodeId))
-                                    || (headNcId.equals(nodeId + 1) && tailNcId
-                                            .equals(nodeId + 11))
-                                            || (headNcId.equals(nodeId + 11) && tailNcId
-                                                    .equals(nodeId + 1)));
-                } else if (nodeId == 11 || nodeId == 13 || nodeId == 15) {
-                    Assert.assertTrue((headNcId.equals(nodeId) && tailNcId
-                            .equals(nodeId - 10))
-                            || (headNcId.equals(nodeId) && tailNcId
-                                    .equals(nodeId - 10))
-                                    || (headNcId.equals(nodeId - 9) && tailNcId
-                                            .equals(nodeId + 1))
-                                            || (headNcId.equals(nodeId + 1) && tailNcId
-                                                    .equals(nodeId - 9)));
-                }
+                Assert.assertTrue(
+                        (headNcId.equals(nodeId) && tailNcId.equals(nodeId + 10))
+                        || (headNcId.equals(nodeId + 11) && tailNcId.equals(nodeId + 1))
+                        || (headNcId.equals(nodeId + 1) && tailNcId.equals(nodeId - 9))
+                        || (headNcId.equals(nodeId - 10) && tailNcId.equals(nodeId))
+                        );
             }
             i.remove();
         }
similarity index 95%
rename from opendaylight/usermanager/pom.xml
rename to opendaylight/usermanager/api/pom.xml
index 1859e8e..057955f 100644 (file)
@@ -6,7 +6,7 @@
     <groupId>org.opendaylight.controller</groupId>
     <artifactId>commons.opendaylight</artifactId>
     <version>1.4.0-SNAPSHOT</version>
-    <relativePath>../commons/opendaylight</relativePath>
+    <relativePath>../../commons/opendaylight</relativePath>
   </parent>
 
   <artifactId>usermanager</artifactId>
             </Import-Package>
             <Export-Package>
               org.opendaylight.controller.usermanager,
+<!-- 
               org.opendaylight.controller.usermanager.internal
-            </Export-Package>
+ -->
+             </Export-Package>
             <Bundle-Activator>
+<!-- 
               org.opendaylight.controller.usermanager.internal.Activator
-            </Bundle-Activator>
+ -->
+             </Bundle-Activator>
           </instructions>
           <manifestLocation>${project.basedir}/META-INF</manifestLocation>
         </configuration>
@@ -6,9 +6,10 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.controller.usermanager.internal;
+package org.opendaylight.controller.usermanager;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import org.opendaylight.controller.sal.utils.Status;
@@ -44,4 +45,9 @@ public class AuthorizationConfig extends UserConfig {
     public String toString() {
         return "AuthorizationConfig=[user: " + user + ", roles: " + roles + "]";
     }
+
+    public String getRolesString() {
+        return super.getRolesString();
+    }
+
 }
@@ -15,9 +15,9 @@ import java.util.Set;
 import org.opendaylight.controller.sal.authorization.AuthResultEnum;
 import org.opendaylight.controller.sal.authorization.UserLevel;
 import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.usermanager.internal.AuthorizationConfig;
-import org.opendaylight.controller.usermanager.internal.ServerConfig;
-import org.opendaylight.controller.usermanager.internal.UserConfig;
+import org.opendaylight.controller.usermanager.AuthorizationConfig;
+import org.opendaylight.controller.usermanager.ServerConfig;
+import org.opendaylight.controller.usermanager.UserConfig;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.web.context.SecurityContextRepository;
 
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.controller.usermanager.internal;
+package org.opendaylight.controller.usermanager;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -18,6 +18,8 @@ import org.junit.Test;
 import org.opendaylight.controller.sal.authorization.AuthResultEnum;
 import org.opendaylight.controller.sal.authorization.UserLevel;
 import org.opendaylight.controller.usermanager.AuthResponse;
+import org.opendaylight.controller.usermanager.AuthorizationConfig;
+import org.opendaylight.controller.usermanager.UserConfig;
 
 /*
  * This test case includes tests for UserConfig and the extending class AuthorizationConfig
diff --git a/opendaylight/usermanager/implementation/pom.xml b/opendaylight/usermanager/implementation/pom.xml
new file mode 100644 (file)
index 0000000..96d6426
--- /dev/null
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?> <project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.controller</groupId>
+    <artifactId>commons.opendaylight</artifactId>
+    <version>1.4.0-SNAPSHOT</version>
+    <relativePath>../../commons/opendaylight</relativePath>
+  </parent>
+
+  <artifactId>usermanager.implementation</artifactId>
+  <version>0.4.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>2.3.6</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Import-Package>
+              org.opendaylight.controller.clustering.services,
+              org.opendaylight.controller.configuration,
+              org.opendaylight.controller.sal.authorization,
+              org.opendaylight.controller.sal.core,
+              org.opendaylight.controller.sal.packet,
+              org.opendaylight.controller.sal.utils,
+              org.opendaylight.controller.switchmanager,
+              org.opendaylight.controller.containermanager,
+              org.slf4j,
+              org.eclipse.osgi.framework.console,
+              org.osgi.framework,
+              org.apache.felix.dm,
+              org.apache.commons.lang3.builder,
+              org.apache.commons.logging,
+              javax.servlet,
+              javax.servlet.http,
+              org.springframework.security.web.context,
+              org.springframework.security.core,
+              org.springframework.security.core.context,
+              org.apache.commons.lang3,
+              org.springframework.security.authentication,
+              org.springframework.security.core.authority,
+              org.springframework.security.core.userdetails,
+              org.opendaylight.controller.usermanager
+            </Import-Package>
+            <Export-Package>
+<!-- 
+              org.opendaylight.controller.usermanager,
+              org.opendaylight.controller.usermanager.internal
+ -->
+             </Export-Package>
+            <Bundle-Activator>
+              org.opendaylight.controller.usermanager.internal.Activator
+            </Bundle-Activator>
+          </instructions>
+          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>usermanager</artifactId>
+      <version>0.4.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>switchmanager</artifactId>
+      <version>0.4.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager</artifactId>
+      <version>0.4.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering.services</artifactId>
+      <version>0.4.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>configuration</artifactId>
+      <version>0.4.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>
@@ -43,11 +43,16 @@ import org.opendaylight.controller.sal.utils.ObjectReader;
 import org.opendaylight.controller.sal.utils.ObjectWriter;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.usermanager.AuthResponse;
+import org.opendaylight.controller.usermanager.AuthorizationConfig;
 import org.opendaylight.controller.usermanager.IAAAProvider;
 import org.opendaylight.controller.usermanager.ISessionManager;
 import org.opendaylight.controller.usermanager.IUserManager;
+import org.opendaylight.controller.usermanager.ServerConfig;
+import org.opendaylight.controller.usermanager.UserConfig;
 import org.opendaylight.controller.usermanager.security.SessionManager;
 import org.opendaylight.controller.usermanager.security.UserSecurityContextRepository;
+import org.opendaylight.controller.usermanager.internal.AuthenticatedUser;
+
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
 import org.slf4j.Logger;
@@ -25,6 +25,9 @@ import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.controller.usermanager.AuthResponse;
 import org.opendaylight.controller.usermanager.IAAAProvider;
 import org.opendaylight.controller.usermanager.IUserManager;
+import org.opendaylight.controller.usermanager.ServerConfig;
+import org.opendaylight.controller.usermanager.UserConfig;
+import org.opendaylight.controller.usermanager.AuthorizationConfig;
 
 /**
  * Unit Tests for UserManagerImpl
@@ -157,7 +160,7 @@ public class UserManagerImplTest {
 
     /**
      * Test method for
-     * {@link org.opendaylight.controller.usermanager.internal.UserManagerImpl#addRemoveLocalUser(org.opendaylight.controller.usermanager.internal.UserConfig, boolean)}
+     * {@link org.opendaylight.controller.usermanager.internal.UserManagerImpl#addRemoveLocalUser(org.opendaylight.controller.usermanager.org.opendaylight.controller.usermanager.internal.UserConfig, boolean)}
      * .
      */
     @Test
index c748171..ba2075d 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.controller.usermanager.IUserManager;
-import org.opendaylight.controller.usermanager.internal.UserConfig;
+import org.opendaylight.controller.usermanager.UserConfig;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;