Merge "Replace exception.printStacktrace with write to log."
authorGiovanni Meo <gmeo@cisco.com>
Tue, 10 Sep 2013 10:41:20 +0000 (10:41 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 10 Sep 2013 10:41:20 +0000 (10:41 +0000)
64 files changed:
NOTICE [new file with mode: 0644]
opendaylight/archetypes/odl-model-project/src/main/resources/archetype-resources/pom.xml
opendaylight/clustering/services/src/main/java/org/opendaylight/controller/clustering/services/CacheConfigException.java
opendaylight/clustering/services/src/main/java/org/opendaylight/controller/clustering/services/CacheExistException.java
opendaylight/clustering/services/src/main/java/org/opendaylight/controller/clustering/services/CacheListenerAddException.java
opendaylight/clustering/services/src/main/java/org/opendaylight/controller/clustering/services/ListenRoleChangeAddException.java
opendaylight/commons/opendaylight/pom.xml
opendaylight/distribution/opendaylight/src/main/resources/configuration/config.ini
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowConfig.java
opendaylight/forwardingrulesmanager/api/src/test/java/org/opendaylight/controller/forwardingrulesmanager/frmTest.java
opendaylight/northbound/flowprogrammer/pom.xml
opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthbound.java
opendaylight/northbound/flowprogrammer/src/main/java/org/opendaylight/controller/flowprogrammer/northbound/FlowProgrammerNorthboundRSApplication.java
opendaylight/northbound/hosttracker/pom.xml
opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthbound.java
opendaylight/northbound/hosttracker/src/main/java/org/opendaylight/controller/hosttracker/northbound/HostTrackerNorthboundRSApplication.java
opendaylight/northbound/integrationtest/pom.xml
opendaylight/northbound/integrationtest/src/test/java/org/opendaylight/controller/northbound/integrationtest/NorthboundIT.java
opendaylight/northbound/networkconfiguration/bridgedomain/pom.xml
opendaylight/northbound/networkconfiguration/bridgedomain/src/main/java/org/opendaylight/controller/networkconfig/bridgedomain/northbound/BridgeDomainNorthboundApplication.java
opendaylight/northbound/staticrouting/pom.xml
opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthbound.java
opendaylight/northbound/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundRSApplication.java
opendaylight/northbound/statistics/pom.xml
opendaylight/northbound/statistics/src/main/java/org/opendaylight/controller/statistics/northbound/StatisticsNorthboundRSApplication.java
opendaylight/northbound/subnets/pom.xml
opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetConfigs.java
opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthbound.java
opendaylight/northbound/subnets/src/main/java/org/opendaylight/controller/subnets/northbound/SubnetsNorthboundRSApplication.java
opendaylight/northbound/switchmanager/pom.xml
opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthboundRSApplication.java
opendaylight/northbound/topology/pom.xml
opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundJAXRS.java
opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyNorthboundRSApplication.java
opendaylight/northbound/topology/src/main/java/org/opendaylight/controller/topology/northbound/TopologyUserLinks.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/action/Action.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/ConstructionException.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/TimeStamp.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/ReadFromFile.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/WriteToFile.java
opendaylight/sal/yang-prototype/pom.xml
opendaylight/sal/yang-prototype/sal/model/model-flow-base/pom.xml
opendaylight/sal/yang-prototype/sal/model/model-flow-base/src/main/yang/flow-types.yang [new file with mode: 0644]
opendaylight/sal/yang-prototype/sal/model/model-flow-base/src/main/yang/match-types.yang [moved from opendaylight/sal/yang-prototype/sal/model/model-flow-base/src/main/yang/opendaylight-flow-base.yang with 75% similarity]
opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/flow-service.yang [new file with mode: 0644]
opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/opendaylight-flow-config.yang [deleted file]
opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/opendaylight-flow-service.yang [deleted file]
opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/packet-processing.yang [new file with mode: 0644]
opendaylight/sal/yang-prototype/sal/model/model-flow-statistics/src/main/yang/flow-statistics.yang [new file with mode: 0644]
opendaylight/sal/yang-prototype/sal/model/model-flow-statistics/src/main/yang/statistics-types.yang [moved from opendaylight/sal/yang-prototype/sal/model/model-flow-statistics/src/main/yang/opendaylight-flow-statistics.yang with 54% similarity]
opendaylight/sal/yang-prototype/sal/model/model-inventory/src/main/yang/inventory.yang [new file with mode: 0644]
opendaylight/sal/yang-prototype/sal/model/model-inventory/src/main/yang/opendaylight-inventory.yang [deleted file]
opendaylight/sal/yang-prototype/sal/pom.xml
opendaylight/sal/yang-prototype/sal/sal-binding-broker-impl/pom.xml
opendaylight/sal/yang-prototype/sal/sal-broker-impl/pom.xml
opendaylight/samples/northbound/loadbalancer/pom.xml
opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/LoadBalancerNorthbound.java
opendaylight/samples/northbound/loadbalancer/src/main/java/org/opendaylight/controller/samples/loadbalancer/northbound/LoadBalancerNorthboundRSApplication.java
opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java
opendaylight/web/devices/src/main/resources/js/page.js
opendaylight/web/flows/src/main/resources/js/page.js
opendaylight/web/root/src/main/java/org/opendaylight/controller/web/DaylightWebAdmin.java
opendaylight/web/root/src/main/resources/js/open.js

diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..5768a81
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,4 @@
+Cisco Systems, Inc. wishes to acknowledge the seminal and leading work of David Erickson.
+David's implementation of Beacon was one of the first open-source network controllers.
+The OpenDaylight Project would not exist were it not for David's intellectual and 
+architectural contribution and his inspiration lives on in the OpenDaylight code base today.
index d9b4720..b843465 100644 (file)
       <id>central2</id>\r
       <name>central2</name>\r
       <url>http://repo2.maven.org/maven2</url>\r
+       <snapshots>\r
+        <enabled>false</enabled>\r
+      </snapshots>\r
+      <releases>\r
+        <enabled>true</enabled>\r
+      </releases>\r
     </pluginRepository>\r
     <pluginRepository>\r
       <id>opendaylight.snapshot</id>\r
       <id>central2</id>\r
       <name>central2</name>\r
       <url>http://repo2.maven.org/maven2</url>\r
+      <snapshots>\r
+        <enabled>false</enabled>\r
+      </snapshots>\r
+      <releases>\r
+        <enabled>true</enabled>\r
+      </releases>\r
     </repository>\r
     <repository>\r
       <id>central</id>\r
       <name>central</name>\r
       <url>http://repo1.maven.org/maven2</url>\r
+      <snapshots>\r
+        <enabled>false</enabled>\r
+      </snapshots>\r
+      <releases>\r
+        <enabled>true</enabled>\r
+      </releases>\r
     </repository>\r
     <!-- Pax mirror -->\r
     <!-- https://oss.sonatype.org/content/repositories/ops4j-releases -->\r
index 4ad7c94..aecb269 100644 (file)
           <groupId>com.google.guava</groupId>
           <artifactId>guava</artifactId>
           <version>${guava.version}</version>
-          <type>jar</type>
         </dependency>
         <dependency>
           <groupId>org.javassist</groupId>
       <id>central2</id>
       <name>central2</name>
       <url>http://repo2.maven.org/maven2</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+          <enabled>true</enabled>
+      </releases>
     </repository>
     <repository>
       <id>central</id>
       <name>central</name>
       <url>http://repo1.maven.org/maven2</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+          <enabled>true</enabled>
+      </releases>
     </repository>
     <!-- Pax mirror -->
     <!-- https://oss.sonatype.org/content/repositories/ops4j-releases -->
       <artifactId>jackson-jaxrs</artifactId>
       <version>${jackson.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.jackson</groupId>
+      <artifactId>jackson-xc</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
     <dependency>
       <groupId>org.codehaus.jettison</groupId>
       <artifactId>jettison</artifactId>
index 5501be4..ba1a54b 100644 (file)
@@ -70,8 +70,8 @@ org.eclipse.gemini.web.tomcat.config.path=configuration/tomcat-server.xml
 # of.discoveryTimeoutMultiple=2
 # For newly added ports, allow one more retry if the elapsed time exceeds this threshold (default 30 sec)
 # of.discoveryThreshold=30
-# The maximum number of ports handled in one discovery batch (default 1024)
-# of.discoveryBatchMaxPorts=1024
+# The maximum number of ports handled in one discovery batch (default 512)
+# of.discoveryBatchMaxPorts=512
 
 # TLS configuration
 # To enable TLS, set secureChannelEnabled=true and specify the location of controller Java KeyStore and TrustStore files.
index 0304af4..ba69c8a 100644 (file)
@@ -832,127 +832,128 @@ public class FlowConfig implements Serializable {
             }
 
             Matcher sstr;
-            if (actions != null && !actions.isEmpty()) {
-                for (String actiongrp : actions) {
-                    // check output ports
-                    sstr = Pattern.compile("OUTPUT=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        for (String t : sstr.group(1).split(",")) {
-                            Matcher n = Pattern.compile("(?:(\\d+))").matcher(t);
-                            if (n.matches()) {
-                                if (n.group(1) != null) {
-                                    Short port = Short.parseShort(n.group(1));
-                                    if (isPortValid(sw, port) == false) {
-                                        String msg = String.format("Output port %d is not valid for this switch", port);
-                                        if (!containerName.equals(GlobalConstants.DEFAULT.toString())) {
-                                            msg += " in Container " + containerName;
-                                        }
-                                        return new Status(StatusCode.BADREQUEST, msg);
+            if (actions == null || actions.isEmpty()) {
+                return new Status(StatusCode.BADREQUEST, "Actions value is null or empty");
+            }
+            for (String actiongrp : actions) {
+                // check output ports
+                sstr = Pattern.compile("OUTPUT=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    for (String t : sstr.group(1).split(",")) {
+                        Matcher n = Pattern.compile("(?:(\\d+))").matcher(t);
+                        if (n.matches()) {
+                            if (n.group(1) != null) {
+                                Short port = Short.parseShort(n.group(1));
+                                if (isPortValid(sw, port) == false) {
+                                    String msg = String.format("Output port %d is not valid for this switch", port);
+                                    if (!containerName.equals(GlobalConstants.DEFAULT.toString())) {
+                                        msg += " in Container " + containerName;
                                     }
+                                    return new Status(StatusCode.BADREQUEST, msg);
                                 }
                             }
                         }
-                        continue;
                     }
-                    // Check src IP
-                    sstr = Pattern.compile(ActionType.FLOOD.toString()).matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if (!containerName.equals(GlobalConstants.DEFAULT.toString())) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "flood is not allowed in container %s", containerName));
-                        }
-                        continue;
+                    continue;
+                }
+                // Check src IP
+                sstr = Pattern.compile(ActionType.FLOOD.toString()).matcher(actiongrp);
+                if (sstr.matches()) {
+                    if (!containerName.equals(GlobalConstants.DEFAULT.toString())) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "flood is not allowed in container %s", containerName));
                     }
-                    // Check src IP
-                    sstr = Pattern.compile(ActionType.SET_NW_SRC.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if (!NetUtils.isIPv4AddressValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format("IP source address %s is not valid",
-                                    sstr.group(1)));
-                        }
-                        continue;
+                    continue;
+                }
+                // Check src IP
+                sstr = Pattern.compile(ActionType.SET_NW_SRC.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if (!NetUtils.isIPv4AddressValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format("IP source address %s is not valid",
+                                sstr.group(1)));
                     }
-                    // Check dst IP
-                    sstr = Pattern.compile(ActionType.SET_NW_DST.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if (!NetUtils.isIPv4AddressValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "IP destination address %s is not valid", sstr.group(1)));
-                        }
-                        continue;
+                    continue;
+                }
+                // Check dst IP
+                sstr = Pattern.compile(ActionType.SET_NW_DST.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if (!NetUtils.isIPv4AddressValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "IP destination address %s is not valid", sstr.group(1)));
                     }
+                    continue;
+                }
 
-                    sstr = Pattern.compile(ActionType.SET_VLAN_ID.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if ((sstr.group(1) != null) && !isVlanIdValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "Vlan ID %s is not in the range 0 - 4095", sstr.group(1)));
-                        }
-                        continue;
+                sstr = Pattern.compile(ActionType.SET_VLAN_ID.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if ((sstr.group(1) != null) && !isVlanIdValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "Vlan ID %s is not in the range 0 - 4095", sstr.group(1)));
                     }
+                    continue;
+                }
 
-                    sstr = Pattern.compile(ActionType.SET_VLAN_PCP.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if ((sstr.group(1) != null) && !isVlanPriorityValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "Vlan priority %s is not in the range 0 - 7", sstr.group(1)));
-                        }
-                        continue;
+                sstr = Pattern.compile(ActionType.SET_VLAN_PCP.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if ((sstr.group(1) != null) && !isVlanPriorityValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "Vlan priority %s is not in the range 0 - 7", sstr.group(1)));
                     }
+                    continue;
+                }
 
-                    sstr = Pattern.compile(ActionType.SET_DL_SRC.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if ((sstr.group(1) != null) && !isL2AddressValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "Ethernet source address %s is not valid. Example: 00:05:b9:7c:81:5f",
-                                    sstr.group(1)));
-                        }
-                        continue;
+                sstr = Pattern.compile(ActionType.SET_DL_SRC.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if ((sstr.group(1) != null) && !isL2AddressValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "Ethernet source address %s is not valid. Example: 00:05:b9:7c:81:5f",
+                                sstr.group(1)));
                     }
-                    sstr = Pattern.compile(ActionType.SET_DL_DST.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if ((sstr.group(1) != null) && !isL2AddressValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "Ethernet destination address %s is not valid. Example: 00:05:b9:7c:81:5f",
-                                    sstr.group(1)));
-                        }
-                        continue;
+                    continue;
+                }
+                sstr = Pattern.compile(ActionType.SET_DL_DST.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if ((sstr.group(1) != null) && !isL2AddressValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "Ethernet destination address %s is not valid. Example: 00:05:b9:7c:81:5f",
+                                sstr.group(1)));
                     }
+                    continue;
+                }
 
-                    sstr = Pattern.compile(ActionType.SET_NW_TOS.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if ((sstr.group(1) != null) && !isTOSBitsValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "IP ToS bits %s is not in the range 0 - 63", sstr.group(1)));
-                        }
-                        continue;
+                sstr = Pattern.compile(ActionType.SET_NW_TOS.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if ((sstr.group(1) != null) && !isTOSBitsValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "IP ToS bits %s is not in the range 0 - 63", sstr.group(1)));
                     }
+                    continue;
+                }
 
-                    sstr = Pattern.compile(ActionType.SET_TP_SRC.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if ((sstr.group(1) != null) && !isTpPortValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "Transport source port %s is not valid", sstr.group(1)));
-                        }
-                        continue;
+                sstr = Pattern.compile(ActionType.SET_TP_SRC.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if ((sstr.group(1) != null) && !isTpPortValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "Transport source port %s is not valid", sstr.group(1)));
                     }
+                    continue;
+                }
 
-                    sstr = Pattern.compile(ActionType.SET_TP_DST.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if ((sstr.group(1) != null) && !isTpPortValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "Transport destination port %s is not valid", sstr.group(1)));
-                        }
-                        continue;
+                sstr = Pattern.compile(ActionType.SET_TP_DST.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if ((sstr.group(1) != null) && !isTpPortValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "Transport destination port %s is not valid", sstr.group(1)));
                     }
-                    sstr = Pattern.compile(ActionType.SET_NEXT_HOP.toString() + "=(.*)").matcher(actiongrp);
-                    if (sstr.matches()) {
-                        if (!NetUtils.isIPAddressValid(sstr.group(1))) {
-                            return new Status(StatusCode.BADREQUEST, String.format(
-                                    "IP destination address %s is not valid", sstr.group(1)));
-                        }
-                        continue;
+                    continue;
+                }
+                sstr = Pattern.compile(ActionType.SET_NEXT_HOP.toString() + "=(.*)").matcher(actiongrp);
+                if (sstr.matches()) {
+                    if (!NetUtils.isIPAddressValid(sstr.group(1))) {
+                        return new Status(StatusCode.BADREQUEST, String.format(
+                                "IP destination address %s is not valid", sstr.group(1)));
                     }
+                    continue;
                 }
             }
             // Check against the container flow
index 176d8e9..a3e1ded 100644 (file)
@@ -19,8 +19,6 @@ import java.util.concurrent.ConcurrentMap;
 
 import org.junit.Assert;
 import org.junit.Test;
-import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
-import org.opendaylight.controller.forwardingrulesmanager.FlowEntry;
 import org.opendaylight.controller.sal.action.Action;
 import org.opendaylight.controller.sal.action.ActionType;
 import org.opendaylight.controller.sal.action.Controller;
@@ -523,6 +521,12 @@ public class frmTest {
         Assert.assertTrue(status.getDescription().contains("Node is null"));
 
         fc.setNode(Node.fromString(Node.NodeIDType.OPENFLOW, "1"));
+        Assert.assertFalse(fc.validate(null).isSuccess());
+        List<String> actions = new ArrayList<String>();
+        fc.setActions(actions);
+        Assert.assertFalse(fc.validate(null).isSuccess());
+        actions.add("OUTPUT=2");
+        fc.setActions(actions);
         Assert.assertTrue(fc.validate(null).isSuccess());
 
         fc.setPriority("-1");
index 6319c7c..7aef065 100644 (file)
@@ -55,6 +55,7 @@
               javax.xml.bind.annotation,
               javax.xml.bind,
               org.slf4j,
+              org.codehaus.jackson.jaxrs,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Export-Package>
index 2d270b4..257fbbd 100644 (file)
@@ -417,7 +417,7 @@ public class FlowProgrammerNorthbound {
             @PathParam(value = "name") String name,
             @PathParam("nodeType") String nodeType,
             @PathParam(value = "nodeId") String nodeId,
-            @TypeHint(FlowConfig.class) JAXBElement<FlowConfig> flowConfig) {
+            @TypeHint(FlowConfig.class) FlowConfig flowConfig) {
 
         if (!NorthboundUtils.isAuthorized(
                 getUserName(), containerName, Privilege.WRITE, this)) {
@@ -425,8 +425,13 @@ public class FlowProgrammerNorthbound {
                     "User is not authorized to perform this operation on container "
                             + containerName);
         }
-        handleResourceCongruence(name, flowConfig.getValue().getName());
-        handleResourceCongruence(nodeId, flowConfig.getValue().getNode().getNodeIDString());
+
+        if (flowConfig.getNode() == null) {
+            return Response.status(Response.Status.BAD_REQUEST).entity("Invalid Configuration. Node is null or empty")
+                    .build();
+        }
+        handleResourceCongruence(name, flowConfig.getName());
+        handleResourceCongruence(nodeId, flowConfig.getNode().getNodeIDString());
         handleDefaultDisabled(containerName);
 
         IForwardingRulesManager frm = getForwardingRulesManagerService(containerName);
@@ -444,7 +449,7 @@ public class FlowProgrammerNorthbound {
                     + RestMessages.RESOURCECONFLICT.toString());
         }
 
-        Status status = frm.addStaticFlow(flowConfig.getValue());
+        Status status = frm.addStaticFlow(flowConfig);
 
         if (status.isSuccess()) {
             NorthboundUtils.auditlog("Flow", username, "added", name, containerName);
index 3c6a5f8..68c0ec1 100644 (file)
@@ -13,6 +13,8 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.ws.rs.core.Application;
 
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
 /**
  * Instance of javax.ws.rs.core.Application used to return the classes
  * that will be instantiated for JAXRS processing, this is necessary
@@ -25,6 +27,7 @@ public class FlowProgrammerNorthboundRSApplication extends Application {
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(FlowProgrammerNorthbound.class);
+        classes.add(JacksonJaxbJsonProvider.class);
         return classes;
     }
 }
index 74e3386..3757ea1 100644 (file)
@@ -58,6 +58,7 @@
               javax.xml.bind,
               org.slf4j,
               org.apache.catalina.filters,
+              org.codehaus.jackson.jaxrs,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Web-ContextPath>/controller/nb/v2/host</Web-ContextPath>
index 91185bb..f0bdf5d 100644 (file)
@@ -432,7 +432,7 @@ public class HostTrackerNorthbound {
             @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
     public Response addHost(@Context UriInfo uriInfo, @PathParam("containerName") String containerName,
             @PathParam("networkAddress") String networkAddress,
-            @TypeHint(HostConfig.class) JAXBElement<HostConfig> hostConfig) {
+            @TypeHint(HostConfig.class) HostConfig hostConfig) {
 
         if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
             return Response.status(Response.Status.UNAUTHORIZED)
@@ -443,7 +443,7 @@ public class HostTrackerNorthbound {
 
         IfIptoHost hostTracker = getIfIpToHostService(containerName);
 
-        HostConfig hc = hostConfig.getValue();
+        HostConfig hc = hostConfig;
         if (!networkAddress.equals(hc.getNetworkAddress())) {
             return Response.status(Response.Status.CONFLICT)
                     .entity("Resource name in config object doesn't match URI")
index 89bee5b..5d50dbf 100644 (file)
@@ -13,6 +13,8 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.ws.rs.core.Application;
 
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
 /**
  * This class is an instance of javax.ws.rs.core.Application used to return the classes
  * that will be instantiated for JAXRS processing, this is necessary
@@ -25,6 +27,7 @@ public class HostTrackerNorthboundRSApplication extends Application {
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(HostTrackerNorthbound.class);
+        classes.add(JacksonJaxbJsonProvider.class);
         return classes;
     }
 }
index eeaa18b..90b36de 100644 (file)
       <id>central2</id>
       <name>central2</name>
       <url>http://repo2.maven.org/maven2</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
     </pluginRepository>
   </pluginRepositories>
   <dependencies>
       <artifactId>jackson-jaxrs</artifactId>
       <version>${jackson.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.jackson</groupId>
+      <artifactId>jackson-xc</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
     <dependency>
       <groupId>org.codehaus.jettison</groupId>
       <artifactId>jettison</artifactId>
index f7ebfe4..27a50c0 100644 (file)
@@ -189,6 +189,9 @@ public class NorthboundIT {
             }
             is.close();
             connection.disconnect();
+            if (debugMsg) {
+                System.out.println("Response : "+sb.toString());
+            }
             return sb.toString();
         } catch (Exception e) {
             return null;
@@ -203,34 +206,47 @@ public class NorthboundIT {
         Assert.assertEquals(nodeId, (Integer) nodeInfo.getInt("id"));
         Assert.assertEquals(nodeType, nodeInfo.getString("type"));
 
-        JSONObject properties = node.getJSONObject("properties");
-
-        if (timestamp == null || timestampName == null) {
-            Assert.assertFalse(properties.has("timeStamp"));
-        } else {
-            Assert.assertEquals(timestamp, (Integer) properties.getJSONObject("timeStamp").getInt("value"));
-            Assert.assertEquals(timestampName, properties.getJSONObject("timeStamp").getString("name"));
-        }
-        if (actionsValue == null) {
-            Assert.assertFalse(properties.has("actions"));
-        } else {
-            Assert.assertEquals(actionsValue, (Integer) properties.getJSONObject("actions").getInt("value"));
-        }
-        if (capabilitiesValue == null) {
-            Assert.assertFalse(properties.has("capabilities"));
-        } else {
-            Assert.assertEquals(capabilitiesValue,
-                    (Integer) properties.getJSONObject("capabilities").getInt("value"));
-        }
-        if (tablesValue == null) {
-            Assert.assertFalse(properties.has("tables"));
-        } else {
-            Assert.assertEquals(tablesValue, (Integer) properties.getJSONObject("tables").getInt("value"));
-        }
-        if (buffersValue == null) {
-            Assert.assertFalse(properties.has("buffers"));
-        } else {
-            Assert.assertEquals(buffersValue, (Integer) properties.getJSONObject("buffers").getInt("value"));
+        JSONArray propsArray = node.getJSONArray("properties");
+
+        for (int j = 0; j < propsArray.length(); j++) {
+            JSONObject properties = propsArray.getJSONObject(j);
+            String propName = properties.getString("name");
+            if (propName.equals("timeStamp")) {
+                if (timestamp == null || timestampName == null) {
+                    Assert.assertFalse("Timestamp exist", true);
+                } else {
+                    Assert.assertEquals(timestamp, (Integer) properties.getInt("value"));
+                    Assert.assertEquals(timestampName, properties.getString("timestampName"));
+                }
+            }
+            if (propName.equals("actions")) {
+                if (actionsValue == null) {
+                    Assert.assertFalse("Actions exist", true);
+                } else {
+                    Assert.assertEquals(actionsValue, (Integer) properties.getInt("value"));
+                }
+            }
+            if (propName.equals("capabilities")) {
+                if (capabilitiesValue == null) {
+                    Assert.assertFalse("Capabilities exist", true);
+                } else {
+                    Assert.assertEquals(capabilitiesValue, (Integer) properties.getInt("value"));
+                }
+            }
+            if (propName.equals("tables")) {
+                if (tablesValue == null) {
+                    Assert.assertFalse("Tables exist", true);
+                } else {
+                    Assert.assertEquals(tablesValue, (Integer) properties.getInt("value"));
+                }
+            }
+            if (propName.equals("buffers")) {
+                if (buffersValue == null) {
+                    Assert.assertFalse("Buffers exist", true);
+                } else {
+                    Assert.assertEquals(buffersValue, (Integer) properties.getInt("value"));
+                }
+            }
         }
     }
 
@@ -240,29 +256,38 @@ public class NorthboundIT {
 
         JSONObject nodeConnector = nodeConnectorProperties.getJSONObject("nodeconnector");
         JSONObject node = nodeConnector.getJSONObject("node");
-        JSONObject properties = nodeConnectorProperties.getJSONObject("properties");
 
         Assert.assertEquals(ncId, (Integer) nodeConnector.getInt("id"));
         Assert.assertEquals(ncType, nodeConnector.getString("type"));
         Assert.assertEquals(nodeId, (Integer) node.getInt("id"));
         Assert.assertEquals(nodeType, node.getString("type"));
-        if (state == null) {
-            Assert.assertFalse(properties.has("state"));
-        } else {
-            Assert.assertEquals(state, (Integer) properties.getJSONObject("state").getInt("value"));
-        }
-        if (capabilities == null) {
-            Assert.assertFalse(properties.has("capabilities"));
-        } else {
-            Assert.assertEquals(capabilities,
-                    (Integer) properties.getJSONObject("capabilities").getInt("value"));
-        }
-        if (bandwidth == null) {
-            Assert.assertFalse(properties.has("bandwidth"));
-        } else {
-            Assert.assertEquals(bandwidth, (Integer) properties.getJSONObject("bandwidth").getInt("value"));
-        }
 
+        JSONArray propsArray = nodeConnectorProperties.getJSONArray("properties");
+        for (int j = 0; j < propsArray.length(); j++) {
+            JSONObject properties = propsArray.getJSONObject(j);
+            String propName = properties.getString("name");
+            if (propName.equals("state")) {
+                if (state == null) {
+                    Assert.assertFalse("State exist", true);
+                } else {
+                    Assert.assertEquals(state, (Integer) properties.getInt("value"));
+                }
+            }
+            if (propName.equals("capabilities")) {
+                if (capabilities == null) {
+                    Assert.assertFalse("Capabilities exist", true);
+                } else {
+                    Assert.assertEquals(capabilities, (Integer) properties.getInt("value"));
+                }
+            }
+            if (propName.equals("bandwidth")) {
+                if (bandwidth == null) {
+                    Assert.assertFalse("bandwidth exist", true);
+                } else {
+                    Assert.assertEquals(bandwidth, (Integer) properties.getInt("value"));
+                }
+            }
+        }
     }
 
     @Test
@@ -291,14 +316,15 @@ public class NorthboundIT {
         String result = getJsonResult(baseURL + "default/subnet/all");
         JSONTokener jt = new JSONTokener(result);
         JSONObject json = new JSONObject(jt);
-        Assert.assertEquals("{}", result);
+        JSONArray subnetConfigs = json.getJSONArray("subnetConfig");
+        Assert.assertEquals(subnetConfigs.length(), 0);
 
         // Test GET subnet1 expecting 404
         result = getJsonResult(baseURL + "default/subnet/" + name1);
         Assert.assertEquals(404, httpResponseCode.intValue());
 
         // Test POST subnet1
-        JSONObject jo = new JSONObject().append("name", name1).append("subnet", subnet1);
+        JSONObject jo = new JSONObject().put("name", name1).put("subnet", subnet1);
         // execute HTTP request and verify response code
         result = getJsonResult(baseURL + "default/subnet/" + name1, "POST", jo.toString());
         Assert.assertTrue(httpResponseCode == 201);
@@ -312,7 +338,7 @@ public class NorthboundIT {
         Assert.assertEquals(subnet1, json.getString("subnet"));
 
         // Test POST subnet2
-        JSONObject jo2 = new JSONObject().append("name", name2).append("subnet", subnet2);
+        JSONObject jo2 = new JSONObject().put("name", name2).put("subnet", subnet2);
         // execute HTTP request and verify response code
         result = getJsonResult(baseURL + "default/subnet/" + name2, "POST", jo2.toString());
         Assert.assertEquals(201, httpResponseCode.intValue());
@@ -322,7 +348,7 @@ public class NorthboundIT {
         result = getJsonResult(baseURL + "default/subnet/" + name2 + "/node-ports", "POST", jo2.toString());
         Assert.assertEquals(200, httpResponseCode.intValue());
         // Test POST subnet3
-        JSONObject jo3 = new JSONObject().append("name", name3).append("subnet", subnet3);
+        JSONObject jo3 = new JSONObject().put("name", name3).put("subnet", subnet3);
         // execute HTTP request and verify response code
         result = getJsonResult(baseURL + "default/subnet/" + name3, "POST", jo3.toString());
         Assert.assertEquals(201, httpResponseCode.intValue());
@@ -350,14 +376,14 @@ public class NorthboundIT {
                 Assert.assertEquals(subnet1, subnetConfig.getString("subnet"));
             } else if (subnetConfig.getString("name").equals(name2)) {
                 Assert.assertEquals(subnet2, subnetConfig.getString("subnet"));
-                String[] nodePortsGet2 = subnetConfig.getString("nodePorts").split(",");
+                String[] nodePortsGet2 = subnetConfig.getJSONArray("nodePorts").getString(0).split(",");
                 Assert.assertEquals(nodePorts2[0], nodePortsGet2[0]);
                 Assert.assertEquals(nodePorts2[1], nodePortsGet2[1]);
                 Assert.assertEquals(nodePorts2[2], nodePortsGet2[2]);
                 Assert.assertEquals(nodePorts2[3], nodePortsGet2[3]);
             } else if (subnetConfig.getString("name").equals(name3)) {
                 Assert.assertEquals(subnet3, subnetConfig.getString("subnet"));
-                String[] nodePortsGet = subnetConfig.getString("nodePorts").split(",");
+                String[] nodePortsGet = subnetConfig.getJSONArray("nodePorts").getString(0).split(",");
                 Assert.assertEquals(nodePorts3[0], nodePortsGet[0]);
                 Assert.assertEquals(nodePorts3[1], nodePortsGet[1]);
                 Assert.assertEquals(nodePorts3[2], nodePortsGet[2]);
@@ -396,7 +422,8 @@ public class NorthboundIT {
         String result = getJsonResult(baseURL + "default");
         JSONTokener jt = new JSONTokener(result);
         JSONObject json = new JSONObject(jt);
-        Assert.assertEquals("{}", result);
+        JSONArray staticRoutes = json.getJSONArray("staticRoute");
+        Assert.assertEquals(staticRoutes.length(), 0);
 
         // Test insert static route
         String requestBody = "{\"name\":\"" + name1 + "\", \"prefix\":\"" + prefix1 + "\", \"nextHop\":\"" + nextHop1
@@ -412,8 +439,8 @@ public class NorthboundIT {
         result = getJsonResult(baseURL + "default");
         jt = new JSONTokener(result);
         json = new JSONObject(jt);
-        JSONArray staticRoutes = json.getJSONArray("staticRoute");
-        Assert.assertEquals(2, staticRoutes.length());
+        JSONArray staticRouteArray = json.getJSONArray("staticRoute");
+        Assert.assertEquals(2, staticRouteArray.length());
         JSONObject route;
         for (int i = 0; i < staticRoutes.length(); i++) {
             route = staticRoutes.getJSONObject(i);
@@ -453,7 +480,9 @@ public class NorthboundIT {
         result = getJsonResult(baseURL + "default");
         jt = new JSONTokener(result);
         json = new JSONObject(jt);
-        JSONObject singleStaticRoute = json.getJSONObject("staticRoute");
+
+        staticRouteArray = json.getJSONArray("staticRoute");
+        JSONObject singleStaticRoute = staticRouteArray.getJSONObject(0);
         Assert.assertEquals(name2, singleStaticRoute.getString("name"));
 
     }
@@ -511,7 +540,8 @@ public class NorthboundIT {
         result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
         jt = new JSONTokener(result);
         json = new JSONObject(jt);
-        JSONObject nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+        JSONArray nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+        JSONObject nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
 
         testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, ncState,
                 ncCapabilities, ncBandwidth);
@@ -520,7 +550,10 @@ public class NorthboundIT {
         result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
         jt = new JSONTokener(result);
         json = new JSONObject(jt);
-        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+
+        nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+        nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
+
 
         testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
                 ncCapabilities, ncBandwidth);
@@ -530,7 +563,8 @@ public class NorthboundIT {
         jt = new JSONTokener(result);
         json = new JSONObject(jt);
 
-        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+        nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+        nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
         testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_3, ncType, nodeId_3, nodeType, ncState,
                 ncCapabilities, ncBandwidth);
 
@@ -547,8 +581,19 @@ public class NorthboundIT {
         json = new JSONObject(jt);
         node = getJsonInstance(json, "nodeProperties", nodeId_1);
         Assert.assertNotNull(node);
-        Assert.assertEquals(1001, node.getJSONObject("properties").getJSONObject("tier").getInt("value"));
-        Assert.assertEquals("node1", node.getJSONObject("properties").getJSONObject("description").getString("value"));
+
+        JSONArray propsArray = node.getJSONArray("properties");
+
+        for (int j = 0; j < propsArray.length(); j++) {
+            JSONObject properties = propsArray.getJSONObject(j);
+            String propName = properties.getString("name");
+            if (propName.equals("tier")) {
+                Assert.assertEquals(1001, properties.getInt("value"));
+            }
+            if (propName.equals("description")) {
+                Assert.assertEquals("node1", properties.getString("value"));
+            }
+        }
 
         // Test delete nodeConnector property
         // Delete state property of nodeconnector1
@@ -559,7 +604,8 @@ public class NorthboundIT {
         result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
         jt = new JSONTokener(result);
         json = new JSONObject(jt);
-        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+        nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+        nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
 
         testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_1, ncType, nodeId_1, nodeType, null,
                 ncCapabilities, ncBandwidth);
@@ -572,7 +618,8 @@ public class NorthboundIT {
         result = getJsonResult(baseURL + "node/STUB/" + nodeId_2);
         jt = new JSONTokener(result);
         json = new JSONObject(jt);
-        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+        nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+        nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
 
         testNodeConnectorProperties(nodeConnectorProperties, nodeConnectorId_2, ncType, nodeId_2, nodeType, ncState,
                 null, ncBandwidth);
@@ -588,7 +635,8 @@ public class NorthboundIT {
         result = getJsonResult(baseURL + "node/STUB/" + nodeId_1);
         jt = new JSONTokener(result);
         json = new JSONObject(jt);
-        nodeConnectorProperties = json.getJSONObject("nodeConnectorProperties");
+        nodeConnectorPropertiesArray = json.getJSONArray("nodeConnectorProperties");
+        nodeConnectorProperties = nodeConnectorPropertiesArray.getJSONObject(0);
 
         // Check for new bandwidth value, state value removed from previous
         // test
@@ -599,9 +647,9 @@ public class NorthboundIT {
 
     @Test
     public void testStatistics() throws JSONException {
-        final String actionTypes[] = { "drop", "loopback", "flood", "floodAll", "controller", "swPath", "hwPath", "output",
-                "setDlSrc", "setDlDst", "setDlType", "setVlanId", "setVlanPcp", "setVlanCfi", "popVlan", "pushVlan",
-                "setNwSrc", "setNwDst", "setNwTos", "setTpSrc", "setTpDst" };
+        final String actionTypes[] = { "DROP", "LOOPBACK", "FLOOD", "FLOOD_ALL", "CONTROLLER", "SW_PATH", "HW_PATH", "OUTPUT",
+                "SET_DL_SRC", "SET_DL_DST", "SET_DL_TYPE", "SET_VLAN_ID", "SET_VLAN_PCP", "SET_VLAN_CFI", "POP_VLAN", "PUSH_VLAN",
+                "SET_NW_SRC", "SET_NW_DST", "SET_NW_TOS", "SET_TP_SRC", "SET_TP_DST" };
         System.out.println("Starting Statistics JAXB client.");
 
         String baseURL = "http://127.0.0.1:8080/controller/nb/v2/statistics/default/";
@@ -635,7 +683,8 @@ public class NorthboundIT {
         Assert.assertEquals(node2.getString("type"), "STUB");
 
         // test that port statistic results are correct
-        JSONObject portStat = portStatistics.getJSONObject("portStatistic");
+        JSONArray portStatArray = portStatistics.getJSONArray("portStatistic");
+        JSONObject portStat = portStatArray.getJSONObject(0);
         Assert.assertTrue(portStat.getInt("receivePackets") == 250);
         Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
         Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
@@ -674,7 +723,9 @@ public class NorthboundIT {
         Assert.assertEquals(node2.getString("type"), "STUB");
 
         // test that port statistic results are correct
-        portStat = json.getJSONObject("portStatistic");
+        portStatArray = json.getJSONArray("portStatistic");
+        portStat = portStatArray.getJSONObject(0);
+
         Assert.assertTrue(portStat.getInt("receivePackets") == 250);
         Assert.assertTrue(portStat.getInt("transmitPackets") == 500);
         Assert.assertTrue(portStat.getInt("receiveBytes") == 1000);
@@ -703,14 +754,18 @@ public class NorthboundIT {
         Assert.assertTrue(flow.getInt("hardTimeout") == 2000);
         Assert.assertTrue(flow.getInt("id") == 12345);
 
-        JSONObject match = (flow.getJSONObject("match").getJSONObject("matchField"));
+        JSONArray matches = (flow.getJSONObject("match").getJSONArray("matchField"));
+        Assert.assertEquals(matches.length(), 1);
+        JSONObject match = matches.getJSONObject(0);
         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));
+        JSONArray actionsArray = flow.getJSONArray("actions");
+        Assert.assertEquals(actionsArray.length(), 1);
+        JSONObject act = actionsArray.getJSONObject(0);
+        Assert.assertTrue(act.getString("type").equals(actionType));
 
-        if (act.getString("@type").equals("output")) {
+        if (act.getString("type").equals("OUTPUT")) {
             JSONObject port = act.getJSONObject("port");
             JSONObject port_node = port.getJSONObject("node");
             Assert.assertTrue(port.getInt("id") == 51966);
@@ -719,7 +774,7 @@ public class NorthboundIT {
             Assert.assertTrue(port_node.getString("type").equals("STUB"));
         }
 
-        if (act.getString("@type").equals("setDlSrc")) {
+        if (act.getString("type").equals("SET_DL_SRC")) {
             byte srcMatch[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2, (byte) 1 };
             String src = act.getString("address");
             byte srcBytes[] = new byte[5];
@@ -731,7 +786,7 @@ public class NorthboundIT {
             Assert.assertTrue(Arrays.equals(srcBytes, srcMatch));
         }
 
-        if (act.getString("@type").equals("setDlDst")) {
+        if (act.getString("type").equals("SET_DL_DST")) {
             byte dstMatch[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
             String dst = act.getString("address");
             byte dstBytes[] = new byte[5];
@@ -742,21 +797,21 @@ public class NorthboundIT {
             dstBytes[4] = Byte.parseByte(dst.substring(8, 10));
             Assert.assertTrue(Arrays.equals(dstBytes, dstMatch));
         }
-        if (act.getString("@type").equals("setDlType"))
+        if (act.getString("type").equals("SET_DL_TYPE"))
             Assert.assertTrue(act.getInt("dlType") == 10);
-        if (act.getString("@type").equals("setVlanId"))
+        if (act.getString("type").equals("SET_VLAN_ID"))
             Assert.assertTrue(act.getInt("vlanId") == 2);
-        if (act.getString("@type").equals("setVlanPcp"))
+        if (act.getString("type").equals("SET_VLAN_PCP"))
             Assert.assertTrue(act.getInt("pcp") == 3);
-        if (act.getString("@type").equals("setVlanCfi"))
+        if (act.getString("type").equals("SET_VLAN_CFI"))
             Assert.assertTrue(act.getInt("cfi") == 1);
 
-        if (act.getString("@type").equals("setNwSrc"))
+        if (act.getString("type").equals("SET_NW_SRC"))
             Assert.assertTrue(act.getString("address").equals("2.2.2.2"));
-        if (act.getString("@type").equals("setNwDst"))
+        if (act.getString("type").equals("SET_NW_DST"))
             Assert.assertTrue(act.getString("address").equals("1.1.1.1"));
 
-        if (act.getString("@type").equals("pushVlan")) {
+        if (act.getString("type").equals("PUSH_VLAN")) {
             int head = act.getInt("VlanHeader");
             // parsing vlan header
             int id = head & 0xfff;
@@ -768,11 +823,11 @@ public class NorthboundIT {
             Assert.assertTrue(pcp == 1);
             Assert.assertTrue(tag == 0x8100);
         }
-        if (act.getString("@type").equals("setNwTos"))
+        if (act.getString("type").equals("SET_NW_TOS"))
             Assert.assertTrue(act.getInt("tos") == 16);
-        if (act.getString("@type").equals("setTpSrc"))
+        if (act.getString("type").equals("SET_TP_SRC"))
             Assert.assertTrue(act.getInt("port") == 4201);
-        if (act.getString("@type").equals("setTpDst"))
+        if (act.getString("type").equals("SET_TP_DST"))
             Assert.assertTrue(act.getInt("port") == 8080);
     }
 
@@ -786,7 +841,7 @@ public class NorthboundIT {
         Assert.assertTrue(result.equals("404"));
 
         // test add flow1
-        String fc = "{\"dynamic\":\"false\", \"name\":\"test1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
+        String fc = "{\"name\":\"test1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
         result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test1", "PUT", fc);
         Assert.assertTrue(httpResponseCode == 201);
 
@@ -797,7 +852,8 @@ public class NorthboundIT {
         JSONTokener jt = new JSONTokener(result);
         JSONObject json = new JSONObject(jt);
         Assert.assertEquals(json.getString("name"), "test1");
-        Assert.assertEquals(json.getString("actions"), "DROP");
+        JSONArray actionsArray = json.getJSONArray("actions");
+        Assert.assertEquals(actionsArray.getString(0), "DROP");
         Assert.assertEquals(json.getString("installInHw"), "true");
         JSONObject node = json.getJSONObject("node");
         Assert.assertEquals(node.getString("type"), "STUB");
@@ -807,13 +863,13 @@ public class NorthboundIT {
         result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test1", "PUT", fc);
         Assert.assertTrue(result.equals("409"));
 
-        fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
+        fc = "{\"name\":\"test2\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
         result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test2", "PUT", fc);
         // test should return 409 for error due to same flow being added.
         Assert.assertTrue(result.equals("409"));
 
         // add second flow that's different
-        fc = "{\"dynamic\":\"false\", \"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
+        fc = "{\"name\":\"test2\", \"nwSrc\":\"1.1.1.1\", \"node\":{\"id\":\"51966\",\"type\":\"STUB\"}, \"actions\":[\"DROP\"]}";
         result = getJsonResult(baseURL + "node/STUB/51966/static-flow/test2", "PUT", fc);
         Assert.assertTrue(httpResponseCode == 201);
 
@@ -1132,10 +1188,20 @@ public class NorthboundIT {
 
             JSONObject headNC = edge.getJSONObject("headNodeConnector");
             JSONObject headNode = headNC.getJSONObject("node");
-            JSONObject Props = edgeProp.getJSONObject("properties");
-            JSONObject bandw = Props.getJSONObject("bandwidth");
-            JSONObject stt = Props.getJSONObject("state");
-            JSONObject ltc = Props.getJSONObject("latency");
+
+            JSONArray propsArray = edgeProp.getJSONArray("properties");
+
+            JSONObject bandw = null;
+            JSONObject stt = null;
+            JSONObject ltc = null;
+
+            for (int j = 0; j < propsArray.length(); j++) {
+                JSONObject props = propsArray.getJSONObject(j);
+                String propName = props.getString("name");
+                if (propName.equals("bandwidth")) bandw = props;
+                if (propName.equals("state")) stt = props;
+                if (propName.equals("latency")) ltc = props;
+            }
 
             if (headNC.getInt("id") == headNC1_nodeConnId) {
                 Assert.assertEquals(headNode.getString("type"), nodeType);
@@ -1174,10 +1240,10 @@ public class NorthboundIT {
         Integer nodeConnectorId_2 = 34;
 
         JSONObject jo = new JSONObject()
-                .append("name", "userLink_1")
-                .append("srcNodeConnector",
+                .put("name", "userLink_1")
+                .put("srcNodeConnector",
                         nodeConnectorType_1 + "|" + nodeConnectorId_1 + "@" + nodeType_1 + "|" + nodeId_1)
-                .append("dstNodeConnector",
+                .put("dstNodeConnector",
                         nodeConnectorType_2 + "|" + nodeConnectorId_2 + "@" + nodeType_2 + "|" + nodeId_2);
         // execute HTTP request and verify response code
         result = getJsonResult(baseURL + "/user-link", "PUT", jo.toString());
@@ -1331,6 +1397,7 @@ public class NorthboundIT {
                 mavenBundle("org.codehaus.jackson", "jackson-mapper-asl").versionAsInProject(),
                 mavenBundle("org.codehaus.jackson", "jackson-core-asl").versionAsInProject(),
                 mavenBundle("org.codehaus.jackson", "jackson-jaxrs").versionAsInProject(),
+                mavenBundle("org.codehaus.jackson", "jackson-xc").versionAsInProject(),
                 mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),
 
                 mavenBundle("commons-io", "commons-io").versionAsInProject(),
index 5993f16..b7da964 100644 (file)
@@ -58,6 +58,7 @@
               javax.xml.bind.annotation,
               javax.xml.bind,
               org.apache.catalina.filters,
+              org.codehaus.jackson.jaxrs,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Export-Package>
index 1d1fd15..0d98d22 100644 (file)
@@ -13,6 +13,8 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.ws.rs.core.Application;
 
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
 /**
  * Instance of javax.ws.rs.core.Application used to return the classes
  * that will be instantiated for JAXRS processing, this is necessary
@@ -25,6 +27,7 @@ public class BridgeDomainNorthboundApplication extends Application {
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(BridgeDomainNorthbound.class);
+        classes.add(JacksonJaxbJsonProvider.class);
         return classes;
     }
 }
index d308fba..62f5b42 100644 (file)
@@ -56,6 +56,7 @@
               javax.xml.bind.annotation,
               javax.xml.bind,
               org.apache.catalina.filters,
+              org.codehaus.jackson.jaxrs,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Export-Package>
index 8462ef8..65e68aa 100644 (file)
@@ -233,7 +233,7 @@ public class StaticRoutingNorthbound {
             @Context UriInfo uriInfo,
             @PathParam(value = "containerName") String containerName,
             @PathParam(value = "route") String route,
-            @TypeHint(StaticRoute.class) JAXBElement<StaticRoute> staticRouteData) {
+            @TypeHint(StaticRoute.class) StaticRoute staticRouteData) {
 
 
         if(!NorthboundUtils.isAuthorized(getUserName(), containerName,
@@ -253,7 +253,7 @@ public class StaticRoutingNorthbound {
                     .toString());
         }
 
-        StaticRoute sRoute = staticRouteData.getValue();
+        StaticRoute sRoute = staticRouteData;
         StaticRouteConfig cfgObject = new StaticRouteConfig(sRoute.getName(),
                 sRoute.getPrefix(), sRoute.getNextHop());
         Status response = staticRouting.addStaticRoute(cfgObject);
index a39794d..a98a124 100644 (file)
@@ -13,6 +13,8 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.ws.rs.core.Application;
 
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
 /**
  * Instance of javax.ws.rs.core.Application used to return the classes
  * that will be instantiated for JAXRS processing, this is necessary
@@ -25,6 +27,7 @@ public class StaticRoutingNorthboundRSApplication extends Application {
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(StaticRoutingNorthbound.class);
+        classes.add(JacksonJaxbJsonProvider.class);
         return classes;
     }
 }
index 6a5a08e..eb2bf58 100644 (file)
@@ -64,6 +64,7 @@
                 javax.xml.bind,
                 org.slf4j,
                 org.apache.catalina.filters,
+                org.codehaus.jackson.jaxrs,
                 !org.codehaus.enunciate.jaxrs
               </Import-Package>
             <Export-Package>
index d387407..2b6dccc 100644 (file)
@@ -12,6 +12,8 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.ws.rs.core.Application;
 
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
 /**
  * Instance of javax.ws.rs.core.Application used to return the classes
  * that will be instantiated for JAXRS processing, this is necessary
@@ -24,6 +26,7 @@ public class StatisticsNorthboundRSApplication extends Application {
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(StatisticsNorthbound.class);
+        classes.add(JacksonJaxbJsonProvider.class);
         return classes;
     }
 }
index 72b0a04..9feb95f 100644 (file)
@@ -71,6 +71,7 @@
               javax.xml.bind.annotation,
               org.slf4j,
               org.apache.catalina.filters,
+              org.codehaus.jackson.jaxrs,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Export-Package>
index a5e805d..50024fd 100644 (file)
@@ -254,7 +254,7 @@ public class SubnetsNorthbound {
             @ResponseCode(code = 503, condition = "Service unavailable") })
     public Response addSubnet(@PathParam("containerName") String containerName,
             @PathParam("subnetName") String subnetName,
-            @TypeHint(SubnetConfig.class) JAXBElement<SubnetConfig> subnetConfigData) {
+            @TypeHint(SubnetConfig.class) SubnetConfig subnetConfigData) {
 
         handleContainerDoesNotExist(containerName);
 
@@ -262,7 +262,7 @@ public class SubnetsNorthbound {
             throw new UnauthorizedException("User is not authorized to perform this operation on container "
                     + containerName);
         }
-        SubnetConfig cfgObject = subnetConfigData.getValue();
+        SubnetConfig cfgObject = subnetConfigData;
         handleNameMismatch(cfgObject.getName(), subnetName);
 
         ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, containerName, this);
@@ -377,7 +377,7 @@ public class SubnetsNorthbound {
             @ResponseCode(code = 503, condition = "Service unavailable") })
     public Response modifySubnet(@PathParam("containerName") String containerName,
             @PathParam("subnetName") String subnetName,
-            @TypeHint(SubnetConfig.class) JAXBElement<SubnetConfig> subnetConfigData) {
+            @TypeHint(SubnetConfig.class) SubnetConfig subnetConfigData) {
 
         handleContainerDoesNotExist(containerName);
 
@@ -385,7 +385,7 @@ public class SubnetsNorthbound {
             throw new UnauthorizedException("User is not authorized to perform this operation on container "
                     + containerName);
         }
-        handleNameMismatch(subnetConfigData.getValue().getName(), subnetName);
+        handleNameMismatch(subnetConfigData.getName(), subnetName);
 
         ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, containerName,
                 this);
@@ -393,7 +393,7 @@ public class SubnetsNorthbound {
             throw new ServiceUnavailableException("SwitchManager " + RestMessages.SERVICEUNAVAILABLE.toString());
         }
 
-        SubnetConfig subnetConf = subnetConfigData.getValue();
+        SubnetConfig subnetConf = subnetConfigData;
         SubnetConfig existingConf = switchManager.getSubnetConfig(subnetName);
 
         boolean successful = true;
@@ -488,7 +488,7 @@ public class SubnetsNorthbound {
             @ResponseCode(code = 503, condition = "Service unavailable") })
     public Response addNodePorts(@PathParam("containerName") String containerName,
             @PathParam("subnetName") String subnetName,
-            @TypeHint(SubnetConfig.class) JAXBElement<SubnetConfig> subnetConfigData) {
+            @TypeHint(SubnetConfig.class) SubnetConfig subnetConfigData) {
 
         handleContainerDoesNotExist(containerName);
 
@@ -496,9 +496,9 @@ public class SubnetsNorthbound {
             throw new UnauthorizedException("User is not authorized to perform this operation on container "
                     + containerName);
         }
-        handleNameMismatch(subnetConfigData.getValue().getName(), subnetName);
+        handleNameMismatch(subnetConfigData.getName(), subnetName);
 
-        SubnetConfig subnetConf = subnetConfigData.getValue();
+        SubnetConfig subnetConf = subnetConfigData;
 
         ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, containerName,
                 this);
@@ -586,7 +586,7 @@ public class SubnetsNorthbound {
             @ResponseCode(code = 503, condition = "Service unavailable") })
     public Response deleteNodePorts(@PathParam("containerName") String containerName,
             @PathParam("subnetName") String subnetName,
-            @TypeHint(SubnetConfig.class) JAXBElement<SubnetConfig> subnetConfigData) {
+            @TypeHint(SubnetConfig.class) SubnetConfig subnetConfigData) {
 
         handleContainerDoesNotExist(containerName);
 
@@ -594,9 +594,9 @@ public class SubnetsNorthbound {
             throw new UnauthorizedException("User is not authorized to perform this operation on container "
                     + containerName);
         }
-        handleNameMismatch(subnetConfigData.getValue().getName(), subnetName);
+        handleNameMismatch(subnetConfigData.getName(), subnetName);
 
-        SubnetConfig subnetConf = subnetConfigData.getValue();
+        SubnetConfig subnetConf = subnetConfigData;
 
         if (subnetConf.getNodePorts() == null || subnetConf.getNodePorts().isEmpty()) {
             throw new BadRequestException(RestMessages.INVALIDDATA.toString() + " : invalid node ports");
index a5eaf94..e03cac6 100644 (file)
@@ -12,6 +12,8 @@ import java.util.Set;
 
 import javax.ws.rs.core.Application;
 
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
 /**
  * Instance of javax.ws.rs.core.Application used to return the classes
  * that will be instantiated for JAXRS processing, this is necessary
@@ -24,6 +26,7 @@ public class SubnetsNorthboundRSApplication extends Application {
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(SubnetsNorthbound.class);
+        classes.add(JacksonJaxbJsonProvider.class);
         return classes;
     }
 }
index 7196883..965075a 100644 (file)
@@ -57,6 +57,7 @@
               javax.xml.bind,
               org.slf4j,
               org.apache.catalina.filters,
+              org.codehaus.jackson.jaxrs,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Web-ContextPath>/controller/nb/v2/switch</Web-ContextPath>
index d33c3c9..1cdfd31 100644 (file)
@@ -13,6 +13,8 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.ws.rs.core.Application;
 
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
 /**
  * Instance of javax.ws.rs.core.Application used to return the classes
  * that will be instantiated for JAXRS processing, this is necessary
@@ -25,6 +27,7 @@ public class SwitchNorthboundRSApplication extends Application {
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(SwitchNorthbound.class);
+        classes.add(JacksonJaxbJsonProvider.class);
         return classes;
     }
 }
index ec43a5e..b2b7b9c 100644 (file)
@@ -60,6 +60,7 @@
               javax.xml.bind.annotation,
               org.slf4j,
               org.apache.catalina.filters,
+              org.codehaus.jackson.jaxrs,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Web-ContextPath>/controller/nb/v2/topology</Web-ContextPath>
index c20cb26..508ffaf 100644 (file)
@@ -200,8 +200,7 @@ public class TopologyNorthboundJAXRS {
         if (topo != null) {
             List<EdgeProperties> res = new ArrayList<EdgeProperties>();
             for (Map.Entry<Edge, Set<Property>> entry : topo.entrySet()) {
-                EdgeProperties el = new EdgeProperties(entry.getKey(),
-                        entry.getValue());
+                EdgeProperties el = new EdgeProperties(entry.getKey(), entry.getValue());
                 res.add(el);
             }
             return new Topology(res);
@@ -316,7 +315,7 @@ public class TopologyNorthboundJAXRS {
             @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
     public Response addUserLink(
             @PathParam(value = "containerName") String containerName,
-            @TypeHint(TopologyUserLinkConfig.class) JAXBElement<TopologyUserLinkConfig> userLinkConfig) {
+            @TypeHint(TopologyUserLinkConfig.class) TopologyUserLinkConfig userLinkConfig) {
 
         if (!NorthboundUtils.isAuthorized(
                 getUserName(), containerName, Privilege.WRITE, this)) {
@@ -331,9 +330,9 @@ public class TopologyNorthboundJAXRS {
                     RestMessages.NOCONTAINER.toString());
         }
 
-        Status status = topologyManager.addUserLink(userLinkConfig.getValue());
+        Status status = topologyManager.addUserLink(userLinkConfig);
         if (status.isSuccess()) {
-            NorthboundUtils.auditlog("User Link", username, "added", userLinkConfig.getValue().getName(), containerName);
+            NorthboundUtils.auditlog("User Link", username, "added", userLinkConfig.getName(), containerName);
             return Response.status(Response.Status.CREATED).build();
         }
         throw new InternalServerErrorException(status.getDescription());
index 299bfcd..992cf6a 100644 (file)
@@ -13,6 +13,8 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.ws.rs.core.Application;
 
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
 /**
  * Instance of javax.ws.rs.core.Application used to return the classes
  * that will be instantiated for JAXRS processing, this is necessary
@@ -25,6 +27,7 @@ public class TopologyNorthboundRSApplication extends Application {
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(TopologyNorthboundJAXRS.class);
+        classes.add(JacksonJaxbJsonProvider.class);
         return classes;
     }
 }
index 1938cb1..0895d9a 100644 (file)
@@ -131,6 +131,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa
 
     class DiscoveryTransmit implements Runnable {
         private final BlockingQueue<NodeConnector> transmitQ;
+        private int count = 0;
 
         DiscoveryTransmit(BlockingQueue<NodeConnector> transmitQ) {
             this.transmitQ = transmitQ;
@@ -144,6 +145,9 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa
                     RawPacket outPkt = createDiscoveryPacket(nodeConnector);
                     sendDiscoveryPacket(nodeConnector, outPkt);
                     nodeConnector = null;
+                    if ((++count & 0x7f) == 0) {
+                        Thread.sleep(10);
+                    }
                 } catch (InterruptedException e1) {
                     logger.warn("DiscoveryTransmit interupted", e1.getMessage());
                     if (shuttingDown) {
@@ -1679,7 +1683,7 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa
      */
     private int getDiscoveryBatchMaxPorts() {
         String val = System.getProperty("of.discoveryBatchMaxPorts");
-        int ports = 1024;
+        int ports = 512;
 
         if (val != null) {
             try {
index 8fc8fc1..515a61e 100644 (file)
@@ -12,6 +12,7 @@ import java.io.Serializable;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlTransient;
@@ -34,7 +35,7 @@ public abstract class Action implements Serializable {
     private static final Logger logger = LoggerFactory.getLogger(Action.class);
     private static boolean debug = false; // Enable to find where in the code an
     // invalid assignment is made
-    @XmlTransient
+    @XmlElement
     protected ActionType type;
     private transient boolean isValid = true;
 
index 30033a2..446debd 100644 (file)
@@ -19,8 +19,6 @@
  */
 package org.opendaylight.controller.sal.core;
 
-import java.lang.Exception;
-
 public class ConstructionException extends Exception {
     private static final long serialVersionUID = 1L;
 
index a2d3d36..c0c8da7 100644 (file)
@@ -29,7 +29,7 @@ public class TimeStamp extends Property {
     private static final long serialVersionUID = 1L;
     @XmlElement(name = "value")
     private long timestamp;
-    @XmlElement(name = "name")
+    @XmlElement(name = "timestampName")
     private String timestampName;
 
     public static final String TimeStampPropName = "timeStamp";
index 1d31eaa..a9c9e3e 100644 (file)
@@ -20,20 +20,16 @@ import java.io.*;
  */
 public class ReadFromFile {
     private FileInputStream fileStream;
-    private DataInputStream dataInput;
-    private BufferedReader bufferedReader;
-    private String fileName;
     private File filePointer;
 
-    public ReadFromFile(String name) throws FileNotFoundException {
-        fileName = name;
-        fileStream = new FileInputStream(this.fileName);
+    public ReadFromFile(String fileName) throws FileNotFoundException {
+        fileStream = new FileInputStream(fileName);
         filePointer = new File(fileName); //needed to allow file deletion
     }
 
     public ArrayList<String> readFile() throws IOException {
-        dataInput = new DataInputStream(this.fileStream);
-        bufferedReader = new BufferedReader(new InputStreamReader(dataInput));
+        DataInputStream dataInput = new DataInputStream(this.fileStream);
+        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(dataInput));
 
         ArrayList<String> lineList = new ArrayList<String>();
         String line;
index b462432..2717c94 100644 (file)
@@ -26,10 +26,8 @@ public class WriteToFile {
     .getLogger(WriteToFile.class);
     private FileWriter fstream;
     private BufferedWriter bufferOut;
-    private String fileName;
 
-    public WriteToFile(String name) throws IOException {
-        fileName = name;
+    public WriteToFile(String fileName) throws IOException {
         fstream = new FileWriter(fileName);
         bufferOut = new BufferedWriter(fstream);
     }
index 4c5db10..b110759 100644 (file)
           <id>central2</id>
           <name>central2</name>
           <url>http://repo2.maven.org/maven2</url>
+          <snapshots>
+             <enabled>false</enabled>
+          </snapshots>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
         </pluginRepository>
         <pluginRepository>
             <id>opendaylight.snapshot</id>
           <id>central2</id>
           <name>central2</name>
           <url>http://repo2.maven.org/maven2</url>
+          <snapshots>
+            <enabled>false</enabled>
+          </snapshots>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
         </repository>
         <repository>
           <id>central</id>
           <name>central</name>
           <url>http://repo1.maven.org/maven2</url>
+          <snapshots>
+             <enabled>false</enabled>
+          </snapshots>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
         </repository>
         <!-- Pax mirror -->
         <!-- https://oss.sonatype.org/content/repositories/ops4j-releases -->
index 6eaaeba..6c05073 100644 (file)
@@ -14,7 +14,7 @@
 
     <modelVersion>4.0.0</modelVersion>
     <artifactId>model-flow-base</artifactId>
-
+    
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
diff --git a/opendaylight/sal/yang-prototype/sal/model/model-flow-base/src/main/yang/flow-types.yang b/opendaylight/sal/yang-prototype/sal/model/model-flow-base/src/main/yang/flow-types.yang
new file mode 100644 (file)
index 0000000..ed92bf4
--- /dev/null
@@ -0,0 +1,113 @@
+module opendaylight-flow-types {
+    namespace "urn:opendaylight:flow:types";
+    prefix flow;
+
+    import ietf-inet-types {prefix inet;}
+    import opendaylight-match-types {prefix match;}
+    import ietf-yang-types {prefix yang;}
+
+
+    revision "2013-08-19" {
+        description "Initial revision of flow service";
+    }
+
+    grouping action {
+        choice action {
+            case output-action {
+                leaf-list output-node-connector {
+                    type inet:uri;
+                }
+            }
+
+            case controller-action {
+                leaf max-length {
+                    type uint16 {
+                        range "0..65294";
+                    }
+                }
+            }
+
+            case set-queue-action {
+                leaf queue {
+                    type string; // TODO: define queues
+                }
+            }
+
+            case pop-mpls-action {
+                leaf ethernet-type {
+                        type uint16; // TODO: define ethertype type
+                }
+            }
+
+            case set-mpls-ttl-action {
+                leaf mpls-ttl {
+                    type uint8;
+                }
+            }
+
+            case set-nw-ttl-action {
+                leaf nw-ttl {
+                    type uint8;
+                }
+            }
+
+            case push-pbb-action {
+
+            }
+
+            case push-mpls-action {
+
+            }
+
+            case push-vlan-action {
+
+            }
+        }
+    }
+
+    grouping flow {
+        container match {
+            uses match:match;
+        }
+        list action {
+            key "order";
+            leaf order {
+                type int32;
+            }
+            uses action;
+        }
+    }
+
+    grouping flow-statistics {
+        leaf packet-count {
+            type yang:counter64;
+        } 
+
+        leaf byte-count {
+            type yang:counter64;
+        }
+
+        container duration {
+            leaf second {
+                type yang:counter64;
+            }
+            leaf nanosecond {
+                type yang:counter64;
+            }
+        }
+    }
+
+    grouping flow-table-statistics {
+        leaf active {
+            type yang:counter64;
+        } 
+
+        leaf lookup {
+            type yang:counter64;
+        }
+
+        leaf matched {
+            type yang:counter64;   
+        }
+    }
+}
\ No newline at end of file
@@ -1,37 +1,36 @@
-module opendaylight-flow-base {
-    namespace "urn:opendaylight:flow:base";
-    prefix "flowbase";
+module opendaylight-match-types {
+    namespace "urn:opendaylight:model:match:types";
+    prefix "match";
 
-    import yang-ext {prefix ext;}
     import ietf-inet-types {prefix inet;}
     import ietf-yang-types {prefix yang;}
-    import opendaylight-inventory {prefix inv;}
     import opendaylight-l2-types {prefix l2t;}
 
     revision "2013-08-19" {
         description "Initial revision of flow service";
     }
 
+    grouping "mac-address-filter" {
+        leaf address {
+            mandatory true;
+            type yang:mac-address;
+        }
+        leaf mask {
+            type binary;
+        }
+    }
+
      /** Match Groupings **/
     grouping "ethernet-match-fields" {
         container ethernet-source {
-            //description "Ethernet source address.";
-            //presence "Match field is active and set";
-            leaf address {
-                mandatory true;
-                type yang:mac-address;
-            }
-            leaf mask {
-                type binary;
-            }
+            description "Ethernet source address.";
+            presence "Match field is active and set";
+            uses mac-address-filter;
         }
         container ethernet-destination {
             description "Ethernet destination address.";
             presence "Match field is active and set";
-            leaf address {
-                mandatory true;
-                type yang:mac-address;
-            }
+            uses mac-address-filter;
         }
         container ethernet-type {
             description "Ethernet frame type.";
@@ -64,8 +63,6 @@ module opendaylight-flow-base {
             description "VLAN priority.";
             type l2t:vlan-pcp;
         }
-        
-
     }
 
     grouping "ip-match-fields" {
@@ -106,7 +103,6 @@ module opendaylight-flow-base {
         }
     }
 
-
     grouping "udp-match-fields" {
         leaf udp-source-port {
             description "UDP source port.";
@@ -151,7 +147,7 @@ module opendaylight-flow-base {
         }
     }
 
-    grouping "arp-match-fields" {     
+    grouping "arp-match-fields" {
         leaf arp-source-transport-address {
             description "ARP source IPv4 address.";
             type inet:ipv4-prefix;
@@ -164,31 +160,19 @@ module opendaylight-flow-base {
         container arp-source-hardware-address {
             description "ARP source hardware address.";
             presence "Match field is active and set";
-            leaf address {
-                mandatory true;
-                type yang:mac-address;
-            }
-            leaf mask {
-                type binary;
-            }
+        uses mac-address-filter;
         }
         container arp-target-hardware-address {
             description "ARP target hardware address.";
             presence "Match field is active and set";
-            leaf address {
-                mandatory true;
-                type yang:mac-address;
-            }
-            leaf mask {
-                type binary;
-            }
+        uses mac-address-filter;
         }
     }
 
     grouping action {
         choice action {
             case output-action {
-                leaf output-node-connector {
+                leaf-list output-node-connector {
                     type string;
                 }
             }
@@ -241,48 +225,43 @@ module opendaylight-flow-base {
         }
     }
 
-    grouping flow {
-        leaf node {
-            type inv:node-id;
+
+    grouping match {
+        container "ethernet-match" {
+            uses "ethernet-match-fields";
         }
-        container match {
-            container "ethernet-match" {
-                uses "ethernet-match-fields";
-            }
-            container "vlan-match" {
-                uses "vlan-match-fields";
-            }
-            container "ip-match" {
-                uses "ip-match-fields";
-            }
-            container "ipv4-match" {
+        container "vlan-match" {
+            uses "vlan-match-fields";
+        }
+        container "ip-match" {
+            uses "ip-match-fields";
+        }
+        
+        choice layer-3-match {
+            case "ipv4-match" {
                 uses "ipv4-match-fields";
             }
-            container "ipv6-match" {
+            case "ipv6-match" {
                 uses "ipv6-match-fields";
             }
-            container "udp-match" {
+            case "arp-match" {
+                uses "arp-match-fields";
+            }
+        }
+        
+        choice layer-4-match {
+            case "udp-match" {
                 uses "udp-match-fields";
             }
-            container "tcp-match" {
+            case "tcp-match" {
                 uses "tcp-match-fields";
             }
-            container "sctp-match" {
+            case "sctp-match" {
                 uses "sctp-match-fields";
             }
-            container "icmpv4-match" {
-                uses "icmpv4-match-fields";
-            }
-            container "arp-match" {
-                uses "arp-match-fields";
-            }
         }
-        list action {
-            key "order";
-            leaf order {
-                type int32;
-            }
-            uses action;
+        container "icmpv4-match" {
+            uses "icmpv4-match-fields";
         }
     }
 }
\ No newline at end of file
diff --git a/opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/flow-service.yang b/opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/flow-service.yang
new file mode 100644 (file)
index 0000000..113cb12
--- /dev/null
@@ -0,0 +1,81 @@
+module sal-flow {
+    namespace "urn:opendaylight:flow:service";
+    prefix flow;
+
+    import yang-ext {prefix ext;}
+    import opendaylight-inventory {prefix inv;}
+    import ietf-inet-types {prefix inet;}
+    import opendaylight-flow-types {prefix types;}
+
+
+    revision "2013-08-19" {
+        description "Initial revision of flow service";
+    }
+
+
+    typedef flow-table-ref {
+        type instance-identifier;
+    }
+    
+    grouping node-flow {
+        leaf node {
+            type inv:node-ref;
+        }
+        leaf flow-table {
+            type flow-table-ref;
+        }
+        uses types:flow;
+    }
+
+    /** Base configuration structure **/
+    grouping flow-update {
+        container original-flow {
+            uses types:flow;
+        }
+        container updated-flow {
+            uses types:flow;
+        }
+    }
+
+    rpc add-flow {
+        input {
+            uses node-flow;
+        }
+    }
+
+    rpc remove-flow {
+        input {
+            uses node-flow;
+        }
+    }
+
+    rpc update-flow {
+        input {
+            uses node-flow;
+        }
+    }
+
+    notification flow-added {
+        uses node-flow;
+    }
+
+    notification flow-updated {
+        uses node-flow;
+    }
+
+    notification flow-removed {
+        uses node-flow;
+    }
+
+    augment "/inv:nodes/inv:node" {
+        ext:augment-identifier "flow-capable-node";
+        container flow-tables {
+            list table {
+                key "id";
+                leaf "id" {
+                    type inet:uri;
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/opendaylight-flow-config.yang b/opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/opendaylight-flow-config.yang
deleted file mode 100644 (file)
index a4ecf73..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-module opendaylight-flow-config {
-    namespace "urn:opendaylight:flow:config";
-    prefix flow;
-
-    import yang-ext {prefix ext;}
-    import opendaylight-inventory {prefix inv;}
-    import opendaylight-flow-base {prefix flowbase;}
-
-    revision "2013-08-19" {
-        description "Initial revision of flow service";
-    }
-
-    /** Base configuration structure 
-    container flows {
-        list flow {
-            uses flowbase:flow;
-        }
-    }
-
-    **/
-}
\ No newline at end of file
diff --git a/opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/opendaylight-flow-service.yang b/opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/opendaylight-flow-service.yang
deleted file mode 100644 (file)
index 0f01de5..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-module opendaylight-flow-service {
-    namespace "urn:opendaylight:flow:service";
-    prefix flow;
-
-    import yang-ext {prefix ext;}
-    import opendaylight-inventory {prefix inv;}
-    import opendaylight-flow-base {prefix flowbase;}
-
-    revision "2013-08-19" {
-        description "Initial revision of flow service";
-    }
-
-    /** Base configuration structure **/
-    
-
-    grouping flow-update {
-        container original-flow {
-            uses flowbase:flow;
-        }
-        container updated-flow {
-            uses flowbase:flow;
-        }
-    }
-
-    rpc add-flow {
-        input {
-            uses flowbase:flow;
-        }
-    }
-
-    rpc remove-flow {
-        input {
-            uses flowbase:flow;
-        }
-    }
-
-    rpc update-flow {
-        input {
-            uses flow-update;
-        }
-    }
-
-    notification flow-added {
-        uses flowbase:flow;
-    }
-
-    notification flow-updated {
-        input {
-            uses flow-update;
-        }
-    }
-
-    notification flow-removed {
-        uses flowbase:flow;
-    }
-}
\ No newline at end of file
diff --git a/opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/packet-processing.yang b/opendaylight/sal/yang-prototype/sal/model/model-flow-service/src/main/yang/packet-processing.yang
new file mode 100644 (file)
index 0000000..260de5f
--- /dev/null
@@ -0,0 +1,46 @@
+module packet-processing {
+    namespace "urn:opendaylight:packet:service";
+    prefix flow;
+
+    import opendaylight-inventory {prefix inv;}
+    import ietf-inet-types {prefix inet;}
+    import ietf-yang-types {prefix yang;} 
+    import opendaylight-l2-types {prefix types;}
+    
+    revision "2013-07-09" {
+        description "";
+    }
+
+    grouping raw-packet {
+       leaf ingress {
+               type inv:node-connector-ref;
+       }
+       leaf payload {
+               type binary;
+       }
+    }
+
+    grouping ethernet-packet {
+       leaf source {
+               type yang:mac-address;
+       }
+
+       leaf destination {
+               type yang:mac-address;
+       }
+    }
+
+
+    notification packet-received {
+       uses raw-packet;
+    }
+
+    rpc transmit-packet {
+       input {
+               leaf egress {
+                       type inv:node-connector-ref;
+               }
+               uses raw-packet;
+       }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/sal/yang-prototype/sal/model/model-flow-statistics/src/main/yang/flow-statistics.yang b/opendaylight/sal/yang-prototype/sal/model/model-flow-statistics/src/main/yang/flow-statistics.yang
new file mode 100644 (file)
index 0000000..7e00a36
--- /dev/null
@@ -0,0 +1,70 @@
+module opendaylight-flow-statistics {
+    namespace "urn:opendaylight:flow:statistics";
+    prefix flowstat;
+
+    import yang-ext {prefix ext;}
+    import opendaylight-inventory {prefix inv;}
+    import opendaylight-flow-types {prefix flow-types;}
+    import sal-flow {prefix flow;}
+    import opendaylight-statistics-types {prefix stat-types;}
+
+    revision "2013-08-19" {
+        description "Initial revision of flow service";
+    }
+
+    rpc get-node-connector-statistics {
+        input {
+            leaf node {
+                ext:context-reference "node-context";
+                type inv:node-ref;
+            }
+            leaf node-connector {
+                type inv:node-connector-ref;
+            }
+        }
+        output {
+            uses stat-types:node-connector-statistics;
+        }
+    }
+
+    notification node-connector-statistics-updated {
+        uses stat-types:node-connector-statistics;
+    }
+
+    rpc get-flow-statistics {
+        input {
+            leaf node {
+                ext:context-reference "node-context";
+                type inv:node-ref;
+            }
+            uses flow-types:flow;
+        }
+        output {
+            uses flow-types:flow-statistics;
+        }
+    }
+
+    notification flow-statistics-updated {
+        uses flow-types:flow-statistics;
+    }
+
+    rpc get-flow-table-statistics {
+        input {
+            leaf node {
+                ext:context-reference "node-context";
+                type inv:node-ref;
+            }
+        }
+        output {
+            uses flow-types:flow-table-statistics;
+        }
+    }
+
+    notification flow-table-statistics-updated {
+        leaf flow-table {
+            type flow:flow-table-ref;
+        }
+        uses flow-types:flow-table-statistics;
+    }
+
+}
\ No newline at end of file
@@ -1,44 +1,18 @@
-module opendaylight-flow-statistics {
-    namespace "urn:opendaylight:flow:statistics";
-    prefix flowstat;
+module opendaylight-statistics-types {
+    namespace "urn:opendaylight:model:statistics:types";
+    prefix stat-types;
 
-    import yang-ext {prefix ext;}
-    import ietf-inet-types {prefix inet;}
-    import ietf-yang-types {prefix yang;}
-    import opendaylight-flow-base {prefix flow;}
     import opendaylight-inventory {prefix inv;}
 
+    
     revision "2013-08-19" {
         description "Initial revision of flow service";
     }
 
-    /*
-    augment "/flow:flows/flow:flow" {
-        ext:augment-identifier "flow-statistics";
+    
 
-        leaf packet-count {
-            type uint64;
-        } 
-
-        leaf byte-count {
-            type uint64;
-        }
-
-        container duration {
-            leaf second {
-                type uint64;
-            }
-            leaf nanosecond {
-                type uint64;
-            }
-        }
-    }
-    */
-
-    augment "/inv:nodes/inv:node/inv:node-connector" {
-        ext:augment-identifier "node-connector-statistics";
-
-        container packets {
+    grouping node-connector-statistics {
+       container packets {
             leaf received {
                 type uint64;
             }
@@ -78,7 +52,5 @@ module opendaylight-flow-statistics {
         leaf collision-count {
             type uint64;
         }
-
     }
-
 }
\ No newline at end of file
diff --git a/opendaylight/sal/yang-prototype/sal/model/model-inventory/src/main/yang/inventory.yang b/opendaylight/sal/yang-prototype/sal/model/model-inventory/src/main/yang/inventory.yang
new file mode 100644 (file)
index 0000000..a114c62
--- /dev/null
@@ -0,0 +1,69 @@
+module opendaylight-inventory {
+    namespace "urn:opendaylight:inventory";
+    prefix inv;
+
+    import yang-ext {prefix ext;}
+    import ietf-inet-types {prefix inet;}
+    import ietf-yang-types {prefix yang;}
+
+
+    revision "2013-08-19" {
+        description "Initial revision of Inventory model";
+    }
+
+    typedef node-id {
+        type inet:uri;
+    }
+
+    typedef node-connector-id {
+        type inet:uri;
+    }
+
+    typedef node-ref {
+        type instance-identifier;
+    }
+
+    typedef node-connector-ref {
+        type instance-identifier;
+    }
+
+    identity node-context {
+        description "Identity used to mark node context";
+    }
+
+    identity node-connector-context {
+
+    }
+
+       grouping node {
+               leaf id {
+            type node-id;
+        }
+       }
+
+       grouping node-connector {
+               leaf id {
+            type node-connector-id;
+               }
+       }
+
+
+
+
+    /** Base structure **/
+    container nodes {
+        list node {
+            key "id";
+            ext:context-instance "node-context";
+
+                       uses node;
+
+            list "node-connector" {
+                key "id";
+                ext:context-instance "node-connector-context";
+                
+                use node-connector;
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/sal/yang-prototype/sal/model/model-inventory/src/main/yang/opendaylight-inventory.yang b/opendaylight/sal/yang-prototype/sal/model/model-inventory/src/main/yang/opendaylight-inventory.yang
deleted file mode 100644 (file)
index fa9de4a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-module opendaylight-inventory {
-    namespace "urn:opendaylight:inventory";
-    prefix flow;
-
-    import yang-ext {prefix ext;}
-    import ietf-inet-types {prefix inet;}
-    import ietf-yang-types {prefix yang;}
-
-
-    revision "2013-08-19" {
-        description "Initial revision of Inventory model";
-    }
-
-    typedef node-id {
-        type inet:uri;
-    }
-
-    typedef node-connector-id {
-        type inet:uri;
-    }
-
-    /** Base structure **/
-    container nodes {
-        list node {
-            key id;
-            leaf id {
-                type node-id;
-            }
-            list node-connector {
-                key "id";
-                leaf id {
-                    type node-connector-id;
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
index fc6fb8e..0442e8f 100644 (file)
@@ -28,6 +28,7 @@
                <yang.version>0.5.7-SNAPSHOT</yang.version>
                <maven.bundle.version>2.4.0</maven.bundle.version>
         <releaseplugin.version>2.3.2</releaseplugin.version>
+        <guava.version>14.0.1</guava.version>
        </properties>
 
     <pluginRepositories>
           <id>central2</id>
           <name>central2</name>
           <url>http://repo2.maven.org/maven2</url>
+          <snapshots>
+              <enabled>false</enabled>
+          </snapshots>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
         </pluginRepository>
         <pluginRepository>
             <id>opendaylight.snapshot</id>
         <id>central2</id>
         <name>central2</name>
         <url>http://repo2.maven.org/maven2</url>
+        <snapshots>
+            <enabled>false</enabled>
+        </snapshots>
+        <releases>
+            <enabled>true</enabled>
+        </releases>
       </repository>
       <repository>
         <id>central</id>
         <name>central</name>
         <url>http://repo1.maven.org/maven2</url>
+        <snapshots>
+            <enabled>false</enabled>
+        </snapshots>
+        <releases>
+            <enabled>true</enabled>
+        </releases>
       </repository>
                <!-- EBR release -->
                <!-- http://repository.springsource.com/maven/bundles/release -->
                        <dependency>
                                <groupId>com.google.guava</groupId>
                                <artifactId>guava</artifactId>
-                               <version>14.0.1</version>
-                               <type>jar</type>
+                <version>${guava.version}</version>
                        </dependency>
                        <dependency>
                                <groupId>org.slf4j</groupId>
index b8ba605..549e427 100644 (file)
@@ -93,7 +93,6 @@
                <dependency>
                        <groupId>com.google.guava</groupId>
                        <artifactId>guava</artifactId>
-                       <type>jar</type>
                </dependency>
                <dependency>
                        <groupId>org.reflections</groupId>
index fa35363..0965e25 100644 (file)
@@ -36,7 +36,6 @@
         <dependency>\r
             <groupId>com.google.guava</groupId>\r
             <artifactId>guava</artifactId>\r
-            <type>jar</type>\r
         </dependency>\r
     </dependencies>\r
 </project>\r
index 3b0ae0c..5ec7202 100644 (file)
@@ -58,6 +58,7 @@
               javax.xml.bind,
               org.slf4j,
               org.apache.catalina.filters,
+              org.codehaus.jackson.jaxrs,
               !org.codehaus.enunciate.jaxrs
             </Import-Package>
             <Web-ContextPath>/one/nb/v2/lb</Web-ContextPath>
index 8ea0d78..5a4473b 100644 (file)
@@ -208,9 +208,9 @@ public class LoadBalancerNorthbound {
         @ResponseCode(code = 409, condition = "VIP already exist"),
         @ResponseCode(code = 415, condition = "Invalid input data")})
     public Response addVIP(@PathParam("containerName") String containerName,
-            @TypeHint(VIP.class) JAXBElement<VIP> inVIP){
+            @TypeHint(VIP.class) VIP inVIP){
 
-        VIP vipInput = inVIP.getValue();
+        VIP vipInput = inVIP;
         String name = vipInput.getName();
         String ip = vipInput.getIp();
         String protocol = vipInput.getProtocol();
@@ -253,9 +253,9 @@ public class LoadBalancerNorthbound {
         @ResponseCode(code = 405, condition = "Pool already attached to the VIP"),
         @ResponseCode(code = 415, condition = "Invalid input name")})
     public Response updateVIP(@PathParam("containerName") String containerName,
-            @TypeHint(VIP.class) JAXBElement<VIP> inVIP) {
+            @TypeHint(VIP.class) VIP inVIP) {
 
-        VIP vipInput = inVIP.getValue();
+        VIP vipInput = inVIP;
         String name = vipInput.getName();
         String poolName = vipInput.getPoolName();
         if(name.isEmpty() ||
@@ -325,9 +325,9 @@ public class LoadBalancerNorthbound {
         @ResponseCode(code = 409, condition = "Pool already exist"),
         @ResponseCode(code = 415, condition = "Invalid input data")})
     public Response addPool(@PathParam("containerName") String containerName,
-            @TypeHint(Pool.class) JAXBElement<Pool> inPool) {
+            @TypeHint(Pool.class) Pool inPool) {
 
-        Pool poolInput = inPool.getValue();
+        Pool poolInput = inPool;
         String name = poolInput.getName();
         String lbMethod =poolInput.getLbMethod();
         if(name.isEmpty() ||
@@ -398,9 +398,9 @@ public class LoadBalancerNorthbound {
         @ResponseCode(code = 409, condition = "Pool member already exist"),
         @ResponseCode(code = 415, condition = "Invalid input data")})
     public Response addPoolMember(@PathParam("containerName") String containerName,
-            @TypeHint(PoolMember.class) JAXBElement<PoolMember> inPoolMember){
+            @TypeHint(PoolMember.class) PoolMember inPoolMember){
 
-        PoolMember pmInput = inPoolMember.getValue();
+        PoolMember pmInput = inPoolMember;
         String name = pmInput.getName();
         String memberIP = pmInput.getIp();
         String poolName = pmInput.getPoolName();
index 0c17c84..2f5aaca 100644 (file)
@@ -12,6 +12,8 @@ import java.util.HashSet;
 import java.util.Set;
 import javax.ws.rs.core.Application;
 
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+
 /**
  * This class is an instance of javax.ws.rs.core.Application and is used to return the classes
  * that will be instantiated for JAXRS processing. This is necessary
@@ -23,6 +25,7 @@ public class LoadBalancerNorthboundRSApplication extends Application {
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(LoadBalancerNorthbound.class);
+        classes.add(JacksonJaxbJsonProvider.class);
         return classes;
     }
 }
index dd89954..d82c996 100644 (file)
@@ -1104,7 +1104,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
     @Override
     public Set<Node> getNodes() {
         return (nodeProps != null) ? new HashSet<Node>(nodeProps.keySet())
-                : null;
+                : new HashSet<Node>();
     }
 
     /*
index 9524a76..3fd292b 100644 (file)
@@ -464,8 +464,10 @@ one.f.switchmanager.subnetGatewayConfig = {
         }, 
         modal: {
             modal: "one_f_switchmanager_subnetGatewayConfig_id_modal_modal",
-                       ports : "one_f_switchmanager_subnetGatewayConfig_id_modal_ports",
+            ports : "one_f_switchmanager_subnetGatewayConfig_id_modal_ports",
             save: "one_f_switchmanager_subnetGatewayConfig_id_modal_save",
+            remove: "one_f_switchmanager_subnetGatewayConfig_id_modal_remove",
+            cancel: "one_f_switchmanager_subnetGatewayConfig_id_modal_cancel",
             form: {
                 name : "one_f_switchmanager_subnetGatewayConfig_id_modal_form_gatewayname",
                 gatewayIPAddress : "one_f_switchmanager_subnetGatewayConfig_id_modal_form_gatewayipaddress",
@@ -493,33 +495,19 @@ one.f.switchmanager.subnetGatewayConfig = {
                 $dashlet.append($button);
 
                 // Delete gateway ip address button
-                var button = one.lib.dashlet.button.single("Delete Gateway IP Address",
-                    one.f.switchmanager.subnetGatewayConfig.id.dashlet.removeIPAddress, "btn-danger", "btn-mini");
+                var button = one.lib.dashlet.button.single("Remove Gateway IP Address",
+                one.f.switchmanager.subnetGatewayConfig.id.dashlet.removeIPAddress, "btn-danger", "btn-mini");
                 var $button = one.lib.dashlet.button.button(button);
                 $button.click(function() {
-                    var requestData = {};
                     var gatewaysToDelete = [];
                     var checkedCheckBoxes = $("#" + one.f.switchmanager.subnetGatewayConfig.id.dashlet.datagrid).find("tbody input:checked")
                     checkedCheckBoxes.each(function(index, value) {
                         gatewaysToDelete.push(checkedCheckBoxes[index].id);
                     });
                     if (checkedCheckBoxes.size() === 0) {
-                       alert('Please select at least one gateway');
-                       return false;
-                    }
-                    if (gatewaysToDelete.length > 0) {
-                        requestData["gatewaysToDelete"] = gatewaysToDelete.toString();
-                        var url = one.f.switchmanager.rootUrl + "/subnetGateway/delete";
-                        one.f.switchmanager.subnetGatewayConfig.ajax.main(url, requestData, function(response) {
-                            if (response.status == true) {
-                                // refresh dashlet by passing dashlet div as param 
-                                one.lib.alert("Subnet Gateway(s) successfully removed");
-                            } else {
-                                one.lib.alert(response.message);
-                            }
-                            one.f.switchmanager.subnetGatewayConfig.dashlet($("#right-bottom .dashlet"));
-                        });
+                        return false;
                     }
+                    one.f.switchmanager.subnetGatewayConfig.modal.removeMultiple.dialog(gatewaysToDelete)
                 });
                 $dashlet.append($button);
 
@@ -725,6 +713,64 @@ one.f.switchmanager.subnetGatewayConfig = {
             var $saveButton = one.lib.dashlet.button.button(saveButton);
             footer.push($saveButton);
             return footer;
+        },
+        removeMultiple: {
+            dialog: function(gatewaysToDelete) {
+                var h3 = 'Remove Gateway IP Address';
+                
+                var footer = one.f.switchmanager.subnetGatewayConfig.modal.removeMultiple.footer();
+                var $body = one.f.switchmanager.subnetGatewayConfig.modal.removeMultiple.body(gatewaysToDelete);
+                var $modal = one.lib.modal.spawn(one.f.switchmanager.subnetGatewayConfig.id.modal.modal, h3, $body, footer);
+
+                // bind close button
+                $('#'+one.f.switchmanager.subnetGatewayConfig.id.modal.cancel, $modal).click(function() {
+                    $modal.modal('hide');
+                });
+
+                // bind remove rule button
+                $('#'+one.f.switchmanager.subnetGatewayConfig.id.modal.remove, $modal).click(this, function(e) {
+                    var requestData = {};
+                    if (gatewaysToDelete.length > 0) {
+                        requestData["gatewaysToDelete"] = gatewaysToDelete.toString();
+                        var url = one.f.switchmanager.rootUrl + "/subnetGateway/delete";
+                        one.f.switchmanager.subnetGatewayConfig.ajax.main(url, requestData, function(response) {
+                            $modal.modal('hide');
+                            if (response.status == true) {
+                                // refresh dashlet by passing dashlet div as param 
+                                one.lib.alert("Gateway IP Address(es) successfully removed");
+                            } else {
+                                alert(response.message);
+                            }
+                            one.f.switchmanager.subnetGatewayConfig.dashlet($("#right-bottom .dashlet"));
+                        });
+                    }
+                });
+                $modal.modal();
+            },
+            footer : function() {
+                var footer = [];
+                var remove = one.lib.dashlet.button.single('Remove Gateway IP Address',one.f.switchmanager.subnetGatewayConfig.id.modal.remove, 'btn-danger', '');
+                var $remove = one.lib.dashlet.button.button(remove);
+                footer.push($remove);
+
+                var cancel = one.lib.dashlet.button.single('Cancel', one.f.switchmanager.subnetGatewayConfig.id.modal.cancel, '', '');
+                var $cancel = one.lib.dashlet.button.button(cancel);
+                footer.push($cancel);
+
+                return footer;
+            },
+            body : function (gatewayList) {
+                var $p = $(document.createElement('p'));
+                var p = 'Remove the following Gateway IP Address(es)?';
+                //creata a BS label for each rule and append to list
+                $(gatewayList).each(function(){
+                    var $span = $(document.createElement('span'));
+                    $span.append(this);
+                    p += '<br/>' + $span[0].outerHTML;
+                });
+                $p.append(p);
+                return $p;
+            }
         }
     },
     // data functions
@@ -769,7 +815,7 @@ one.f.switchmanager.subnetGatewayConfig = {
                                 nodePortHtml += "&nbsp;";
                                 nodePortHtml += '<a href="#" id=' + encodeURIComponent(nodePortID) + 
                                     ' gatewayName=' + tableRow["name"] + 
-                                    ' onclick="javascript:one.f.switchmanager.subnetGatewayConfig.actions.deleteNodePort(this);">Delete</a>';
+                                    ' onclick="javascript:one.f.switchmanager.subnetGatewayConfig.actions.deleteNodePort(this);">Remove</a>';
                                 nodePortHtml += "<br/>";
                             });
                             nodePortHtml += "</div>";
@@ -823,7 +869,7 @@ one.f.switchmanager.subnetGatewayConfig = {
                     aTag.addEventListener("mouseover", function(evt) {
                         evt.target.style.cursor = "pointer";
                     }, false);
-                    aTag.innerHTML = "Delete";
+                    aTag.innerHTML = "Remove";
                     $nodePortsContainer.append(aTag);
                     $nodePortsContainer.append("<br/>");
                 }
@@ -874,6 +920,8 @@ one.f.switchmanager.staticRouteConfig = {
         modal: {
             modal: "one_f_switchmanager_staticRouteConfig_id_modal_modal",
             save: "one_f_switchmanager_staticRouteConfig_id_modal_save",
+            cancel: "one_f_switchmanager_staticRouteConfig_id_modal_cancel",
+            remove: "one_f_switchmanager_staticRouteConfig_id_modal_remove",
             form: {
                 routeName : "one_f_switchmanager_staticRouteConfig_id_modal_form_routename",
                 staticRoute : "one_f_switchmanager_staticRouteConfig_id_modal_form_staticroute",
@@ -898,33 +946,18 @@ one.f.switchmanager.staticRouteConfig = {
                 $dashlet.append($button);
 
                 // Delete static route button
-                var button = one.lib.dashlet.button.single("Delete Static Route(s)", one.f.switchmanager.staticRouteConfig.id.dashlet.remove, "btn-danger", "btn-mini");
+                var button = one.lib.dashlet.button.single("Remove Static Route", one.f.switchmanager.staticRouteConfig.id.dashlet.remove, "btn-danger", "btn-mini");
                 var $button = one.lib.dashlet.button.button(button);
                 $button.click(function() {
-                    var requestData = {};
                     var routesToDelete = [];
-                    //var checkedCheckBoxes = $("input:checked", $(this).closest(".dashlet").find("table"));
                     var checkedCheckBoxes = $("#" + one.f.switchmanager.staticRouteConfig.id.dashlet.datagrid).find("tbody input:checked");
                     checkedCheckBoxes.each(function(index, value) {
                         routesToDelete.push(checkedCheckBoxes[index].id);
                     });
                     if (checkedCheckBoxes.size() === 0) {
-                       alert('Please select at least one static route');
-                       return false;
-                    }
-                    if (routesToDelete.length > 0) {
-                        requestData["routesToDelete"] = routesToDelete.toString();
-                        var url = one.f.switchmanager.rootUrl + "/staticRoute/delete";
-                        one.f.switchmanager.staticRouteConfig.ajax.main(url, requestData, function(response) {
-                            if (response.status == true) {
-                                // refresh dashlet by passing dashlet div as param 
-                                one.lib.alert("Static Routes(s) successfully removed");
-                            } else {
-                                one.lib.alert(response.message);
-                            }
-                            one.f.switchmanager.staticRouteConfig.dashlet($("#left-bottom .dashlet"));
-                        });
+                        return false;
                     }
+                    one.f.switchmanager.staticRouteConfig.modal.removeMultiple.dialog(routesToDelete);
                 });
                 $dashlet.append($button);
             }
@@ -1033,6 +1066,64 @@ one.f.switchmanager.staticRouteConfig = {
             var $saveButton = one.lib.dashlet.button.button(saveButton);
             footer.push($saveButton);
             return footer;
+        },
+        removeMultiple: {
+            dialog: function(routesToDelete) {
+                var h3 = 'Remove Static Route';
+                
+                var footer = one.f.switchmanager.staticRouteConfig.modal.removeMultiple.footer();
+                var $body = one.f.switchmanager.staticRouteConfig.modal.removeMultiple.body(routesToDelete);
+                var $modal = one.lib.modal.spawn(one.f.switchmanager.staticRouteConfig.id.modal.modal, h3, $body, footer);
+
+                // bind close button
+                $('#'+one.f.switchmanager.staticRouteConfig.id.modal.cancel, $modal).click(function() {
+                    $modal.modal('hide');
+                });
+
+                // bind remove rule button
+                $('#'+one.f.switchmanager.staticRouteConfig.id.modal.remove, $modal).click(this, function(e) {
+                    if (routesToDelete.length > 0) {
+                        var requestData = {};
+                        requestData["routesToDelete"] = routesToDelete.toString();
+                        var url = one.f.switchmanager.rootUrl + "/staticRoute/delete";
+                        one.f.switchmanager.staticRouteConfig.ajax.main(url, requestData, function(response) {
+                            $modal.modal('hide');
+                            if (response.status == true) {
+                                // refresh dashlet by passing dashlet div as param 
+                                one.lib.alert("Static Route(s) successfully removed");
+                            } else {
+                                alert(response.message);
+                            }
+                            one.f.switchmanager.staticRouteConfig.dashlet($("#left-bottom .dashlet"));
+                        });
+                    }
+                });
+                $modal.modal();
+            },
+            footer : function() {
+                var footer = [];
+                var remove = one.lib.dashlet.button.single('Remove Static Route',one.f.switchmanager.staticRouteConfig.id.modal.remove, 'btn-danger', '');
+                var $remove = one.lib.dashlet.button.button(remove);
+                footer.push($remove);
+
+                var cancel = one.lib.dashlet.button.single('Cancel', one.f.switchmanager.staticRouteConfig.id.modal.cancel, '', '');
+                var $cancel = one.lib.dashlet.button.button(cancel);
+                footer.push($cancel);
+
+                return footer;
+            },
+            body : function (staticRouteList) {
+                var $p = $(document.createElement('p'));
+                var p = 'Remove the following Static Route(s)?';
+                //creata a BS label for each rule and append to list
+                $(staticRouteList).each(function(){
+                    var $span = $(document.createElement('span'));
+                    $span.append(this);
+                    p += '<br/>' + $span[0].outerHTML;
+                });
+                $p.append(p);
+                return $p;
+            }
         }
     },
     // data functions
@@ -1105,6 +1196,8 @@ one.f.switchmanager.spanPortConfig = {
         modal: {
             modal: "one_f_switchmanager_spanPortConfig_id_modal_modal",
             save: "one_f_switchmanager_spanPortConfig_id_modal_save",
+            cancel: "one_f_switchmanager_spanPortConfig_id_modal_cancel",
+            remove: "one_f_switchmanager_spanPortConfig_id_modal_remove",
             form: {
                 name : "one_f_switchmanager_spanPortConfig_id_modal_form_name",
                 nodes : "one_f_switchmanager_spanPortConfig_id_modal_form_nodes",
@@ -1133,34 +1226,19 @@ one.f.switchmanager.spanPortConfig = {
                 $dashlet.append($button);
 
                 // Delete span port button
-                var button = one.lib.dashlet.button.single("Delete SPAN Port(s)", one.f.switchmanager.spanPortConfig.id.dashlet.remove, "btn-danger", "btn-mini");
+                var button = one.lib.dashlet.button.single("Remove SPAN Port", one.f.switchmanager.spanPortConfig.id.dashlet.remove, "btn-danger", "btn-mini");
                 var $button = one.lib.dashlet.button.button(button);
                 $button.click(function() {
-
+                    var spanPortsToDelete = [];
                     var checkedCheckBoxes = $("#" + one.f.switchmanager.spanPortConfig.id.dashlet.datagrid).find("tbody input:checked");
-                    if (checkedCheckBoxes.length > 0) {
-                        var spanPortsToDelete = "";
-                        checkedCheckBoxes.each(function(index, value) {
-                            spanPortsToDelete += decodeURIComponent(checkedCheckBoxes[index].getAttribute("spanPort")) + "###";
-                        });
-                        if (checkedCheckBoxes.size() === 0) {
-                               alert('Please select at least one SPAN port');
-                               return false;
-                        }
-
-                        var requestData = {};
-                        requestData["spanPortsToDelete"] = spanPortsToDelete;
-                        var url = one.f.switchmanager.rootUrl + "/spanPorts/delete";
-                        one.f.switchmanager.spanPortConfig.ajax.main(url, requestData, function(response) {
-                            if (response.status == true) {
-                                // refresh dashlet by passing dashlet div as param
-                                one.lib.alert("Span Port(s) successfully removed");
-                            } else {
-                                one.lib.alert(response.message);
-                            }
-                            one.f.switchmanager.spanPortConfig.dashlet($("#right-bottom .dashlet"));
-                        });
+                    
+                    if (checkedCheckBoxes.size() === 0) {
+                        return false;
                     }
+                    checkedCheckBoxes.each(function(index, value) {
+                        spanPortsToDelete.push(decodeURIComponent(checkedCheckBoxes[index].getAttribute("spanPort")));
+                    });
+                    one.f.switchmanager.spanPortConfig.modal.removeMultiple.dialog(spanPortsToDelete);
                 });
                 $dashlet.append($button);
             }
@@ -1290,6 +1368,69 @@ one.f.switchmanager.spanPortConfig = {
             var $saveButton = one.lib.dashlet.button.button(saveButton);
             footer.push($saveButton);
             return footer;
+        },
+        removeMultiple: {
+            dialog: function(spanPortsToDelete) {
+                var h3 = 'Remove Span Port';
+                
+                var footer = one.f.switchmanager.spanPortConfig.modal.removeMultiple.footer();
+                var $body = one.f.switchmanager.spanPortConfig.modal.removeMultiple.body(spanPortsToDelete);
+                var $modal = one.lib.modal.spawn(one.f.switchmanager.spanPortConfig.id.modal.modal, h3, $body, footer);
+
+                // bind close button
+                $('#'+one.f.switchmanager.spanPortConfig.id.modal.cancel, $modal).click(function() {
+                    $modal.modal('hide');
+                });
+
+                // bind remove rule button
+                $('#'+one.f.switchmanager.spanPortConfig.id.modal.remove, $modal).click(this, function(e) {
+                    var requestData = {};
+                    var spanPorts="";
+                    $(spanPortsToDelete).each(function(){
+                        spanPorts = spanPorts + "###" + this.toString();
+                    });
+                    requestData["spanPortsToDelete"] = spanPorts.slice(3,spanPorts.length);
+                    
+                    var url = one.f.switchmanager.rootUrl + "/spanPorts/delete";
+                    one.f.switchmanager.spanPortConfig.ajax.main(url, requestData, function(response) {
+                        $modal.modal('hide');
+                        if (response.status == true) {
+                            // refresh dashlet by passing dashlet div as param
+                            one.lib.alert("Span Port(s) successfully removed");
+                        } else {
+                            alert(response.message);
+                        }
+                        one.f.switchmanager.spanPortConfig.dashlet($("#right-bottom .dashlet"));
+                    });
+                });
+                $modal.modal();
+            },
+            footer : function() {
+                var footer = [];
+                var remove = one.lib.dashlet.button.single('Remove SPAN Port',one.f.switchmanager.spanPortConfig.id.modal.remove, 'btn-danger', '');
+                var $remove = one.lib.dashlet.button.button(remove);
+                footer.push($remove);
+
+                var cancel = one.lib.dashlet.button.single('Cancel', one.f.switchmanager.spanPortConfig.id.modal.cancel, '', '');
+                var $cancel = one.lib.dashlet.button.button(cancel);
+                footer.push($cancel);
+
+                return footer;
+            },
+            body : function (spanPortToDelete) {
+                var $p = $(document.createElement('p'));
+                var p = 'Remove the following Span Port(s)?';
+                //creata a BS label for each rule and append to list
+
+                var spanPortList = JSON.parse("["+spanPortToDelete.toString()+"]");
+                $(spanPortList).each(function(){
+                    var $span = $(document.createElement('span'));
+                    $span.append(this.nodeId+"-"+this.spanPort);
+                    p += '<br/>' + $span[0].outerHTML;
+                });
+                $p.append(p);
+                return $p;
+            }
         }
     },
     // data functions
index b8eb29a..8bc2a99 100644 (file)
@@ -336,32 +336,18 @@ one.f.flows = {
                 $button.click(function() {
                     var checkedCheckBoxes = $('.flowEntry[type=checkbox]:checked');
                     if (checkedCheckBoxes.size() === 0) {
-                       alert('Please select at least one flow');
-                       return false;
+                        return false;
                     }
                     
                     var requestData = [];
                     
-                    var resource = {};
                     checkedCheckBoxes.each(function(index, value) {
                         var flowEntry = {};
                         flowEntry['name'] = checkedCheckBoxes[index].name;
                         flowEntry['node'] = checkedCheckBoxes[index].getAttribute("node");
                         requestData.push(flowEntry);  
                     });
-                    resource['body'] = JSON.stringify(requestData);
-
-                    $.post(one.f.address.root+one.f.address.flows.deleteFlows, resource, function(response) {
-                        if(response == "Success") {
-                            one.lib.alert("Flow(s) successfully removed");                            
-                        } else {
-                            one.lib.alert(response);
-                        }
-                        one.main.dashlet.right.bottom.empty();
-                        one.f.detail.dashlet(one.main.dashlet.right.bottom);
-                        one.main.dashlet.left.top.empty();
-                        one.f.flows.dashlet(one.main.dashlet.left.top);
-                    });                    
+                    one.f.flows.modal.removeMultiple.dialog(requestData);
                 });
                 $dashlet.append($button);
 
@@ -491,7 +477,7 @@ one.f.flows = {
     modal : {
         dialog : {
             initialize : function(id, node) {
-                var h3 = "Remove Flow?";
+                var h3 = "Remove Flow";
                 var $p = one.f.flows.modal.dialog.body(id);
                 var footer = one.f.flows.modal.dialog.footer();
                 var $modal = one.lib.modal.spawn(one.f.flows.id.modal.dialog.modal, h3, $p, footer);
@@ -622,7 +608,7 @@ one.f.flows = {
             one.f.flows.modal.ajax.saveflow(resource, function(data) {
                 if (data == "Success") {
                     $modal.modal('hide');
-                    one.lib.alert('Flow added');
+                    one.lib.alert('Flow Entry added');
                     one.main.dashlet.left.top.empty();
                     one.f.flows.dashlet(one.main.dashlet.left.top);
                 } else {
@@ -1232,6 +1218,67 @@ one.f.flows = {
             footer.push($closeButton);
 
             return footer;
+        },
+        removeMultiple: {
+            dialog: function(flows) {
+                var h3 = 'Remove Flow Entry';
+                var flowList = [];
+                for (var i = 0; i < flows.length; i++) {
+                    flowList.push(flows[i]["name"]);
+                }
+                var footer = one.f.flows.modal.removeMultiple.footer();
+                var $body = one.f.flows.modal.removeMultiple.body(flowList);
+                var $modal = one.lib.modal.spawn(one.f.flows.id.modal.dialog.modal, h3, $body, footer);
+
+                // bind close button
+                $('#'+one.f.flows.id.modal.dialog.close, $modal).click(function() {
+                    $modal.modal('hide');
+                });
+
+                // bind remove rule button
+                $('#'+one.f.flows.id.modal.dialog.remove, $modal).click(this, function(e) {
+                    var resource = {};
+                    resource['body'] = JSON.stringify(flows);
+
+                    $.post(one.f.address.root+one.f.address.flows.deleteFlows, resource, function(response) {
+                        $modal.modal('hide');
+                        if(response == "Success") {
+                            one.lib.alert("Flow Entry(s) successfully removed");
+                        } else {
+                            one.lib.alert(response);
+                        }
+                        one.main.dashlet.right.bottom.empty();
+                        one.f.detail.dashlet(one.main.dashlet.right.bottom);
+                        one.main.dashlet.left.top.empty();
+                        one.f.flows.dashlet(one.main.dashlet.left.top);
+                    });
+                });
+                $modal.modal();
+            },
+            footer : function() {
+                var footer = [];
+                var remove = one.lib.dashlet.button.single('Remove Flow Entry',one.f.flows.id.modal.dialog.remove, 'btn-danger', '');
+                var $remove = one.lib.dashlet.button.button(remove);
+                footer.push($remove);
+
+                var cancel = one.lib.dashlet.button.single('Cancel', one.f.flows.id.modal.dialog.close, '', '');
+                var $cancel = one.lib.dashlet.button.button(cancel);
+                footer.push($cancel);
+
+                return footer;
+            },
+            body : function (flows) {
+                var $p = $(document.createElement('p'));
+                var p = 'Remove the following Flow Entry(s)?';
+                //creata a BS label for each rule and append to list
+                $(flows).each(function(){
+                    var $span = $(document.createElement('span'));
+                    $span.append(this);
+                    p += '<br/>' + $span[0].outerHTML;
+                });
+                $p.append(p);
+                return $p;
+            }
         }
     },
     ajax : {
@@ -1373,4 +1420,4 @@ $('.dash .nav a', '#main').click(function() {
 // activate first tab on each dashlet
 $('.dash .nav').each(function(index, value) {
     $($(value).find('li')[0]).find('a').click();
-});
+});
\ No newline at end of file
index d9aa03e..3b0b85c 100644 (file)
@@ -56,7 +56,7 @@ public class DaylightWebAdmin {
             return null;
         }
 
-        List<ClusterNodeBean> clusters = new ArrayList<ClusterNodeBean>();
+        List<ClusterNodeBean> clusterNodes = new ArrayList<ClusterNodeBean>();
 
         List<InetAddress> controllers = clusterServices.getClusteredControllers();
         for (InetAddress controller : controllers) {
@@ -64,25 +64,24 @@ public class DaylightWebAdmin {
             if (controller.equals(clusterServices.getMyAddress())) {
                 clusterBeanBuilder.highlightMe();
             }
-            if (clusterServices.amICoordinator()) {
+            if (clusterServices.getCoordinatorAddress().equals(controller)) {
                 clusterBeanBuilder.iAmCoordinator();
             }
-
-            clusters.add(clusterBeanBuilder.build());
+            clusterNodes.add(clusterBeanBuilder.build());
         }
 
-        return gson.toJson(clusters);
+        return gson.toJson(clusterNodes);
     }
 
     /**
      * Return nodes connected to controller {controller}
-     * @param cluster
+     * @param controller
      *            - byte[] of the address of the controller
      * @return List<NodeBean>
      */
     @RequestMapping("/cluster/controller/{controller}")
     @ResponseBody
-    public String getNodesConnectedToController(@PathVariable("controller") String cluster) {
+    public String getNodesConnectedToController(@PathVariable("controller") String controller) {
         IClusterGlobalServices clusterServices = (IClusterGlobalServices) ServiceHelper.getGlobalInstance(
                 IClusterGlobalServices.class, this);
         if (clusterServices == null) {
@@ -99,18 +98,20 @@ public class DaylightWebAdmin {
             return null;
         }
 
-        byte[] address = gson.fromJson(cluster, byte[].class);
-        InetAddress clusterAddress = null;
+        byte[] address = gson.fromJson(controller, byte[].class);
+        InetAddress controllerAddress = null;
         try {
-            clusterAddress = InetAddress.getByAddress(address);
+            controllerAddress = InetAddress.getByAddress(address);
         } catch (UnknownHostException e) {
             return null;
         }
-        InetAddress thisCluster = clusterServices.getMyAddress();
 
         List<NodeBean> result = new ArrayList<NodeBean>();
 
-        Set<Node> nodes = connectionManager.getNodes(thisCluster);
+        Set<Node> nodes = connectionManager.getNodes(controllerAddress);
+        if (nodes == null) {
+            return gson.toJson(result);
+        }
         for (Node node : nodes) {
             Description description = (Description) switchManager.getNodeProp(node, Description.propertyName);
             NodeBean nodeBean;
index 599922d..85e4d47 100644 (file)
@@ -515,9 +515,6 @@ one.main.cluster = {
                close : 'one-main-cluster-id-close',
                datagrid : 'one-main-cluster-id-datagrid'
        },
-       registry : { // one.main.cluster.registry
-               cluster : undefined
-       },
        initialize : function() {
                var h3 = 'Cluster Management';
                var footer = one.main.cluster.footer();
@@ -544,7 +541,7 @@ one.main.cluster = {
                                        if ($tr.find('td:nth-child(1)').attr('colspan') === '1') {
                                                return false;
                                        }
-                                       var address = one.main.cluster.registry.cluster[$tr.index()];
+                                       var address = $tr.find('.ux-id').text();
                                        one.main.cluster.nodes.initialize(address);
                                });
                        });
@@ -558,7 +555,14 @@ one.main.cluster = {
                var registry = [];
                $(data).each(function(idx, val) {
                        var name = val.name;
+                       var address = val.address;
+                       var $registry = $(document.createElement('span'));
+                       $registry
+                               .append(JSON.stringify(address))
+                               .css('display', 'none')
+                               .addClass('ux-id');
                        name = one.lib.dashlet.label(name, null)[0].outerHTML;
+                       name += $registry[0].outerHTML;
                        if (val.me === true) {
                                var me = one.lib.dashlet.label('*', 'label-inverse')[0].outerHTML;
                                name += '&nbsp;'+me;
@@ -570,9 +574,7 @@ one.main.cluster = {
                        tdata.push({
                                'controller' : name
                        });
-                       registry.push(val.address);
                });
-               one.main.cluster.registry.cluster = registry;
                var source = new StaticDataSource({
                        columns : [
                                {
@@ -613,7 +615,7 @@ one.main.cluster.nodes = {
                });
                
                // body
-               $.getJSON('/admin/cluster/controller/'+JSON.stringify(address), function(data) {
+               $.getJSON('/admin/cluster/controller/'+address, function(data) {
                        var $gridHTML = one.lib.dashlet.datagrid.init(one.main.cluster.nodes.id.datagrid, {
                                searchable: true,
                                filterable: false,

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.