Merge "Expose ChannelFuture from sendMessage()"
authorEd Warnicke <eaw@cisco.com>
Mon, 10 Feb 2014 23:50:32 +0000 (23:50 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 10 Feb 2014 23:50:32 +0000 (23:50 +0000)
22 files changed:
opendaylight/commons/opendaylight/pom.xml
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/TransactionIdentifier.java
opendaylight/config/config-persister-file-xml-adapter/src/main/java/org/opendaylight/controller/config/persist/storage/file/xml/model/PersistException.java
opendaylight/config/yang-jmx-generator/src/main/java/org/opendaylight/controller/config/yangjmxgenerator/plugin/util/NameConflictException.java
opendaylight/config/yang-jmx-generator/src/test/java/org/opendaylight/controller/config/yangjmxgenerator/SchemaContextTest.java
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/ReferencableObjectKey.java
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Rpcs.java
opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/sample/toaster/provider/impl/ToastConsumerImpl.java
opendaylight/md-sal/samples/toaster-provider/src/main/java/org/opendaylight/controller/sample/toaster/provider/ToasterProvider.java
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/VirtualSocketException.java
opendaylight/networkconfiguration/neutron/implementation/pom.xml
opendaylight/networkconfiguration/neutron/pom.xml
opendaylight/northbound/containermanager/pom.xml
opendaylight/northbound/integrationtest/pom.xml
opendaylight/northbound/networkconfiguration/neutron/pom.xml
opendaylight/northbound/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/northbound/NeutronPortsNorthbound.java
opendaylight/northbound/switchmanager/src/main/java/org/opendaylight/controller/switchmanager/northbound/SwitchNorthbound.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java
opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/utils/NetUtilsTest.java

index d2e904802741ad8d95c4c60b26006b103782d1f4..84fe758e222846d43513fe5ce1199e3608c9f381 100644 (file)
@@ -4,7 +4,6 @@
   <prerequisites>
     <maven>3.0</maven>
   </prerequisites>
-  <groupId>org.opendaylight.controller</groupId>
   <artifactId>commons.opendaylight</artifactId>
   <version>1.4.2-SNAPSHOT</version>
   <packaging>pom</packaging>
        <artifactId>yang-model-api</artifactId>
        <version>${yangtools.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.opendaylight.yangtools</groupId>
+        <artifactId>yang-model-util</artifactId>
+        <version>${yangtools.version}</version>
+      </dependency>
+
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>hosttracker</artifactId>
index 5ab09bea11901fca52d5cd0c662f51cad1c17f10..28bd613648d31bfcb6072737b065ceaa07bf7390 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.config.manager.impl;
 import org.opendaylight.yangtools.concepts.Identifier;
 
 public class TransactionIdentifier implements Identifier {
-
+    private static final long serialVersionUID = 1L;
     private final String name;
 
     public TransactionIdentifier(String name) {
index 29d623274c907b914fe01b2180d27e0657f06f42..a0ccdb8e2e883294a57c75d3daf47c1c12ef1a2e 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.config.persist.storage.file.xml.model;
 
 final class PersistException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
 
     public PersistException(String s, Exception e) {
         super(s, e);
index 2ae70562cfcf04c996a9d0de3f925cf3c2b4f69e..ec2d9853390b69a835e9a1e8d638c432dee07695 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.config.yangjmxgenerator.plugin.util;
 import org.opendaylight.yangtools.yang.common.QName;
 
 public class NameConflictException extends RuntimeException {
-
+    private static final long serialVersionUID = 1L;
     private static final String messageBlueprint = "Name conflict for name: %s, first defined in: %s, then defined in: %s";
     private final String conflictingName;
     private final QName secondParentQName;
index 14ec7e0fdc9bfae4b97dd5ffe2705f67834b0e61..1837bac2664bdfa9a96feb7f25435ac418d37dda 100644 (file)
@@ -100,12 +100,15 @@ public class SchemaContextTest extends AbstractYangTest {
 
     @Test
     public void testReadingIdentities_threadsJavaModule() {
-        Map<String /* identity name */, Optional<QName>> expectedIdentitiesToBases = new HashMap(){{
+        Map<String /* identity name */, Optional<QName>> expectedIdentitiesToBases = new HashMap<String, Optional<QName>>(){
+            private static final long serialVersionUID = 1L;
+
+        {
             put(ModuleMXBeanEntryTest.EVENTBUS_MXB_NAME, Optional.of(MODULE_TYPE_Q_NAME));
             put(ModuleMXBeanEntryTest.ASYNC_EVENTBUS_MXB_NAME, Optional.of(MODULE_TYPE_Q_NAME));
             put(ModuleMXBeanEntryTest.THREADFACTORY_NAMING_MXB_NAME, Optional.of(MODULE_TYPE_Q_NAME));
             put(ModuleMXBeanEntryTest.THREADPOOL_DYNAMIC_MXB_NAME, Optional.of(MODULE_TYPE_Q_NAME));
-            put("thread-rpc-context", Optional.absent());
+            put("thread-rpc-context", Optional.<QName>absent());
             put(ModuleMXBeanEntryTest.THREADPOOL_REGISTRY_IMPL_NAME, Optional.of(MODULE_TYPE_Q_NAME));
         }};
 
index 2f594148c98290f96e8b2d2288da2d4166bec177..8b4e478429b517612c53cc95c8f6a51e6585adec 100644 (file)
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
-        <!-- Java Versions -->
-        <maven.compiler.source>1.7</maven.compiler.source>
-        <maven.compiler.target>1.7</maven.compiler.target>
 
         <!-- Plugin Versions -->
         <bundle.plugin.version>2.4.0</bundle.plugin.version>
-        <releaseplugin.version>2.3.2</releaseplugin.version>
+        <maven.clean.plugin.version>2.5</maven.clean.plugin.version>
 
         <!-- Dependency Versions -->
-        <slf4j.version>1.7.2</slf4j.version>
-        <guava.version>14.0.1</guava.version>
-        <osgi.core.version>5.0.0</osgi.core.version>
-        <junit.version>4.8.1</junit.version>
         <mockito.version>1.9.5</mockito.version>
         <xtend.version>2.4.3</xtend.version>
-        <maven.clean.plugin.version>2.5</maven.clean.plugin.version>
-        <jacoco.version>0.5.3.201107060350</jacoco.version>
 
         <!-- Sonar properties using jacoco to retrieve integration test results -->
         <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
         <sal.version>0.7.1-SNAPSHOT</sal.version>
     </properties>
 
-    <pluginRepositories>
-        <!-- OpenDayLight Repo Mirror -->
-        <pluginRepository>
-            <id>opendaylight-mirror</id>
-            <name>opendaylight-mirror</name>
-            <url>${nexusproxy}/groups/public/</url>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-            </releases>
-        </pluginRepository>
-        <!-- OpenDayLight Snapshot artifact -->
-        <pluginRepository>
-            <id>opendaylight-snapshot</id>
-            <name>opendaylight-snapshot</name>
-            <url> ${nexusproxy}/repositories/opendaylight.snapshot/</url>
-            <snapshots>
-                <enabled>true</enabled>
-            </snapshots>
-            <releases>
-                <enabled>false</enabled>
-            </releases>
-        </pluginRepository>
-    </pluginRepositories>
-
-
-    <repositories>
-        <!-- OpenDayLight Repo Mirror -->
-        <repository>
-            <id>opendaylight-mirror</id>
-            <name>opendaylight-mirror</name>
-            <url>${nexusproxy}/groups/public/</url>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>never</updatePolicy>
-            </releases>
-        </repository>
-        <!-- OpenDayLight Snapshot artifact -->
-        <repository>
-            <id>opendaylight-snapshot</id>
-            <name>opendaylight-snapshot</name>
-            <url> ${nexusproxy}/repositories/opendaylight.snapshot/</url>
-            <snapshots>
-                <enabled>true</enabled>
-            </snapshots>
-            <releases>
-                <enabled>false</enabled>
-            </releases>
-        </repository>
-    </repositories>
-
-    <distributionManagement>
-        <!-- OpenDayLight Released artifact -->
-        <repository>
-            <id>opendaylight-release</id>
-            <url>${nexusproxy}/repositories/opendaylight.release/</url>
-        </repository>
-        <!-- OpenDayLight Snapshot artifact -->
-        <snapshotRepository>
-            <id>opendaylight-snapshot</id>
-            <url>${nexusproxy}/repositories/opendaylight.snapshot/</url>
-        </snapshotRepository>
-        <!-- Site deployment -->
-        <site>
-            <id>website</id>
-            <url>${sitedeploy}</url>
-        </site>
-    </distributionManagement>
-
-
     <dependencyManagement>
         <dependencies>
             <dependency>
                 <version>1.4.01</version>
             </dependency>
 
-            <!-- YANG Tools Dependencies -->
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-binding</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-model-util</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-common</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-impl</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-model-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-util</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
             <!-- SAL Dependencies -->
             <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>slf4j-api</artifactId>
                 <version>${slf4j.version}</version>
             </dependency>
-            <dependency>
-                <groupId>com.google.guava</groupId>
-                <artifactId>guava</artifactId>
-                <version>${guava.version}</version>
-            </dependency>
             <dependency>
                 <groupId>org.eclipse.xtend</groupId>
                 <artifactId>org.eclipse.xtend.lib</artifactId>
                 <artifactId>org.osgi.core</artifactId>
                 <version>${osgi.core.version}</version>
             </dependency>
-            <!-- Testing Dependencies -->
-            <dependency>
-                <groupId>junit</groupId>
-                <artifactId>junit</artifactId>
-                <version>${junit.version}</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.mockito</groupId>
-                <artifactId>mockito-all</artifactId>
-                <version>${mockito.version}</version>
-                <scope>test</scope>
-            </dependency>
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>binding-generator-impl</artifactId>
                 <artifactId>yang-parser-impl</artifactId>
                <version>${yangtools.version}</version>
             </dependency>
+
+            <!-- Testing Dependencies -->
+            <dependency>
+                <groupId>org.mockito</groupId>
+                <artifactId>mockito-all</artifactId>
+                <version>${mockito.version}</version>
+                <scope>test</scope>
+            </dependency>
         </dependencies>
     </dependencyManagement>
     <build>
         <pluginManagement>
             <plugins>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-release-plugin</artifactId>
-                    <version>${releaseplugin.version}</version>
-                </plugin>
                 <plugin>
                     <groupId>org.apache.felix</groupId>
                     <artifactId>maven-bundle-plugin</artifactId>
index a5da8a0cb14a329e6e22b1129f560db1c6de27c2..e98d5b9942c86afb9b76e006662fe02cdf6147c2 100644 (file)
@@ -93,7 +93,6 @@ public class RpcProviderRegistryImpl implements //
     @Override
     public final <T extends RpcService> T getRpcService(Class<T> type) {
 
-        @SuppressWarnings("unchecked")
         T potentialProxy = (T) publicProxies.get(type);
         if (potentialProxy != null) {
             return potentialProxy;
@@ -151,7 +150,7 @@ public class RpcProviderRegistryImpl implements //
 
     }
 
-    private void notifyListenersRoutedCreated(RpcRouter router) {
+    private void notifyListenersRoutedCreated(RpcRouter<?> router) {
 
         for (ListenerRegistration<RouterInstantiationListener> listener : routerInstantiationListener) {
             try {
index 7ab489a9f59f993af6a993e918115d830fdde9a8..68d7f6cd9efd510e269f791951da082e6a98c6dd 100644 (file)
@@ -10,9 +10,9 @@ package org.opendaylight.controller.sal.binding.test.mock;
 import org.opendaylight.yangtools.yang.binding.Identifier;
 
 public class ReferencableObjectKey implements Identifier<ReferencableObject> {
-
+    private static final long serialVersionUID = 1L;
     final Integer value;
-    
+
     public ReferencableObjectKey(Integer _value) {
         this.value = _value;
     }
@@ -46,6 +46,6 @@ public class ReferencableObjectKey implements Identifier<ReferencableObject> {
     public String toString() {
         return "ReferencableObjectKey [value=" + value + "]";
     }
-    
-    
+
+
 }
index f7fc7140251e00eeda5eea904c97074278d15960..f30394187125153004e9b5c3a1b4d4cb2cc74886 100644 (file)
@@ -34,7 +34,7 @@ public class Rpcs {
     }
 
     private static class RpcResultTO<T> implements RpcResult<T>, Serializable, Immutable {
-
+        private static final long serialVersionUID = 1L;
         private final Collection<RpcError> errors;
         private final T result;
         private final boolean successful;
index fde60d64ceb148b01daa037c4d037c7182dafd41..87e5787ef5c9f63df75c95344ae4ac64e608b76a 100644 (file)
@@ -11,18 +11,14 @@ import java.util.Hashtable;
 import java.util.concurrent.ExecutionException;
 
 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareConsumer;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.common.GlobalDataStore;
 import org.opendaylight.controller.sample.toaster.provider.api.ToastConsumer;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInputBuilder;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToastDone;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToastType;
-import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.Toaster;
-import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterData;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.osgi.framework.BundleActivator;
@@ -71,7 +67,7 @@ public class ToastConsumerImpl extends AbstractBindingAwareConsumer implements B
     public void onSessionInitialized(ConsumerContext session) {
         this.session = session;
         NotificationService notificationService = session.getSALService(NotificationService.class);
-        notificationService.addNotificationListener(ToastDone.class, this);
+        notificationService.registerNotificationListener(ToastDone.class, this);
     }
 
     @Override
index 5ba67474b36c3027a6c0ffb6fbc6322c4846d056..ae482ed9786f38d0d0f2e81af458922c92d8a824 100644 (file)
@@ -11,16 +11,10 @@ import java.util.Collection;
 import java.util.Collections;
 
 import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService;
 import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -28,7 +22,7 @@ public class ToasterProvider extends AbstractBindingAwareProvider {
     private static final Logger log = LoggerFactory.getLogger(ToasterProvider.class);
 
     private ProviderContext providerContext;
-    private OpendaylightToaster toaster;
+    private final OpendaylightToaster toaster;
 
     public ToasterProvider() {
         toaster = new OpendaylightToaster();
index 502d58122082c8a9f60df8d5626c8d37f5374f3f..54d24a4cec3823c0a07e1bfaf5e36b2c69815d0d 100644 (file)
@@ -8,6 +8,11 @@
 
 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes;
 
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.AttributeIfc;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.DependencyAttribute;
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.JavaAttribute;
@@ -16,11 +21,6 @@ import org.opendaylight.controller.config.yangjmxgenerator.attribute.ListDepende
 import org.opendaylight.controller.config.yangjmxgenerator.attribute.TOAttribute;
 import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
 
-import javax.management.openmbean.ArrayType;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-
 public abstract class AttributeIfcSwitchStatement<T> {
 
     protected AttributeIfc lastAttribute;
@@ -102,6 +102,8 @@ public abstract class AttributeIfcSwitchStatement<T> {
     protected abstract T caseListDependeciesAttribute(ArrayType<?> openType);
 
     private static class UnknownOpenTypeException extends RuntimeException {
+        private static final long serialVersionUID = 1L;
+
         public UnknownOpenTypeException(String message) {
             super(message);
         }
index 46fdbb83e77dceb02163478fa00f0c9391660f0f..5907ea8f136512c2028c3d79cc6dc64d4d8d4e33 100644 (file)
@@ -12,4 +12,5 @@ package org.opendaylight.controller.netconf.util.handler.ssh.virtualsocket;
  * Exception class which provides notification about exceptional situations at the virtual socket layer.
  */
 public class VirtualSocketException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
 }
index 83e251aed8c3e1d9d56d6e091b4fa9902cee5072..821ac92021683e8d0cccdd6409b28f09add1ad0d 100644 (file)
@@ -34,7 +34,6 @@
       <url>${sitedeploy}</url>
     </site>
   </distributionManagement>
-  <groupId>org.opendaylight.controller</groupId>
   <artifactId>networkconfig.neutron.implementation</artifactId>
   <version>0.4.2-SNAPSHOT</version>
   <packaging>bundle</packaging>
index fc728dc89f4162ef58487e7ca94f2bd7a2cf6d17..27588b8bee907b8015df57daa5140d77d935dd8a 100644 (file)
@@ -33,7 +33,6 @@
       <url>${sitedeploy}</url>
     </site>
   </distributionManagement>
-  <groupId>org.opendaylight.controller</groupId>
   <artifactId>networkconfig.neutron</artifactId>
   <version>0.4.2-SNAPSHOT</version>
   <packaging>bundle</packaging>
index 2d980910f4a90ada714a0a46929c7e3eeb17b2c6..48dee485ae7437e80c5e7deafa0f346759db57b8 100644 (file)
@@ -14,7 +14,6 @@
     <tag>HEAD</tag>
   </scm>
 
-  <groupId>org.opendaylight.controller</groupId>
   <artifactId>containermanager.northbound</artifactId>
   <version>0.4.2-SNAPSHOT</version>
   <packaging>bundle</packaging>
index a6b3855d1f0401e6cf7c7d66bc93124f740547b2..278952666819e6365c6f8479bdea91f827e245bf 100644 (file)
@@ -14,7 +14,6 @@
     <tag>HEAD</tag>
   </scm>
 
-  <groupId>org.opendaylight.controller</groupId>
   <artifactId>northbound.integrationtest</artifactId>
   <version>0.4.2-SNAPSHOT</version>
   <pluginRepositories>
index a6596f886d7e0e58fe57ed0d537bcd45a28ca6ba..7590a976b6fe6f2e0abcf35a1ca900a8967e3413 100644 (file)
@@ -34,7 +34,6 @@
             <url>${sitedeploy}</url>
         </site>
     </distributionManagement>
-    <groupId>org.opendaylight.controller</groupId>
     <artifactId>networkconfig.neutron.northbound</artifactId>
     <version>0.4.2-SNAPSHOT</version>
     <packaging>bundle</packaging>
index 642b3bb197c1e0e9416967cbc71760ef79c64ecf..c26e0229d0271ed6a6a0a10f0e17755176f69595 100644 (file)
@@ -60,6 +60,8 @@ import org.opendaylight.controller.sal.utils.ServiceHelper;
 @Path("/ports")
 public class NeutronPortsNorthbound {
 
+    final String mac_regex="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$";
+
     private NeutronPort extractFields(NeutronPort o, List<String> fields) {
         return o.extractFields(fields);
     }
@@ -207,7 +209,7 @@ public class NeutronPortsNorthbound {
                 return Response.status(404).build();
             }
             if (singleton.getMacAddress() == null ||
-                    !singleton.getMacAddress().matches("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$")) {
+                    !singleton.getMacAddress().matches(mac_regex)) {
                 return Response.status(400).build();
             }
             if (portInterface.macInUse(singleton.getMacAddress())) {
@@ -298,7 +300,7 @@ public class NeutronPortsNorthbound {
                 if (!networkInterface.networkExists(test.getNetworkUUID())) {
                     return Response.status(404).build();
                 }
-                if (!test.getMacAddress().matches("^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$")) {
+                if (!test.getMacAddress().matches(mac_regex)) {
                     return Response.status(400).build();
                 }
                 if (portInterface.macInUse(test.getMacAddress())) {
index 8eff06a763692a4774afe57c7b6a816a0a07d2f3..662af723ed4861aa339ff99c3cacedb00af20cf2 100644 (file)
@@ -416,7 +416,7 @@ public class SwitchNorthbound {
      *         {@link org.opendaylight.controller.sal.core.Property} attached to
      *         it.
      *
-     *         <pre>
+     * <pre>
      *
      * Example:
      *
@@ -540,8 +540,10 @@ public class SwitchNorthbound {
      *            Type of the node connector being programmed (Eg. 'OF')
      * @param nodeConnectorId
      *            NodeConnector Identifier as specified by
-     *            {@link org.opendaylight.controller.sal.core.NodeConnector}
-     *            (Eg. '2')
+     *            {@link org.opendaylight.controller.sal.core.NodeConnector}.
+     *            (Eg. '2'). If nodeConnecterId contains forward slash(/),
+     *            replace forward slash with underscore(_) in the URL. (Eg. for
+     *            Ethernet1/2, use Ethernet1_2)
      * @param propertyName
      *            Name of the Property specified by
      *            {@link org.opendaylight.controller.sal.core.Property} and its
@@ -552,7 +554,7 @@ public class SwitchNorthbound {
      *            extended classes
      * @return Response as dictated by the HTTP Response Status code
      *
-     *         <pre>
+     * <pre>
      *
      * Example:
      *
@@ -592,6 +594,10 @@ public class SwitchNorthbound {
         handleNodeAvailability(containerName, nodeType, nodeId);
         Node node = Node.fromString(nodeType, nodeId);
 
+        if (nodeConnectorId.contains("_")) {
+            nodeConnectorId = nodeConnectorId.replace("_", "/");
+        }
+
         handleNodeConnectorAvailability(containerName, node, nodeConnectorType, nodeConnectorId);
         NodeConnector nc = NodeConnector.fromStringNoNode(nodeConnectorType, nodeConnectorId, node);
 
@@ -625,14 +631,16 @@ public class SwitchNorthbound {
      * @param nodeConnectorId
      *            NodeConnector Identifier as specified by
      *            {@link org.opendaylight.controller.sal.core.NodeConnector}
-     *            (Eg. '1')
+     *            (Eg. '1'). If nodeConnecterId contains forward slash(/),
+     *            replace forward slash with underscore(_) in the URL. (Eg. for
+     *            Ethernet1/2, use Ethernet1_2)
      * @param propertyName
      *            Name of the Property specified by
      *            {@link org.opendaylight.controller.sal.core.Property} and its
      *            extended classes. Property that can be deleted is bandwidth
      * @return Response as dictated by the HTTP Response Status code
      *
-     *         <pre>
+     * <pre>
      *
      * Example:
      *
@@ -670,6 +678,10 @@ public class SwitchNorthbound {
         handleNodeAvailability(containerName, nodeType, nodeId);
         Node node = Node.fromString(nodeType, nodeId);
 
+        if (nodeConnectorId.contains("_")) {
+            nodeConnectorId = nodeConnectorId.replace("_", "/");
+        }
+
         handleNodeConnectorAvailability(containerName, node, nodeConnectorType, nodeConnectorId);
         NodeConnector nc = NodeConnector.fromStringNoNode(nodeConnectorType, nodeConnectorId, node);
         Status ret = switchManager.removeNodeConnectorProp(nc, propertyName);
index 6c3424c616c46799908911e56e5323f8103d99cd..dc341625af642395872a3e2860a9d0fcc6f1ce3b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013-2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -482,7 +482,7 @@ public abstract class NetUtils {
      * @return the int variable containing the unsigned byte value
      */
     public static int getUnsignedByte(byte b) {
-        return (b > 0) ? (int) b : (b & 0x7F | 0x80);
+        return b & 0xFF;
     }
 
     /**
@@ -493,7 +493,7 @@ public abstract class NetUtils {
      * @return the int variable containing the unsigned short value
      */
     public static int getUnsignedShort(short s) {
-        return (s > 0) ? (int) s : (s & 0x7FFF | 0x8000);
+        return s & 0xFFFF;
     }
 
     /**
@@ -520,5 +520,4 @@ public abstract class NetUtils {
     public static byte[] getBroadcastMACAddr() {
         return Arrays.copyOf(BroadcastMACAddr, BroadcastMACAddr.length);
     }
-
 }
index b8bc6fb4470901c0761df18e51482489c7e4325b..a2b12782ac2986f24cfd6fbe8f295f5ef105712d 100644 (file)
@@ -1,6 +1,5 @@
-
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2013-2014 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -449,4 +448,24 @@ public class NetUtilsTest {
         Assert.assertTrue(NetUtils
                 .isIPAddressValid("2001:420:281:1004:407a:57f4:4d15:c355"));
     }
+
+    @Test
+    public void testGetUnsignedByte() {
+        Assert.assertEquals(0,   NetUtils.getUnsignedByte((byte) 0x00));
+        Assert.assertEquals(1,   NetUtils.getUnsignedByte((byte) 0x01));
+        Assert.assertEquals(127, NetUtils.getUnsignedByte((byte) 0x7f));
+
+        Assert.assertEquals(128, NetUtils.getUnsignedByte((byte) 0x80));
+        Assert.assertEquals(255, NetUtils.getUnsignedByte((byte) 0xff));
+    }
+
+    @Test
+    public void testGetUnsignedShort() {
+        Assert.assertEquals(0,     NetUtils.getUnsignedShort((short) 0x0000));
+        Assert.assertEquals(1,     NetUtils.getUnsignedShort((short) 0x0001));
+        Assert.assertEquals(32767, NetUtils.getUnsignedShort((short) 0x7fff));
+
+        Assert.assertEquals(32768, NetUtils.getUnsignedShort((short) 0x8000));
+        Assert.assertEquals(65535, NetUtils.getUnsignedShort((short) 0xffff));
+    }
 }