Merge "Add curly braces to if/else statements. (sonar)"
authorAlessandro Boch <aboch@cisco.com>
Wed, 11 Sep 2013 01:30:59 +0000 (01:30 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 11 Sep 2013 01:30:59 +0000 (01:30 +0000)
66 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/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionManager.java
opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/scheme/AbstractScheme.java
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 d9b4720503a49f55119279040557bf4b744e8b21..b84346514f17c85a3b4d24c2f1f1878747bcd623 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 98e5695e3fbfaf917ddc3cb672f1b8c84a201012..32c3d08c91751a6e4eacffc0f4bc890995189f15 100644 (file)
@@ -18,8 +18,6 @@
  */
 package org.opendaylight.controller.clustering.services;
 
-import java.lang.Exception;
-
 /**
  * Describe an exception that is raised when the cache being
  * allocated has configuration errors, like mismatch parameters are
index f171e9ce00ef58f69119bf99612cf856b1bd40fd..34ba41c5d439c3b1c1c19ad81667cbaf07f7d00a 100644 (file)
@@ -16,8 +16,6 @@
  */
 package org.opendaylight.controller.clustering.services;
 
-import java.lang.Exception;
-
 /**
  * Describe an exception that is raised when the cache
  * Listener being added fails for any reason
index 4ad7c9403285bba8171fa4e03cc9cd214e7f8c8b..aecb269ba661affc305a9322115350b7e08f275d 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 da00e9c6465e319d3c294036df4aacc47a08713f..7097958126aaec02cf680265bad8322b6526ae5e 100644 (file)
@@ -368,7 +368,7 @@ public class ConnectionManager implements IConnectionManager, IConnectionListene
                 ci.println(this.getNodes(address).toString());
             }
         } catch (UnknownHostException e) {
-            e.printStackTrace();
+           logger.error("An error occured",e);
         }
     }
 
index d7c4e5f933bdba54e0a0cd5411627546c0133b72..f4c7bd2ff77fcda8874ca39db7d7c404ccf04aa7 100644 (file)
@@ -313,7 +313,7 @@ public abstract class AbstractScheme {
         } catch (CacheConfigException cce) {
             log.error("\nCache configuration invalid - check cache mode");
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("An error occured",e);
         }
     }
 }
index 5501be46b2e59afb2743d70aad90c549ad5a4ae7..ba1a54b662f3f4c68d328bc5390c57239c2d451e 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 0304af493d9fe64abab2df516bc5b3c2e63c098c..ba69c8a3d29f8286f2d4f3157f6547a8f54c717b 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 176d8e9ebdfea8a2f0bb341eed68177d69a235ed..a3e1ded14178ff8d00a3efe21d02ea798fa19af2 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 6319c7c8deeb30c1973820adbd46973672845d36..7aef0652fe2411637fb69c777a35ba37c835fa23 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 2d270b44f98e23d65c0f03bddab1f913aabda7d5..257fbbda670486582949bdb3eab5dd4297ba7d88 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 3c6a5f8639e3a5b5bae34d366228895e7e194ed0..68c0ec1e5b117245868206dfac4be1cdfc1eec88 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 74e33863b55eb32691e11e1c0c801a0a2f4afc91..3757ea1f36c770304e3d3f6806f5a1a8a713dc6e 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 91185bb40573eea09b8e26c5aeb596e32eb23ab4..f0bdf5d891153fff7271c5853526ae7fd3211a25 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 89bee5ba1adeeb51a4b9c12d1897db05cd574c17..5d50dbf0b208eee10e3b623bc34f61a421cb88fa 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 eeaa18bbe895822696ea009fed7333e008d4d27d..90b36de7efd1db543328910478888f25279405cd 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 f7ebfe438fb82f577581664301fa90b3a7f079ff..27a50c015dfce73040afd8453f54bb02b26139d9 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 5993f1678714e913197e84a79540a49c60927558..b7da9641fafa0af6e40970a95aaffe940d902294 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 1d1fd15a4a53e47f418fff17f11f35d3656fe107..0d98d2282d92a2b491c76f04260eb89ed5062ce3 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 d308fba3d9ba14f45426fe188ab00ca9a31a2e3c..62f5b42699dd20e829d2e722ab633f6d326f4dfa 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 8462ef804ad0cce4c81819bd6b0369a675673566..65e68aab7d9be627154aebf61856b1b07fe5d68d 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 a39794df74d92a46dd1ab93afcf00931b6e5c838..a98a124524717fbbf3f33c6a368df620571b5ca0 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 6a5a08e4a9645260816498669e058c60fb1da870..eb2bf587de4006c6f61118b76698673e2bbdb582 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 d38740751d7841afbc5dc634c1b45b4e96c375b9..2b6dccc8b9d944b056799bed577e493cba83d808 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 72b0a04c906a0b049915ca4c8da19f5afe054851..9feb95fce08d2fead13ecec697ad03b406c7a746 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 3361f1b3d29cfdf38527d0589774b9129cb278a3..224bb1483155acf1a670099e2503bc85e7fdefcc 100644 (file)
@@ -17,7 +17,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.opendaylight.controller.switchmanager.SubnetConfig;
 
-@XmlRootElement
+@XmlRootElement (name = "list")
 @XmlAccessorType(XmlAccessType.NONE)
 
 public class SubnetConfigs {
index a5e805d396934ec719eb18086e069a25d7326788..50024fd7392706bcf2f935685dfa97ec68a11100 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 a5eaf94f26ff3d935782fe64a083fc38922ba222..e03cac656268228dde2c2f52ba82027e60df32b2 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 719688305ebac17f1655281f30cd62672f47d3df..965075a271aa2f5357fdab6933872f1e68dfa654 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 d33c3c99fc635803fa5b9624aec2ef3d8c992597..1cdfd31e3ff6c6f5da224ed76340e007e7807cf4 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 ec43a5ee635d55341756e2a0cf72cd832410392f..b2b7b9c85f53ac4332757227e1de0a24880b169f 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 c20cb26885006f0f5a3234466bfb4445ed641033..508ffafe6fdf8f1a1a5fff4466ee54e0f0862da9 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 299bfcd2246b1514982d88f4868a372d1bb09484..992cf6ac524bc02d770a387b866065f1454e2552 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 db24755a2985e396f2128a5420ad819c425a7397..dee2e243d429abdd6d0d3ffb62cb14e5228a356d 100644 (file)
@@ -18,7 +18,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.opendaylight.controller.topologymanager.TopologyUserLinkConfig;
 
-@XmlRootElement
+@XmlRootElement (name = "list")
 @XmlAccessorType(XmlAccessType.NONE)
 
 public class TopologyUserLinks {
index 1938cb1ae68e66efe8bb68b12f42e3fcf1373703..0895d9af27c85132965a98ea23cd166784a3e538 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 8fc8fc16bf59b9f7248b093070783657f834c066..515a61eab75c53e03582c0434e8b724b88428432 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 30033a244c5bc8a64a38559c2a9d02c24d749b12..446debdc27e818485ce5e399704d904a55b3af05 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 a2d3d36c6f044a286e37e8eaf7674f72c5f7950e..c0c8da7ae2fa569c20975f91f1ac7f81bd409052 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 1d31eaa65b44e605d42b09711b6ef4f93bc4f5ff..a9c9e3ec91bf0b3972ac0a4174dfeb98c4134976 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 b4624323ae88a38539614dab6d16733fa3b78a83..2717c942287ff42932159d95c2b0957a9c4dfb67 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 4c5db1086c098cf936a1daaf0b70902368f159eb..b1107594f50fb3d60390f71b081e2b495dc89f8c 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 6eaaebada598c3fada00c18528adffc9468d309a..6c050735bb4ea78fff5ea946bb8623b9a99758e0 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
similarity index 75%
rename from opendaylight/sal/yang-prototype/sal/model/model-flow-base/src/main/yang/opendaylight-flow-base.yang
rename to opendaylight/sal/yang-prototype/sal/model/model-flow-base/src/main/yang/match-types.yang
index 443d82f2e42bd13083ace2889b25574d46246fd1..54b46d5587af0e0c65841d03546d80aa7f58d5bb 100644 (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
similarity index 54%
rename from opendaylight/sal/yang-prototype/sal/model/model-flow-statistics/src/main/yang/opendaylight-flow-statistics.yang
rename to opendaylight/sal/yang-prototype/sal/model/model-flow-statistics/src/main/yang/statistics-types.yang
index 3c1bb70e6886a5b27d16e915f45288abf5267099..47c4c9369e2ded77a471de29928e58e1fbef82df 100644 (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 fc6fb8eaed40561c666d5468484cf89e6cc84d73..0442e8f9b2646d8f9b4d159fdfff7ea1e47d0287 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 b8ba6055246a8b319f6bb25ee2161504e1cec104..549e427d82e816fb4374d3b80b3b44e2b9aeee1d 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 fa3536335736d58af14725978158451eba3291a5..0965e2523109f5d24b9f23bc055523dd05f93e90 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 3b0ae0cdebec87d5eb42dfeeb63d27cb0f82a2e2..5ec72024c29eea8362b04e2d23772bfd161d0ed2 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 8ea0d78360427f4b683a579d8ff117468e530941..5a4473bf8ca1fb01a68ecaf8ce0c958fc16d9618 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 0c17c84ec4d6e5f74f2bca3bb281bc97cd091c28..2f5aacab67e97b5f8fe142e267dc7bda606bab70 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 60330c1ad46b4709c56267578b411ccba2d4aefa..d82c9967425839dcc1fbd10efe74120c03efd03f 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>();
     }
 
     /*
@@ -1382,7 +1382,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
                         try {
                             map.put(s, new NodeConnector(entry.getValue()));
                         } catch (ConstructionException e) {
-                            e.printStackTrace();
+                            log.error("An error occured",e);
                         }
                     }
                 }
@@ -1444,7 +1444,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
                             try {
                                 map.put(s, new NodeConnector(entry.getValue()));
                             } catch (ConstructionException e) {
-                                e.printStackTrace();
+                                log.error("An error occured",e);
                             }
                         }
                         map.remove(name.getValue());
@@ -1481,7 +1481,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
                         try {
                             map.put(s, new NodeConnector(entry.getValue()));
                         } catch (ConstructionException e) {
-                            e.printStackTrace();
+                            log.error("An error occured",e);
                         }
                     }
                     map.remove(name.getValue());
index 9524a76b012a1cb2d6a568aba3c51cb3ad975ac9..3fd292bdf263c9954e8e5076466666eb25e9e3a7 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 b8eb29aaa7f9742f1bb2a0da2a8cb8ac6342e479..8bc2a9937809491816023d38169af95822d8cba7 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 d9aa03ea6209a66fa4548ef091694b1e63dd633c..3b0b85c065cc8cf2de88205525aaaf6f89e84868 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 599922d391b12284b87544615e6022a9396d69ed..85e4d472ef0d5f89e3e274543e4040a3b2e22ae2 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,