Merge "Fix typo in match types yang model"
authorEd Warnicke <eaw@cisco.com>
Tue, 11 Feb 2014 01:34:35 +0000 (01:34 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 11 Feb 2014 01:34:35 +0000 (01:34 +0000)
101 files changed:
opendaylight/commons/opendaylight/pom.xml
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/ProtocolMessageDecoder.java
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/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java
opendaylight/md-sal/model/model-flow-base/pom.xml
opendaylight/md-sal/model/model-flow-service/pom.xml
opendaylight/md-sal/model/model-flow-service/src/main/yang/sal-flow.yang
opendaylight/md-sal/pom.xml
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareConsumer.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/AbstractBindingAwareProvider.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationProviderService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/NotificationService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/RpcProviderRegistry.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataModificationTransaction.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataProviderService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataRefresher.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/RuntimeDataProvider.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountInstance.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/rpc/RpcRouter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/NotificationBrokerImplModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/RuntimeMappingModule.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRouterCodegenInstance.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/RpcRoutingTableImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/codegen/impl/SingletonHolder.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataBrokerImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/DataTransactionImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RpcProviderRegistryImpl.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/connect/dom/DataModificationTracker.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AbstractDataServiceTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/RuntimeCodeGeneratorTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/mock/ReferencableObjectKey.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingBrokerTestFactory.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug02Test.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug03Test.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/PutAugmentationTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/CrossBrokerMountPointTest.java
opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTestProvider.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/NoficationTest.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/RoutedServiceTest.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/BindingContextUtils.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataChangePublisher.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/DataModification.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/ListenerRegistry.java
opendaylight/md-sal/sal-common-impl/src/main/java/org/opendaylight/controller/md/sal/common/impl/util/AbstractLockableDelegator.java
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Rpcs.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/AbstractProvider.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/data/DataModificationTransaction.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/mount/MountProvisionInstance.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/NotificationModule.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/impl/NotificationRouterImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/MountProviderServiceProxy.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/spi/RpcRouter.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDeviceTwoPhaseCommitTransaction.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfRemoteSchemaSourceProvider.java
opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/YangModelInputStreamAdapter.java
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/config/yang/md/sal/remote/rpc/ZeroMQServerModule.java
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/main/java/org/opendaylight/controller/sal/connector/remoterpc/ServerImpl.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnToJsonNotExistingLeafTypeTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/xml/test/CnSnToXmlNotExistingLeafTypeTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/websockets/client/WebSocketClientHandler.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/md-sal/statistics-manager/pom.xml
opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java
opendaylight/md-sal/statistics-manager/src/test/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiterTest.java [new file with mode: 0644]
opendaylight/md-sal/statistics-manager/src/test/resources/log4j-test.xml [new file with mode: 0644]
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/AttributeIfcSwitchStatement.java
opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfDeserializerException.java
opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfDocumentedException.java
opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfMessage.java
opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfSshClientDispatcher.java
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/MessageParserTest.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractChannelInitializer.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfHandlerFactory.java [deleted file]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageChunkDecoder.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageToXMLEncoder.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfXMLToMessageDecoder.java [new file with mode: 0644]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/VirtualSocketException.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/mapping/AbstractNetconfOperation.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageFactory.java [deleted file]
opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageFactoryTest.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..63392571d48cf671a41504b48ceb1c93cf744dd6 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>
     <testvm.argLine>-Xmx1024m -XX:MaxPermSize=256m</testvm.argLine>
     <guava.version>14.0.1</guava.version>
     <osgi.core.version>5.0.0</osgi.core.version>
-    <ietf-inet-types.version>2010.09.24.3</ietf-inet-types.version>
-    <ietf-yang-types.version>2010.09.24.3</ietf-yang-types.version>
-    <ietf-topology.version>2013.10.21.1</ietf-topology.version>
-    <opendaylight-l2-types.version>2013.08.27.3</opendaylight-l2-types.version>
-    <yang-ext.version>2013.09.07.3</yang-ext.version>
+    <ietf-inet-types.version>2010.09.24.4-SNAPSHOT</ietf-inet-types.version>
+    <ietf-yang-types.version>2010.09.24.4-SNAPSHOT</ietf-yang-types.version>
+    <ietf-topology.version>2013.10.21.2-SNAPSHOT</ietf-topology.version>
+    <opendaylight-l2-types.version>2013.08.27.4-SNAPSHOT</opendaylight-l2-types.version>
+    <yang-ext.version>2013.09.07.4-SNAPSHOT</yang-ext.version>
     <javassist.version>3.17.1-GA</javassist.version>
     <releaseplugin.version>2.3.2</releaseplugin.version>
     <commons.lang.version>3.1</commons.lang.version>
        <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 40de6e550742f727af5a84450c84fb8ec5bbd7d6..84508ca03e99475b7a95fcc0a0e676082e227f04 100644 (file)
@@ -14,9 +14,7 @@ import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.common.util.Futures;
 import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.controller.sal.compatibility.InventoryMapping;
-import org.opendaylight.controller.sal.compatibility.NodeMapping;
 import org.opendaylight.controller.sal.compatibility.ToSalConversionsUtils;
-import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.flowprogrammer.Flow;
 import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerListener;
 import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
index a7c74c573b04e229cb9444b405e7ebdbd6da5a3d..d7d678d89a599d54c531856c3d601410ce5b1792 100644 (file)
@@ -19,7 +19,6 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.3</version>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
index 55837564c304bbadf8559b314ee293891aceb4f8..5604ea98cff2aedc9c8ca212a2ee73840f528e82 100644 (file)
@@ -29,7 +29,6 @@
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
-            <version>2013.08.27.3</version>
         </dependency>
     </dependencies>
     <packaging>bundle</packaging>
index 091bd43e1973ac8f2ec6aaea93717fe386e25af4..b3e6e450af8c3f9d4b0d593b91547e0f48023620 100644 (file)
@@ -4,7 +4,9 @@ module sal-flow {
 
     import yang-ext {prefix ext; revision-date "2013-07-09";}
     import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
-    import opendaylight-flow-types {prefix types;revision-date "2013-10-26";}
+    import opendaylight-flow-types {prefix types;revision-date "2013-10-26";}    
+    import opendaylight-group-types {prefix group-type;revision-date 2013-10-18;}
+    import opendaylight-meter-types {prefix meter-type;revision-date "2013-09-18";}
     import flow-capable-transaction {prefix tr;}
     import flow-errors {prefix error;}
 
@@ -122,6 +124,28 @@ module sal-flow {
         uses error:error-message;
         uses tr:transaction-aware;
         uses tr:transaction-metadata;
+        choice object-reference {
+        case flow-ref{
+                   leaf flow-ref {
+            type types:flow-ref;
+         }
+       }
+        case group-ref{
+                   leaf group-ref {
+            type group-type:group-ref;
+         }
+       }
+        case meter-ref{
+                   leaf meter-ref {
+            type meter-type:meter-ref;
+         }
+       }
+     }
+        leaf node {
+            ext:context-reference "inv:node-context";
+            type inv:node-ref;
+        }
+        
     }
     
     notification node-experimenter-error-notification {
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 fc145c8b16e0d9dff7e0c29e480ff5fe9935f4dd..02bb6b35b9165e29aa22f077488c1969354a2175 100644 (file)
@@ -7,10 +7,7 @@
  */
 package org.opendaylight.controller.sal.binding.api;
 
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
 
 public abstract class AbstractBindingAwareConsumer extends AbstractBrokerAwareActivator implements BindingAwareConsumer {
 
index 9d3bff4ef8b9d4d954f3f10b31d3789d655ad59e..068b6c204f3d75db69a57dcd0db873548d158343 100644 (file)
@@ -13,12 +13,10 @@ import java.util.Collections;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
 
 public abstract class AbstractBindingAwareProvider extends AbstractBrokerAwareActivator implements BindingAwareProvider {
-    
+
     @Override
     protected final void onBrokerAvailable(BindingAwareBroker broker, BundleContext context) {
         ProviderContext ctx = broker.registerProvider(this, context);
@@ -57,13 +55,13 @@ public abstract class AbstractBindingAwareProvider extends AbstractBrokerAwareAc
     public Collection<? extends RpcService> getImplementations() {
         return Collections.emptySet();
     }
-    
+
     /**
      * Initialization of consumer context.
-     * 
+     *
      * {@link ProviderContext} is replacement of {@link ConsumerContext}
      * so this method is not needed in case of Provider.
-     * 
+     *
      */
     @Deprecated
     @Override
index c28b03eb65a092817917956cc9794a8267c41479..08029dc52fa2c35fe1ea0f4b7994ef6eecf3fbe2 100644 (file)
@@ -12,7 +12,6 @@ import java.util.concurrent.ExecutorService;
 
 import org.opendaylight.controller.md.sal.common.api.notify.NotificationPublishService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 public interface NotificationProviderService extends NotificationService, NotificationPublishService<Notification> {
@@ -20,7 +19,7 @@ public interface NotificationProviderService extends NotificationService, Notifi
 
     /**
      * Deprecated. Use {@link #publish(Notification)}.
-     * 
+     *
      * @param notification
      */
     @Deprecated
@@ -28,7 +27,7 @@ public interface NotificationProviderService extends NotificationService, Notifi
 
     /**
      * Deprecated. Use {@link #publish(Notification,ExecutorService)}.
-     * 
+     *
      * @param notification
      */
     @Deprecated
@@ -36,17 +35,17 @@ public interface NotificationProviderService extends NotificationService, Notifi
 
     /**
      * Publishes a notification.
-     * 
+     *
      * @param Notification
      *            notification to publish.
-     * 
+     *
      */
     @Override
     void publish(Notification notification);
 
     /**
      * Publishes a notification, listener calls are done in provided executor.
-     * 
+     *
      */
     @Override
     void publish(Notification notification, ExecutorService service);
index 10b29f721873bd2bd78573b071f3e771e5549d3c..24ca2a3de7e13073b0e61e2be930ebabf04d9436 100644 (file)
@@ -7,25 +7,23 @@
  */
 package org.opendaylight.controller.sal.binding.api;
 
-import org.opendaylight.controller.md.sal.common.api.notify.NotificationSubscriptionService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 public interface NotificationService extends BindingAwareService {
     /**
-     * 
+     *
      * Deprecated: use {@link #addNotificationListener(Class, NotificationListener)} istead.
-     * 
+     *
      * @param listener
      */
     @Deprecated
     <T extends Notification> void addNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
 
     /**
-     * 
+     *
      * Deprecated: use {@link #addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener)} istead.
-     * 
+     *
      * @param listener
      */
     @Deprecated
@@ -45,10 +43,10 @@ public interface NotificationService extends BindingAwareService {
     @Deprecated
     <T extends Notification> void removeNotificationListener(Class<T> notificationType, NotificationListener<T> listener);
 
-    
+
     /**
      * Register a generic listener for specified notification type only.
-     * 
+     *
      * @param notificationType
      * @param listener
      * @return Registration for listener. To unregister listener invoke {@link Registration#close()} method.
@@ -61,7 +59,7 @@ public interface NotificationService extends BindingAwareService {
      * Register a listener which implements generated notification interfaces derived from
      * {@link org.opendaylight.yangtools.yang.binding.NotificationListener}.
      * Listener is registered for all notifications present in implemented interfaces.
-     * 
+     *
      * @param listener
      * @return Registration for listener. To unregister listener invoke {@link Registration#close()} method.
      */
index fcf8ed5c9e65e40ce4bdb79eb9d96e440fcf1c21..c64e24c9c232d2aab54847713c7f5f1c7aa236dd 100644 (file)
@@ -11,23 +11,22 @@ import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublishe
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
 /**
  * Interface defining provider's access to the Rpc Registry which could be used
  * to register their implementations of service to the MD-SAL.
- * 
+ *
  * @author ttkacik
- * 
+ *
  */
 public interface RpcProviderRegistry extends //
         RpcConsumerRegistry, //
         RouteChangePublisher<RpcContextIdentifier, InstanceIdentifier<?>> {
     /**
      * Registers an global RpcService implementation.
-     * 
+     *
      * @param type
      * @param implementation
      * @return
@@ -36,10 +35,10 @@ public interface RpcProviderRegistry extends //
             throws IllegalStateException;
 
     /**
-     * 
+     *
      * Register an Routed RpcService where routing is determined on annotated
      * (in YANG model) context-reference and value of annotated leaf.
-     * 
+     *
      * @param type
      *            Type of RpcService, use generated interface class, not your
      *            implementation clas
@@ -47,7 +46,7 @@ public interface RpcProviderRegistry extends //
      *            Implementation of RpcService
      * @return Registration object for routed Rpc which could be used to close
      *         an
-     * 
+     *
      * @throws IllegalStateException
      */
     <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type, T implementation)
index 9ce11c71e4b6d1a41fa61a4dfa94401700db97e1..719063832314cfa069121fb92d79c62165439424 100644 (file)
@@ -11,9 +11,9 @@ import java.util.EventListener;
 import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -22,28 +22,28 @@ public interface DataModificationTransaction extends DataModification<InstanceId
 
     /**
      * Returns an unique identifier for transaction
-     * 
+     *
      */
     @Override
     public Object getIdentifier();
-    
+
     /**
      * Initiates a two-phase commit of candidate data.
-     * 
+     *
      * <p>
      * The {@link Consumer} could initiate a commit of candidate data
-     * 
+     *
      * <p>
      * The successful commit changes the state of the system and may affect
      * several components.
-     * 
+     *
      * <p>
      * The effects of successful commit of data are described in the
      * specifications and YANG models describing the {@link Provider} components
      * of controller. It is assumed that {@link Consumer} has an understanding
      * of this changes.
-     * 
-     * 
+     *
+     *
      * @see DataCommitHandler for further information how two-phase commit is
      *      processed.
      * @param store
@@ -53,12 +53,12 @@ public interface DataModificationTransaction extends DataModification<InstanceId
      */
     @Override
     public Future<RpcResult<TransactionStatus>> commit();
-    
-    
-    
+
+
+
     /**
      * Register a listener for transaction
-     * 
+     *
      * @param listener
      * @return
      */
@@ -68,13 +68,13 @@ public interface DataModificationTransaction extends DataModification<InstanceId
 
     /**
      * Listener for transaction state changes
-     * 
+     *
      *
      */
     public interface DataTransactionListener extends EventListener {
         /**
          * Callback is invoked after each transaction status change.
-         * 
+         *
          * @param transaction Transaction
          * @param status New status
          */
index 523abb50cab4150421c46d61d6aa345ccab98cd5..7d662cfcf20ebc60bd722fded3a6b04ab6eda9c7 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.controller.sal.binding.api.data;
 import org.opendaylight.controller.md.sal.common.api.data.DataProvisionService;
 import org.opendaylight.controller.md.sal.common.api.data.DataReader;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -23,15 +22,15 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  */
 public interface DataProviderService extends DataBrokerService, DataProvisionService<InstanceIdentifier<? extends DataObject>, DataObject> {
 
-    
+
     /**
      * Registers a data reader for particular subtree of overal YANG data tree.
-     * 
-     * Registered data reader is called if anyone tries to read data from 
+     *
+     * Registered data reader is called if anyone tries to read data from
      * paths which are nested to provided path.
-     * 
+     *
      * @param path Subpath which is handled by registered data reader
-     * @param reader Instance of reader which 
+     * @param reader Instance of reader which
      * @return Registration object for reader. Invoking {@link Registration#close()} will unregister reader.
      */
     Registration<DataReader<InstanceIdentifier<? extends DataObject>,DataObject>> registerDataReader(InstanceIdentifier<? extends DataObject> path,DataReader<InstanceIdentifier<? extends DataObject>,DataObject> reader);
index f54e1315be06a546ad6d62c4a92a693c8b3197cd..3334f2a037b119711916a52ad7c9d86b6424201d 100644 (file)
@@ -8,19 +8,18 @@
 package org.opendaylight.controller.sal.binding.api.data;
 
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
 
 /**
  * Trigger for refreshing of the data exposed by the {@link Provider}
- * 
- * 
- * 
+ *
+ *
+ *
  */
 public interface DataRefresher extends BindingAwareProvider.ProviderFunctionality {
 
     /**
      * Fired when some component explicitly requested the data refresh.
-     * 
+     *
      * The provider which exposed the {@link DataRefresher} should republish its
      * provided data by editing the data in all affected data stores.
      */
index 652e14bfa5b6683797ff9b0d3e339373e8bcdb61..85a2b82ee0397174966e8e584a6607eb61de3433 100644 (file)
@@ -7,23 +7,19 @@
  */
 package org.opendaylight.controller.sal.binding.api.data;
 
-import java.util.Set;
-
 import org.opendaylight.controller.md.sal.common.api.data.DataReader;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;
 import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.DataRoot;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
- * Utility interface which does type capture for BindingAware DataReader. 
- * 
- * @author 
+ * Utility interface which does type capture for BindingAware DataReader.
+ *
+ * @author
  *
  */
 public interface RuntimeDataProvider extends ProviderFunctionality,DataReader<InstanceIdentifier<? extends DataObject>, DataObject> {
-    
-    
+
+
 
 }
index 844b03a18050de2a80f494675f8624214ec722f0..b4441601cb5c23c52b3e4b63f56af73a40394a03 100644 (file)
@@ -12,7 +12,6 @@ import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.RpcService;
 
 public interface MountInstance //
         extends //
index f7b584507a85f500d1d603b59736ab48ea37a73f..6af9093fdd4c79c101808e528c8546b26a8b3056 100644 (file)
@@ -9,21 +9,19 @@ package org.opendaylight.controller.sal.binding.api.mount;
 
 import java.util.EventListener;
 
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * Provider MountProviderService, this version allows access to MD-SAL services
  * specific for this mountpoint and registration / provision of interfaces for
  * mount point.
- * 
+ *
  * @author ttkacik
- * 
+ *
  */
 public interface MountProviderService extends MountService {
-    
+
     @Override
     public MountProviderInstance getMountPoint(InstanceIdentifier<?> path);
 
index 31fed62d876ef5b8e25512023393204bf1856d02..81fe39c62e0c927cbe43110fabe76af640b71874 100644 (file)
@@ -14,17 +14,16 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcR
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.RpcImplementation;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
 /**
  * RpcRouter is responsible for selecting RpcService based on provided routing
  * context identifier {@link RpcRoutingTable#getContextIdentifier()} and path in
  * overal data tree (@link {@link InstanceIdentifier}.
- * 
- * 
+ *
+ *
  * @author Tony Tkacik <ttkacik@cisco.com>
- * 
+ *
  * @param <T>
  *            Type of RpcService for which router provides routing information
  *            and route selection.
@@ -34,23 +33,23 @@ public interface RpcRouter<T extends RpcService> extends //
 
     /**
      * Returns a type of RpcService which is served by this instance of router.
-     * 
+     *
      * @return type of RpcService which is served by this instance of router.
      */
     Class<T> getServiceType();
-    
-    
+
+
     /**
      * Returns a instance of T which is associated with this router instance
      * and routes messages based on routing tables.
-     * 
+     *
      * @return type of RpcService which is served by this instance of router.
      */
     T getInvocationProxy();
 
     /**
      * Returns a routing table for particular route context
-     * 
+     *
      * @param routeContext
      * @return Routing Table for particular route context.
      */
@@ -59,7 +58,7 @@ public interface RpcRouter<T extends RpcService> extends //
     /**
      * Returns an instance of RpcService which is responsible for processing
      * particular path.
-     * 
+     *
      * @param context
      *            Rpc Routing Context
      * @param path
@@ -72,15 +71,15 @@ public interface RpcRouter<T extends RpcService> extends //
     /**
      * Returns a default fallback instance of RpcService which is responsible
      * for handling all unknown imports.
-     * 
+     *
      * @return default instance responsible for processing RPCs.
      */
     T getDefaultService();
 
     Set<Class<? extends BaseIdentity>> getContexts();
-    
+
     RoutedRpcRegistration<T> addRoutedRpcImplementation(T service);
-    
+
     RpcRegistration<T> registerDefaultService(T service);
 
 }
index ffc83792284cbd0dc044cef26dfc5d0b43e99fe5..44a508c0a0bd2561c20517323f47735479688611 100644 (file)
@@ -23,8 +23,6 @@ import org.opendaylight.controller.sal.binding.impl.forward.DomForwardedBindingB
 import org.opendaylight.controller.sal.binding.impl.forward.DomForwardingUtils;\r
 import org.osgi.framework.BundleContext;\r
 \r
-import com.google.common.util.concurrent.MoreExecutors;\r
-\r
 /**\r
 *\r
 */\r
index 0a503d56428352ee7a4da76be4ae738e44fddc7f..b6c27a6332c4fdc7ddc6c08e25970f51431c8260 100644 (file)
@@ -7,15 +7,10 @@
  */
 package org.opendaylight.controller.config.yang.md.sal.binding.impl;
 
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
 import org.opendaylight.controller.sal.binding.impl.NotificationBrokerImpl;
 
 import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
 
 /**
 *
index 583591615c1089fb6741db79e68ab3eef3531bce..0762739c636eaff397371f7bd6b01ef223300099 100644 (file)
@@ -11,8 +11,6 @@ import java.util.Hashtable;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import javassist.ClassPool;
-
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
 import org.opendaylight.yangtools.concepts.Delegator;
 import org.opendaylight.yangtools.sal.binding.generator.impl.RuntimeGeneratedMappingServiceImpl;
@@ -115,39 +113,47 @@ public final class RuntimeMappingModule extends
             this.delegate = Preconditions.checkNotNull(delegate);
         }
 
+        @Override
         public CodecRegistry getCodecRegistry() {
             return delegate.getCodecRegistry();
         }
 
+        @Override
         public CompositeNode toDataDom(DataObject data) {
             return delegate.toDataDom(data);
         }
 
+        @Override
         public Entry<InstanceIdentifier, CompositeNode> toDataDom(
                 Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject> entry) {
             return delegate.toDataDom(entry);
         }
 
+        @Override
         public InstanceIdentifier toDataDom(
                 org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> path) {
             return delegate.toDataDom(path);
         }
 
+        @Override
         public DataObject dataObjectFromDataDom(
                 org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject> path,
                 CompositeNode result) throws DeserializationException {
             return delegate.dataObjectFromDataDom(path, result);
         }
 
+        @Override
         public org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> fromDataDom(InstanceIdentifier entry)
                 throws DeserializationException {
             return delegate.fromDataDom(entry);
         }
 
+        @Override
         public Set<QName> getRpcQNamesFor(Class<? extends RpcService> service) {
             return delegate.getRpcQNamesFor(service);
         }
 
+        @Override
         public DataContainer dataObjectFromDataDom(Class<? extends DataContainer> inputClass, CompositeNode domInput) {
             return delegate.dataObjectFromDataDom(inputClass, domInput);
         }
index 4f994e5673a2c80896d8c5168af4d0c299ee7bcf..5578f75ae21d6800cf2c73661afa15a071bd6ef8 100644 (file)
@@ -7,29 +7,26 @@
  */
 package org.opendaylight.controller.sal.binding.codegen.impl;
 
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
-import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
-import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper;
-import org.opendaylight.yangtools.yang.binding.BaseIdentity;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import static org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.*;
+import static org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.setRoutingTable;
 
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
-import java.util.HashMap;
 
-import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.yangtools.yang.binding.RpcImplementation;
-import org.opendaylight.controller.md.sal.common.api.routing.MutableRoutingTable;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
+import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,11 +63,11 @@ public class RpcRouterCodegenInstance<T extends RpcService> implements //
         Map<Class<? extends BaseIdentity>, RpcRoutingTableImpl<? extends BaseIdentity, T>> mutableRoutingTables = new HashMap<>();
         for (Class<? extends BaseIdentity> ctx : contexts) {
             RpcRoutingTableImpl<? extends BaseIdentity, T> table = new RpcRoutingTableImpl<>(name,ctx,type);
-            
+
             @SuppressWarnings("rawtypes")
             Map invokerView = table.getRoutes();
-            
-            setRoutingTable((RpcService) invocationProxy, ctx, invokerView);
+
+            setRoutingTable(invocationProxy, ctx, invokerView);
             mutableRoutingTables.put(ctx, table);
             table.registerRouteChangeListener(this);
         }
index 500b1b399e8f38d5d51aa9b70ec14fc76ddd33cb..ce159b8f3ed0974b9e47300e1b0aa8a935596e3a 100644 (file)
@@ -7,24 +7,21 @@
  */
 package org.opendaylight.controller.sal.binding.codegen.impl;
 
-import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
-import org.opendaylight.yangtools.yang.binding.BaseIdentity;
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
 import java.util.Collections;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
+import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
 import org.opendaylight.controller.md.sal.common.impl.routing.RoutingUtils;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Mutable;
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,7 +41,7 @@ implements //
 
     private RouteChangeListener<Class<? extends BaseIdentity>, InstanceIdentifier<?>> listener;
     private S defaultRoute;
-    
+
     public RpcRoutingTableImpl(String routerName,Class<C> contextType, Class<S> serviceType) {
         super();
         this.routerName = routerName;
@@ -67,9 +64,9 @@ implements //
     @Override
     public <L extends RouteChangeListener<Class<? extends BaseIdentity>, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
             L listener) {
-        return (ListenerRegistration<L>) new SingletonListenerRegistration<L>(listener);
+        return new SingletonListenerRegistration<L>(listener);
     }
-        
+
     @Override
     public Class<C> getIdentifier() {
         return contextType;
@@ -79,7 +76,7 @@ implements //
     @SuppressWarnings("unchecked")
     public void updateRoute(InstanceIdentifier<?> path, S service) {
         S previous = this.routes.put(path, service);
-        
+
         LOGGER.debug("Route {} updated to {} in routing table {}",path,service,this);
         @SuppressWarnings("rawtypes")
         RouteChangeListener listenerCapture = listener;
@@ -88,7 +85,7 @@ implements //
         }
     }
 
-    
+
     @Override
     @SuppressWarnings("unchecked")
     public void removeRoute(InstanceIdentifier<?> path) {
@@ -100,7 +97,7 @@ implements //
             listenerCapture.onRouteChange(RoutingUtils.removalChange(contextType, path));
         }
     }
-    
+
     public void removeRoute(InstanceIdentifier<?> path, S service) {
         @SuppressWarnings("rawtypes")
         RouteChangeListener listenerCapture = listener;
@@ -123,12 +120,12 @@ implements //
     public Map<InstanceIdentifier<?>, S> getRoutes() {
         return unmodifiableRoutes;
     }
-    
+
     protected void removeAllReferences(S service) {
-        
+
     }
-    
-    
+
+
 
     @Override
     public String toString() {
index 244e3503439612fb7211dd9307c191e73f048120..291677a79a4fba3a16d27e1929e1fd23e2e14743 100644 (file)
@@ -9,9 +9,10 @@ package org.opendaylight.controller.sal.binding.codegen.impl;
 
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ThreadFactory;
 
+import javassist.ClassPool;
+
 import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
 
@@ -19,8 +20,6 @@ import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 
-import javassist.ClassPool;
-
 public class SingletonHolder {
 
     public static final ClassPool CLASS_POOL = new ClassPool();
index 3cc66c30c10e490d1b652f6357d9b1ef308be3d2..ddf67719dc03f8c9311f565fbf78c98f8ba107cd 100644 (file)
@@ -8,19 +8,18 @@
 package org.opendaylight.controller.sal.binding.impl;\r
 \r
 import java.util.Set;
-import java.util.concurrent.Future;\r
-import java.util.concurrent.atomic.AtomicLong;\r
-\r
-import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataBroker;\r
-import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;\r
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;\r
-import org.opendaylight.controller.sal.binding.impl.util.BindingAwareDataReaderRouter;\r
-import org.opendaylight.controller.sal.common.DataStoreIdentifier;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-import org.opendaylight.yangtools.yang.binding.DataRoot;\r
-import org.opendaylight.yangtools.yang.binding.Identifiable;\r
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
-import org.opendaylight.yangtools.yang.common.RpcResult;\r
+import java.util.concurrent.Future;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataBroker;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.sal.binding.impl.util.BindingAwareDataReaderRouter;
+import org.opendaylight.controller.sal.common.DataStoreIdentifier;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.DataRoot;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
 \r
 \r
 public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? extends DataObject>, DataObject, DataChangeListener> //\r
@@ -28,7 +27,7 @@ public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? exte
 \r
     private final AtomicLong nextTransaction = new AtomicLong();\r
     private final AtomicLong createdTransactionsCount = new AtomicLong();\r
-    \r
+\r
     public AtomicLong getCreatedTransactionsCount() {\r
         return createdTransactionsCount;\r
     }\r
@@ -104,13 +103,12 @@ public class DataBrokerImpl extends AbstractDataBroker<InstanceIdentifier<? exte
             DataChangeListener changeListener) {\r
         throw new UnsupportedOperationException("Deprecated");\r
     }\r
-    \r
+\r
     @Override\r
     public void close() throws Exception {\r
-        \r
+\r
     }
-    
-    
+
     @Override
     protected boolean isAffectedBy(InstanceIdentifier<? extends DataObject> key,
             Set<InstanceIdentifier<? extends DataObject>> paths) {
index 290ff2232f4f50236980486197eded7f52cfefea..1ea2eba87f932a565a7d537b8c41725c6ecfa8b8 100644 (file)
@@ -10,18 +10,17 @@ package org.opendaylight.controller.sal.binding.impl;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.impl.service.AbstractDataTransaction;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction.DataTransactionListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-public class DataTransactionImpl extends AbstractDataTransaction<InstanceIdentifier<? extends DataObject>, DataObject> 
+public class DataTransactionImpl extends AbstractDataTransaction<InstanceIdentifier<? extends DataObject>, DataObject>
     implements DataModificationTransaction {
     private final ListenerRegistry<DataTransactionListener> listeners = new ListenerRegistry<DataTransactionListener>();
-    
-    
-    
+
+
+
     public DataTransactionImpl(Object identifier,DataBrokerImpl dataBroker) {
         super(identifier,dataBroker);
     }
@@ -31,6 +30,7 @@ public class DataTransactionImpl extends AbstractDataTransaction<InstanceIdentif
         return listeners.register(listener);
     }
 
+    @Override
     protected void onStatusChange(TransactionStatus status) {
         for (ListenerRegistration<DataTransactionListener> listenerRegistration : listeners) {
             listenerRegistration.getInstance().onStatusUpdated(this, status);
index f93457110181967063ec64c27a3f29c026320121..e98d5b9942c86afb9b76e006662fe02cdf6147c2 100644 (file)
@@ -7,29 +7,28 @@
  */
 package org.opendaylight.controller.sal.binding.impl;
 
+import static com.google.common.base.Preconditions.checkState;
+
 import java.util.EventListener;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.HashMap;
 import java.util.Set;
 import java.util.WeakHashMap;
 
-import javax.swing.tree.ExpandVetoException;
-
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChange;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
 import org.opendaylight.controller.md.sal.common.impl.routing.RoutingUtils;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
 import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeGenerator;
 import org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper;
 import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder;
-import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.util.ListenerRegistry;
 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
@@ -38,8 +37,6 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static com.google.common.base.Preconditions.*;
-
 public class RpcProviderRegistryImpl implements //
         RpcProviderRegistry, //
         RouteChangePublisher<RpcContextIdentifier, InstanceIdentifier<?>> {
@@ -56,7 +53,7 @@ public class RpcProviderRegistryImpl implements //
 
     private final String name;
 
-    private ListenerRegistry<GlobalRpcRegistrationListener> globalRpcListeners = ListenerRegistry.create();
+    private final ListenerRegistry<GlobalRpcRegistrationListener> globalRpcListeners = ListenerRegistry.create();
 
     public String getName() {
         return name;
@@ -96,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;
@@ -109,7 +105,7 @@ public class RpcProviderRegistryImpl implements //
 
             potentialProxy = (T) publicProxies.get(type);
             if (potentialProxy != null) {
-                return (T) potentialProxy;
+                return potentialProxy;
             }
             T proxy = rpcFactory.getDirectProxyFor(type);
             LOG.debug("Created {} as public proxy for {} in {}", proxy, type.getSimpleName(), this);
@@ -151,10 +147,10 @@ public class RpcProviderRegistryImpl implements //
                 LOG.error("Unhandled exception during invoking listener {}", e);
             }
         }
-        
+
     }
 
-    private void notifyListenersRoutedCreated(RpcRouter router) {
+    private void notifyListenersRoutedCreated(RpcRouter<?> router) {
 
         for (ListenerRegistration<RouterInstantiationListener> listener : routerInstantiationListener) {
             try {
@@ -196,7 +192,7 @@ public class RpcProviderRegistryImpl implements //
     public interface RouterInstantiationListener extends EventListener {
         void onRpcRouterCreated(RpcRouter<?> router);
     }
-    
+
     public ListenerRegistration<GlobalRpcRegistrationListener> registerGlobalRpcRegistrationListener(GlobalRpcRegistrationListener listener) {
         return globalRpcListeners.register(listener);
     }
@@ -204,7 +200,7 @@ public class RpcProviderRegistryImpl implements //
     public interface GlobalRpcRegistrationListener extends EventListener {
         void onGlobalRpcRegistered(Class<? extends RpcService> cls);
         void onGlobalRpcUnregistered(Class<? extends RpcService> cls);
-        
+
     }
 
     private class RouteChangeForwarder<T extends RpcService> implements
index e89797ca2daa2f8267ffeedb7e0f7fecb976d321..8278b365518e2cd62ee400fe14693e7b18cef96a 100644 (file)
@@ -13,19 +13,13 @@ import java.util.concurrent.ConcurrentMap;
 import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.yangtools.concepts.Path;
 
-import com.google.common.util.concurrent.JdkFutureAdapters;
-
 public final class DataModificationTracker<P extends Path<P>,D> {
-
     ConcurrentMap<Object, DataModification<P,D>> trackedTransactions = new ConcurrentHashMap<>();
-    
-    
+
     public void startTrackingModification(DataModification<P,D> modification) {
         trackedTransactions.putIfAbsent(modification.getIdentifier(), modification);
-        
-        
     }
-    
+
     public boolean containsIdentifier(Object identifier) {
         return trackedTransactions.containsKey(identifier);
     }
index 7c38ff2731805d0bf57dc590d588f863da7a307b..6c80f4d7394947cd34af1aa3eedb305dc2f99113 100644 (file)
@@ -10,12 +10,11 @@ package org.opendaylight.controller.sal.binding.test;
 import org.junit.After;
 import org.junit.Before;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
 import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
 import org.opendaylight.controller.sal.core.api.data.DataStore;
 import org.opendaylight.controller.sal.dom.broker.impl.DataStoreStatsWrapper;
-import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore;
+import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMappingService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index 76abd833e9337bba87595956f0d4f82993009d61..4afbc298426e943810f8149a0d17a20ae9e93210 100644 (file)
@@ -7,22 +7,20 @@
  */
 package org.opendaylight.controller.sal.binding.test;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import javassist.ClassPool;
 
 import org.junit.Before;
 import org.junit.Test;
-
-import static org.opendaylight.controller.sal.binding.codegen.RuntimeCodeHelper.*;
-
-import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRouter;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcRoutingTable;
 import org.opendaylight.controller.sal.binding.codegen.impl.RuntimeCodeGenerator;
@@ -30,12 +28,10 @@ import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory.NotificationInvoker;
 import org.opendaylight.controller.sal.binding.test.mock.BarListener;
 import org.opendaylight.controller.sal.binding.test.mock.BarUpdate;
-import org.opendaylight.controller.sal.binding.test.mock.CompositeListener;
 import org.opendaylight.controller.sal.binding.test.mock.FlowDelete;
 import org.opendaylight.controller.sal.binding.test.mock.FooListener;
 import org.opendaylight.controller.sal.binding.test.mock.FooService;
 import org.opendaylight.controller.sal.binding.test.mock.FooUpdate;
-import org.opendaylight.controller.sal.binding.test.mock.InheritedContextInput;
 import org.opendaylight.controller.sal.binding.test.mock.ReferencableObject;
 import org.opendaylight.controller.sal.binding.test.mock.ReferencableObjectKey;
 import org.opendaylight.controller.sal.binding.test.mock.SimpleInput;
@@ -47,8 +43,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
 
-import static org.mockito.Mockito.*;
-
 public class RuntimeCodeGeneratorTest {
 
     private RuntimeCodeGenerator codeGenerator;
@@ -84,7 +78,7 @@ public class RuntimeCodeGeneratorTest {
 
         NotificationInvoker invokerFoo = invokerFactory.invokerFor(fooListener);
 
-        
+
         assertSame(fooListener,invokerFoo.getDelegate());
         assertNotNull(invokerFoo.getSupportedNotifications());
         assertEquals(1, invokerFoo.getSupportedNotifications().size());
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 2b0865ae46e0f01045bf4037a06988a77a057158..e5b57e3668baadb6fbe942364bfb3d920f56772c 100644 (file)
@@ -11,11 +11,6 @@ import java.util.concurrent.ExecutorService;
 
 import javassist.ClassPool;
 
-import org.opendaylight.controller.sal.core.api.data.DataStore;
-import org.opendaylight.controller.sal.dom.broker.impl.DataStoreStatsWrapper;
-import org.opendaylight.controller.sal.dom.broker.impl.HashMapDataStore;
-import org.opendaylight.controller.sal.dom.broker.impl.SchemaAwareDataStoreAdapter;
-
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -27,7 +22,7 @@ public class BindingBrokerTestFactory {
     private ExecutorService executor;
     private ClassPool classPool;
 
-    
+
     public boolean isStartWithParsedSchema() {
         return startWithParsedSchema;
     }
@@ -55,7 +50,7 @@ public class BindingBrokerTestFactory {
         if(classPool == null) {
             return CLASS_POOL;
         }
-        
+
         return classPool;
     }
 
index ec8c8372c1446989f4b1c96477d5e38b1fff76d7..d016754385d1b4ee53e2feb512a75e460b6b37db 100644 (file)
@@ -7,6 +7,10 @@
  */
 package org.opendaylight.controller.sal.binding.test.bugfix;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -15,17 +19,10 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
-
-
-
-
-
-
-
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
@@ -40,15 +37,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -63,8 +58,6 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 
-import static org.junit.Assert.*;
-
 public class DOMCodecBug01Test extends AbstractDataServiceTest {
 
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
@@ -182,7 +175,7 @@ public class DOMCodecBug01Test extends AbstractDataServiceTest {
         flow.setNode(NODE_REF);
         InstructionsBuilder instructions = new InstructionsBuilder();
         InstructionBuilder instruction = new InstructionBuilder();
-        
+
         instruction.setOrder(10);
         ApplyActionsBuilder applyActions = new ApplyActionsBuilder();
         List<Action> actionList = new ArrayList<>();
@@ -204,7 +197,7 @@ public class DOMCodecBug01Test extends AbstractDataServiceTest {
         assertNotNull(ret);
         assertEquals(TransactionStatus.COMMITED, ret.getResult());
     }
-    
+
     private void createFlow2() throws Exception {
         DataModificationTransaction modification = baDataService.beginTransaction();
         long id = 123;
@@ -215,7 +208,7 @@ public class DOMCodecBug01Test extends AbstractDataServiceTest {
         MatchBuilder match = new MatchBuilder();
         match.setLayer4Match(new TcpMatchBuilder().build());
         flow.setMatch(match.build());
-        
+
         path1 = InstanceIdentifier.builder(Flows.class).child(Flow.class, key).toInstance();
        // DataObject cls = (DataObject) modification.readConfigurationData(path1);
         modification.putConfigurationData(path1, flow.build());
index 929eb66350115f025135dc77b5ce1aaf4d103149..9d604406983b5bd3a7bb18b875d626a0d77e697c 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.controller.sal.binding.test.bugfix;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.util.Collections;
 import java.util.Map;
 import java.util.concurrent.Callable;
@@ -16,29 +19,24 @@ import java.util.concurrent.Future;
 
 import javassist.ClassPool;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 
-import static org.junit.Assert.*;
-
 public class DOMCodecBug02Test extends AbstractDataServiceTest {
 
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
@@ -70,10 +68,11 @@ public class DOMCodecBug02Test extends AbstractDataServiceTest {
     /**
      * This test is ignored, till found out better way to test generation
      * of classes without leaking of instances from previous run
-     * 
+     *
      * @throws Exception
      */
-    
+
+    @Override
     public void setUp() {
         ListeningExecutorService executor = MoreExecutors.sameThreadExecutor();
         BindingBrokerTestFactory factory = new BindingBrokerTestFactory();
@@ -82,13 +81,13 @@ public class DOMCodecBug02Test extends AbstractDataServiceTest {
         factory.setStartWithParsedSchema(getStartWithSchema());
         testContext = factory.getTestContext();
         testContext.start();
-        
+
         baDataService = testContext.getBindingDataBroker();
         biDataService = testContext.getDomDataBroker();
         dataStore = testContext.getDomDataStore();
         mappingService = testContext.getBindingToDomMappingService();
     };
-    
+
     @Test
     public void testSchemaContextNotAvailable() throws Exception {
 
@@ -104,11 +103,11 @@ public class DOMCodecBug02Test extends AbstractDataServiceTest {
                 return transaction.commit();
             }
         });
-        
-        
+
+
         RpcResult<TransactionStatus> result = future.get().get();
         assertEquals(TransactionStatus.COMMITED, result.getResult());
-        
+
         Nodes nodes = checkForNodes();
         assertNotNull(nodes);
 
@@ -118,7 +117,7 @@ public class DOMCodecBug02Test extends AbstractDataServiceTest {
         return (Nodes) baDataService.readOperationalData(NODES_INSTANCE_ID_BA);
 
     }
-    
+
     @Override
     protected boolean getStartWithSchema() {
         return false;
index f2576e9960614e74d2889987793b8e3694f1f726..6a050efb35679af9ef283bbef313a09cc92b24d9 100644 (file)
@@ -6,7 +6,11 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 package org.opendaylight.controller.sal.binding.test.bugfix;
-import java.util.Arrays;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -14,35 +18,31 @@ import java.util.Map;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.SupportedActions;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.SupportedActionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.supported.actions.ActionType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.supported.actions.ActionTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.SupportType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.SupportType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
-import static org.junit.Assert.*;
-
 public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataChangeListener {
 
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
@@ -60,15 +60,15 @@ public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataCh
     private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier//
             .builder(NODES_INSTANCE_ID_BA) //
             .child(Node.class, NODE_KEY).toInstance();
-    
-    
+
+
     private static final InstanceIdentifier<SupportedActions> SUPPORTED_ACTIONS_INSTANCE_ID_BA = InstanceIdentifier//
             .builder(NODES_INSTANCE_ID_BA) //
             .child(Node.class, NODE_KEY) //
             .augmentation(FlowCapableNode.class) //
             .child(SupportedActions.class)
             .toInstance();
-    
+
 
     private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
     org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
@@ -77,35 +77,35 @@ public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataCh
             .toInstance();
     private static final QName SUPPORTED_ACTIONS_QNAME = QName.create(FlowCapableNode.QNAME, SupportedActions.QNAME.getLocalName());
 
-    
+
     private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier SUPPORTED_ACTIONS_INSTANCE_ID_BI = //
             org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
                     .node(Nodes.QNAME) //
                     .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
                     .node(SUPPORTED_ACTIONS_QNAME) //
                     .toInstance();
-    
+
     private DataChangeEvent<InstanceIdentifier<?>, DataObject> receivedChangeEvent;
 
-    
-    
+
+
     /**
      * Test for Bug 148
-     * 
+     *
      * @throws Exception
      */
     @Test
     public void testAugmentSerialization() throws Exception {
 
-        
+
         baDataService.registerDataChangeListener(NODES_INSTANCE_ID_BA, this);
-        
+
         NodeBuilder nodeBuilder = new NodeBuilder();
         nodeBuilder.setId(new NodeId(NODE_ID));
         nodeBuilder.setKey(NODE_KEY);
         DataModificationTransaction transaction = baDataService.beginTransaction();
-        
-        
+
+
         FlowCapableNodeBuilder fnub = new FlowCapableNodeBuilder();
         fnub.setHardware("Hardware Foo");
         fnub.setManufacturer("Manufacturer Foo");
@@ -116,47 +116,47 @@ public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataCh
         nodeBuilder.addAugmentation(FlowCapableNode.class, fnu);
         Node original = nodeBuilder.build();
         transaction.putOperationalData(NODE_INSTANCE_ID_BA, original);
-        
+
         RpcResult<TransactionStatus> result = transaction.commit().get();
         assertEquals(TransactionStatus.COMMITED, result.getResult());
-        
+
         assertNotNull(receivedChangeEvent);
-        
+
         verifyNodes((Nodes) receivedChangeEvent.getUpdatedOperationalSubtree(),original);
         assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
         Nodes nodes = checkForNodes();
         verifyNodes(nodes,original);
-        
+
         testAddingNodeConnector();
         testNodeRemove();
 
     }
-    
+
     @Test
     public void testAugmentNestedSerialization() throws Exception {
         DataModificationTransaction transaction = baDataService.beginTransaction();
-        
+
         SupportedActionsBuilder actions = new SupportedActionsBuilder();
         ActionTypeBuilder action = new ActionTypeBuilder();
         action.setAction("foo-action");
         action.setSupportState(SupportType.Native);
         List<ActionType> actionTypes = Collections.singletonList(action.build());
         actions.setActionType(actionTypes );
-        
+
         transaction.putOperationalData(SUPPORTED_ACTIONS_INSTANCE_ID_BA, actions.build());
         RpcResult<TransactionStatus> putResult = transaction.commit().get();
         assertNotNull(putResult);
         assertEquals(TransactionStatus.COMMITED, putResult.getResult());
         SupportedActions readedTable = (SupportedActions) baDataService.readOperationalData(SUPPORTED_ACTIONS_INSTANCE_ID_BA);
         assertNotNull(readedTable);
-        
+
         CompositeNode biSupportedActions = biDataService.readOperationalData(SUPPORTED_ACTIONS_INSTANCE_ID_BI);
         assertNotNull(biSupportedActions);
-        
+
     }
 
     private void testAddingNodeConnector() throws Exception {
-        
+
         NodeConnectorId ncId = new NodeConnectorId("openflow:1:bar");
         NodeConnectorKey nodeKey = new NodeConnectorKey(ncId );
         InstanceIdentifier<NodeConnector> ncInstanceId = InstanceIdentifier.builder(NODE_INSTANCE_ID_BA).child(NodeConnector.class, nodeKey).toInstance();
@@ -181,7 +181,7 @@ public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataCh
         transaction.removeOperationalData(NODE_INSTANCE_ID_BA);
         RpcResult<TransactionStatus> result = transaction.commit().get();
         assertEquals(TransactionStatus.COMMITED, result.getResult());
-        
+
         Node node = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
         assertNull(node);
     }
@@ -193,13 +193,13 @@ public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataCh
         Node readedNode = nodes.getNode().get(0);
         assertEquals(original.getId(), readedNode.getId());
         assertEquals(original.getKey(), readedNode.getKey());
-        
+
         FlowCapableNode fnu = original.getAugmentation(FlowCapableNode.class);
         FlowCapableNode readedAugment = readedNode.getAugmentation(FlowCapableNode.class);
         assertNotNull(fnu);
         assertEquals(fnu.getDescription(), readedAugment.getDescription());
         assertEquals(fnu.getSerialNumber(), readedAugment.getSerialNumber());
-        
+
     }
 
     private void assertBindingIndependentVersion(
@@ -211,7 +211,7 @@ public class DOMCodecBug03Test extends AbstractDataServiceTest implements DataCh
     private Nodes checkForNodes() {
         return (Nodes) baDataService.readOperationalData(NODES_INSTANCE_ID_BA);
     }
-    
+
     @Override
     public void onDataChanged(DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
         receivedChangeEvent = change;
index 8003e37e4e193f1685c3f0cc452e85b257140831..598743af90337cdf2baad9194bcdd0020f6f0d04 100644 (file)
@@ -6,46 +6,39 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 package org.opendaylight.controller.sal.binding.test.bugfix;
-import java.util.Arrays;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 import java.util.Collections;
-import java.util.List;
 import java.util.Map;
 
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
-import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnectorBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.SupportedActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.SupportedActionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.supported.actions.ActionType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.supported.actions.ActionTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.SupportType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 
-import static org.junit.Assert.*;
-
 public class PutAugmentationTest extends AbstractDataServiceTest implements DataChangeListener {
 
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
@@ -63,15 +56,15 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
     private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier//
             .builder(NODES_INSTANCE_ID_BA) //
             .child(Node.class, NODE_KEY).toInstance();
-    
-    
+
+
     private static final InstanceIdentifier<SupportedActions> SUPPORTED_ACTIONS_INSTANCE_ID_BA = InstanceIdentifier//
             .builder(NODES_INSTANCE_ID_BA) //
             .child(Node.class, NODE_KEY) //
             .augmentation(FlowCapableNode.class) //
             .child(SupportedActions.class)
             .toInstance();
-    
+
 
     private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
     org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
@@ -80,28 +73,28 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
             .toInstance();
     private static final QName SUPPORTED_ACTIONS_QNAME = QName.create(FlowCapableNode.QNAME, SupportedActions.QNAME.getLocalName());
 
-    
+
     private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier SUPPORTED_ACTIONS_INSTANCE_ID_BI = //
             org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
                     .node(Nodes.QNAME) //
                     .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
                     .node(SUPPORTED_ACTIONS_QNAME) //
                     .toInstance();
-    
+
     private DataChangeEvent<InstanceIdentifier<?>, DataObject> receivedChangeEvent;
 
-    
-    
+
+
     /**
      * Test for Bug 148
-     * 
+     *
      * @throws Exception
      */
     @Test
     public void putNodeAndAugmentation() throws Exception {
 
         baDataService.registerDataChangeListener(NODES_INSTANCE_ID_BA, this);
-        
+
         NodeBuilder nodeBuilder = new NodeBuilder();
         nodeBuilder.setId(new NodeId(NODE_ID));
         nodeBuilder.setKey(NODE_KEY);
@@ -113,7 +106,7 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
         Node node = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
         assertNotNull(node);
         assertEquals(NODE_KEY, node.getKey());
-        
+
         FlowCapableNodeBuilder fnub = new FlowCapableNodeBuilder();
         fnub.setHardware("Hardware Foo");
         fnub.setManufacturer("Manufacturer Foo");
@@ -124,11 +117,11 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
         InstanceIdentifier<FlowCapableNode> augmentIdentifier = InstanceIdentifier.builder(NODE_INSTANCE_ID_BA).augmentation(FlowCapableNode.class).toInstance();
         DataModificationTransaction augmentedTransaction = baDataService.beginTransaction();
         augmentedTransaction.putOperationalData(augmentIdentifier, fnu);
-        
+
         result = augmentedTransaction.commit().get();
         assertEquals(TransactionStatus.COMMITED, result.getResult());
-        
-        
+
+
         Node augmentedNode = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
         assertNotNull(node);
         assertEquals(NODE_KEY, augmentedNode.getKey());
@@ -139,10 +132,10 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
         assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
         testNodeRemove();
     }
-    
+
     @Test
     public void putNodeWithAugmentation() throws Exception {
-        
+
         NodeBuilder nodeBuilder = new NodeBuilder();
         nodeBuilder.setId(new NodeId(NODE_ID));
         nodeBuilder.setKey(NODE_KEY);
@@ -153,41 +146,41 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
         fnub.setDescription("Description Foo");
         fnub.setSoftware("JUnit emulated");
         FlowCapableNode fnu = fnub.build();
-        
+
         nodeBuilder.addAugmentation(FlowCapableNode.class, fnu);
         DataModificationTransaction baseTransaction = baDataService.beginTransaction();
         baseTransaction.putOperationalData(NODE_INSTANCE_ID_BA, nodeBuilder.build());
         RpcResult<TransactionStatus> result = baseTransaction.commit().get();
         assertEquals(TransactionStatus.COMMITED, result.getResult());
-        
+
         FlowCapableNode readedAugmentation = (FlowCapableNode) baDataService.readOperationalData(InstanceIdentifier.builder(NODE_INSTANCE_ID_BA).augmentation(FlowCapableNode.class).toInstance());
         assertNotNull(readedAugmentation);
         assertEquals(fnu.getHardware(), readedAugmentation.getHardware());
-        
+
         testPutNodeConnectorWithAugmentation();
         testNodeRemove();
     }
 
-    
+
     private void testPutNodeConnectorWithAugmentation() throws Exception {
         NodeConnectorKey ncKey = new NodeConnectorKey(new NodeConnectorId("test:0:0"));
         InstanceIdentifier<NodeConnector> ncPath = InstanceIdentifier.builder(NODE_INSTANCE_ID_BA)
         .child(NodeConnector.class, ncKey).toInstance();
         InstanceIdentifier<FlowCapableNodeConnector> ncAugmentPath = InstanceIdentifier.builder(ncPath)
         .augmentation(FlowCapableNodeConnector.class).toInstance();
-        
+
         NodeConnectorBuilder nc = new NodeConnectorBuilder();
         nc.setKey(ncKey);
-        
+
         FlowCapableNodeConnectorBuilder fncb = new FlowCapableNodeConnectorBuilder();
         fncb.setName("Baz");
         nc.addAugmentation(FlowCapableNodeConnector.class, fncb.build());
-        
+
         DataModificationTransaction baseTransaction = baDataService.beginTransaction();
         baseTransaction.putOperationalData(ncPath, nc.build());
         RpcResult<TransactionStatus> result = baseTransaction.commit().get();
         assertEquals(TransactionStatus.COMMITED, result.getResult());
-        
+
         FlowCapableNodeConnector readedAugmentation = (FlowCapableNodeConnector) baDataService.readOperationalData(ncAugmentPath);
         assertNotNull(readedAugmentation);
         assertEquals(fncb.getName(), readedAugmentation.getName());
@@ -198,7 +191,7 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
         transaction.removeOperationalData(NODE_INSTANCE_ID_BA);
         RpcResult<TransactionStatus> result = transaction.commit().get();
         assertEquals(TransactionStatus.COMMITED, result.getResult());
-        
+
         Node node = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
         assertNull(node);
     }
@@ -210,13 +203,13 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
         Node readedNode = nodes.getNode().get(0);
         assertEquals(original.getId(), readedNode.getId());
         assertEquals(original.getKey(), readedNode.getKey());
-        
+
         FlowCapableNode fnu = original.getAugmentation(FlowCapableNode.class);
         FlowCapableNode readedAugment = readedNode.getAugmentation(FlowCapableNode.class);
         assertNotNull(fnu);
         assertEquals(fnu.getDescription(), readedAugment.getDescription());
         assertEquals(fnu.getSerialNumber(), readedAugment.getSerialNumber());
-        
+
     }
 
     private void assertBindingIndependentVersion(
@@ -228,7 +221,7 @@ public class PutAugmentationTest extends AbstractDataServiceTest implements Data
     private Nodes checkForNodes() {
         return (Nodes) baDataService.readOperationalData(NODES_INSTANCE_ID_BA);
     }
-    
+
     @Override
     public void onDataChanged(DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
         receivedChangeEvent = change;
index ab86836f95c56dc3212bc77dd7b7365b89dee337..63094ef3cb207ea1a99de3f1024f60b5b0a8781a 100644 (file)
@@ -14,11 +14,8 @@ import java.math.BigInteger;
 import java.util.Collections;
 import java.util.Map;
 
-import javax.management.Notification;
-
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.controller.md.sal.common.api.data.DataReader;
 import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
 import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
@@ -27,11 +24,8 @@ import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
@@ -42,14 +36,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.data.impl.ImmutableCompositeNode;
-import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
 
-import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.MoreExecutors;
 
 public class CrossBrokerMountPointTest {
@@ -127,8 +118,8 @@ public class CrossBrokerMountPointTest {
         assertNotNull(bindingMountPoint);
 
         final BigInteger packetCount = BigInteger.valueOf(500L);
-        
-        
+
+
         DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode> simpleReader = new DataReader<org.opendaylight.yangtools.yang.data.api.InstanceIdentifier, CompositeNode>() {
 
             @Override
@@ -136,7 +127,7 @@ public class CrossBrokerMountPointTest {
                 return null;
             }
 
-            
+
             @Override
             public CompositeNode readOperationalData(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier arg0) {
                 if (arg0.equals(GROUP_STATISTICS_ID_BI)) {
@@ -153,7 +144,7 @@ public class CrossBrokerMountPointTest {
 
         };
         domMountPoint.registerOperationalReader(NODE_INSTANCE_ID_BI, simpleReader);
-        
+
         GroupStatistics data = (GroupStatistics) bindingMountPoint.readOperationalData(GROUP_STATISTICS_ID_BA);
         assertNotNull(data);
         assertEquals(packetCount,data.getPacketCount().getValue());
index 3c5efa5e3af11a44b73fb2fbec2188ef8e7f1340..4e4416777b8eaed7f48aa1ddbb102a3a2b6c84ec 100644 (file)
@@ -10,8 +10,6 @@ package org.opendaylight.controller.test.sal.binding.it;
 import static org.ops4j.pax.exam.CoreOptions.frameworkProperty;
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.repository;
-import static org.ops4j.pax.exam.CoreOptions.repositories;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 
 import org.ops4j.pax.exam.Option;
@@ -91,9 +89,9 @@ public class TestHelper {
     public static Option bindingAwareSalBundles() {
         return new DefaultCompositeOption( //
                 mdSalCoreBundles(),
-                
+
                 mavenBundle("org.javassist", "javassist").versionAsInProject(), // //
-                
+
                 mavenBundle(YANGTOOLS, "yang-data-api").versionAsInProject(), // //
                 mavenBundle(YANGTOOLS, "yang-data-impl").versionAsInProject(), // //
                 mavenBundle(YANGTOOLS, "yang-model-api").versionAsInProject(), // //
@@ -109,7 +107,7 @@ public class TestHelper {
                         "binding-generator-spi").versionAsInProject(), //
                 mavenBundle(YANGTOOLS, "binding-generator-impl").versionAsInProject(),
                 mavenBundle(YANGTOOLS + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject(), // //
-                
+
                 mavenBundle(CONTROLLER, "sal-core-api").versionAsInProject().update(), //
                 mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(), // //
                 mavenBundle(CONTROLLER, "sal-binding-config").versionAsInProject(), //
@@ -118,7 +116,7 @@ public class TestHelper {
                 mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject(), // //
 
 
-                
+
                 mavenBundle(CONTROLLER, "sal-broker-impl").versionAsInProject(), // //
                 mavenBundle(CONTROLLER, "sal-core-spi").versionAsInProject().update(), //
 
index 2aa7493e45bf5efe830fd383994c7c770596d75d..da47b174f14c01400dd556ac95ea8da8d8c8fc22 100644 (file)
@@ -11,7 +11,6 @@ import java.util.Collection;
 import java.util.Collections;
 
 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.BindingAwareProvider;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
index a55e395c5bf065f53c69dbc4afed81149e36bacc..b23ceaaf15b69c0bed04977b97e3bcefb7eab50a 100644 (file)
@@ -19,7 +19,6 @@ import org.junit.Before;
 import org.junit.Test;
 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.BindingAwareProvider.ProviderFunctionality;
 import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
@@ -38,8 +37,8 @@ import org.opendaylight.yangtools.yang.binding.RpcService;
 
 public class NoficationTest extends AbstractTest {
 
-    private FlowListener listener1 = new FlowListener();
-    private FlowListener listener2 = new FlowListener();
+    private final FlowListener listener1 = new FlowListener();
+    private final FlowListener listener2 = new FlowListener();
 
     private Registration<NotificationListener> listener1Reg;
     private Registration<NotificationListener> listener2Reg;
@@ -53,9 +52,9 @@ public class NoficationTest extends AbstractTest {
     @Test
     public void notificationTest() throws Exception {
         /**
-         * 
+         *
          * The registration of the Provider 1.
-         * 
+         *
          */
         AbstractTestProvider provider1 = new AbstractTestProvider() {
             @Override
@@ -69,10 +68,10 @@ public class NoficationTest extends AbstractTest {
         assertNotNull(notifyProviderService);
 
         /**
-         * 
+         *
          * The registration of the Consumer 1. It retrieves Notification Service
          * from MD-SAL and registers SalFlowListener as notification listener
-         * 
+         *
          */
         BindingAwareConsumer consumer1 = new BindingAwareConsumer() {
             @Override
@@ -97,7 +96,7 @@ public class NoficationTest extends AbstractTest {
 
         /**
          * Check that one notification was delivered and has correct cookie.
-         * 
+         *
          */
         assertEquals(1, listener1.addedFlows.size());
         assertEquals(0, listener1.addedFlows.get(0).getCookie().intValue());
@@ -107,31 +106,31 @@ public class NoficationTest extends AbstractTest {
          * registered as notification listener.
          */
         BindingAwareProvider provider = new BindingAwareProvider() {
-            
+
             @Override
             public void onSessionInitiated(ProviderContext session) {
                 listener2Reg = session.getSALService(NotificationProviderService.class).registerNotificationListener(
                         listener2);
             }
-            
+
             @Override
             public void onSessionInitialized(ConsumerContext session) {
                 // TODO Auto-generated method stub
-                
+
             }
-            
+
             @Override
             public Collection<? extends RpcService> getImplementations() {
                 // TODO Auto-generated method stub
                 return null;
             }
-            
+
             @Override
             public Collection<? extends ProviderFunctionality> getFunctionality() {
                 // TODO Auto-generated method stub
                 return null;
             }
-            
+
         };
 
         // registerConsumer method calls onSessionInitialized method above
@@ -153,19 +152,19 @@ public class NoficationTest extends AbstractTest {
         /**
          * Check that 3 notification was delivered to both listeners (first one
          * received 4 in total, second 3 in total).
-         * 
+         *
          */
         assertEquals(4, listener1.addedFlows.size());
         assertEquals(3, listener2.addedFlows.size());
 
         /**
          * The second listener is closed (unregistered)
-         * 
+         *
          */
         listener2Reg.close();
 
         /**
-         * 
+         *
          * The notification 5 is published
          */
         notifyProviderService.publish(flowAdded(10));
@@ -180,7 +179,7 @@ public class NoficationTest extends AbstractTest {
          * Check that first consumer received 5 notifications in total, second
          * consumer received only three. Last notification was never received by
          * second consumer because its listener was unregistered.
-         * 
+         *
          */
         assertEquals(5, listener1.addedFlows.size());
         assertEquals(3, listener2.addedFlows.size());
@@ -190,7 +189,7 @@ public class NoficationTest extends AbstractTest {
     /**
      * Creates instance of the type FlowAdded. Only cookie value is set. It is
      * used only for testing purpose.
-     * 
+     *
      * @param i
      *            cookie value
      * @return instance of the type FlowAdded
@@ -202,7 +201,7 @@ public class NoficationTest extends AbstractTest {
     }
 
     /**
-     * 
+     *
      * Implements
      * {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener
      * SalFlowListener} and contains attributes which keep lists of objects of
@@ -225,7 +224,7 @@ public class NoficationTest extends AbstractTest {
         @Override
         public void onFlowRemoved(FlowRemoved notification) {
             removedFlows.add(notification);
-        }; 
+        };
 
         @Override
         public void onFlowUpdated(FlowUpdated notification) {
@@ -235,20 +234,20 @@ public class NoficationTest extends AbstractTest {
         @Override
         public void onSwitchFlowRemoved(SwitchFlowRemoved notification) {
             // TODO Auto-generated method stub
-            
+
         }
 
         @Override
         public void onNodeErrorNotification(NodeErrorNotification notification) {
             // TODO Auto-generated method stub
-            
+
         }
 
         @Override
         public void onNodeExperimenterErrorNotification(
                 NodeExperimenterErrorNotification notification) {
             // TODO Auto-generated method stub
-            
+
         }
 
     }
index 8c81987301651caf3427ff6f92215ca39d0e6217..befe70376468eef0d9687817268c312638698506 100644 (file)
@@ -15,7 +15,6 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
 import java.math.BigInteger;
-import java.util.concurrent.Future;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -26,9 +25,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
@@ -36,7 +33,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 
 public class RoutedServiceTest extends AbstractTest {
 
@@ -71,7 +67,7 @@ public class RoutedServiceTest extends AbstractTest {
         /**
          * Register provider 1 with first implementation of SalFlowService -
          * service1
-         * 
+         *
          */
         broker.registerProvider(provider1, getBundleContext());
         assertNotNull("Registration should not be null", firstReg);
@@ -89,7 +85,7 @@ public class RoutedServiceTest extends AbstractTest {
         /**
          * Register provider 2 with first implementation of SalFlowService -
          * service2
-         * 
+         *
          */
         broker.registerProvider(provider2, getBundleContext());
         assertNotNull("Registration should not be null", firstReg);
@@ -117,7 +113,7 @@ public class RoutedServiceTest extends AbstractTest {
         /**
          * Consumer creates addFlow message for node one and sends it to the
          * MD-SAL
-         * 
+         *
          */
         AddFlowInput addFlowFirstMessage = createSampleAddFlow(nodeOne, 1);
         consumerService.addFlow(addFlowFirstMessage);
@@ -125,19 +121,19 @@ public class RoutedServiceTest extends AbstractTest {
         /**
          * Verifies that implementation of the first provider received the same
          * message from MD-SAL.
-         * 
+         *
          */
         verify(salFlowService1).addFlow(addFlowFirstMessage);
 
         /**
          * Verifies that second instance was not invoked with first message
-         * 
+         *
          */
         verify(salFlowService2, times(0)).addFlow(addFlowFirstMessage);
 
         /**
          * Provider 2 registers path of node 2
-         * 
+         *
          */
         NodeRef nodeTwo = createNodeRef("foo:node:2");
         secondReg.registerPath(NodeContext.class, nodeTwo.getValue());
@@ -154,26 +150,26 @@ public class RoutedServiceTest extends AbstractTest {
         /**
          * Verifies that second instance was invoked 3 times with second message
          * and first instance wasn't invoked.
-         * 
+         *
          */
         verify(salFlowService2, times(3)).addFlow(AddFlowSecondMessage);
         verify(salFlowService1, times(0)).addFlow(AddFlowSecondMessage);
 
         /**
          * Unregisteration of the path for the node one in the first provider
-         * 
+         *
          */
         firstReg.unregisterPath(NodeContext.class, nodeOne.getValue());
 
         /**
          * Provider 2 registers path of node 1
-         * 
+         *
          */
         secondReg.registerPath(NodeContext.class, nodeOne.getValue());
 
         /**
          * A consumer sends third message to node 1
-         * 
+         *
          */
         AddFlowInput AddFlowThirdMessage = createSampleAddFlow(nodeOne, 3);
         consumerService.addFlow(AddFlowThirdMessage);
@@ -189,7 +185,7 @@ public class RoutedServiceTest extends AbstractTest {
 
     /**
      * Returns node reference from string which represents path
-     * 
+     *
      * @param string
      *            string with key(path)
      * @return instance of the type NodeRef
@@ -204,7 +200,7 @@ public class RoutedServiceTest extends AbstractTest {
 
     /**
      * Creates flow AddFlowInput for which only node and cookie are set
-     * 
+     *
      * @param node
      *            NodeRef value
      * @param cookie
index 0c562f5d3344f58b1ea9ff9426c5c701632a8502..77b411002b01e480bca055c7507ef59c0915d834 100644 (file)
@@ -8,20 +8,14 @@
 package org.opendaylight.controller.md.sal.binding.util;
 
 import java.util.concurrent.Future;
-import java.util.zip.Checksum;
 
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
 import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.binding.api.mount.MountInstance;
 import org.opendaylight.controller.sal.common.DataStoreIdentifier;
-import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -54,7 +48,7 @@ public abstract class AbstractBindingSalConsumerInstance<D extends DataBrokerSer
     protected final D getDataBroker() {
         return dataBroker;
     }
-    
+
     protected final R getRpcRegistryChecked() {
         Preconditions.checkState(rpcRegistry != null,"Rpc Registry is not available.");
         return rpcRegistry;
@@ -69,7 +63,7 @@ public abstract class AbstractBindingSalConsumerInstance<D extends DataBrokerSer
         Preconditions.checkState(dataBroker != null, "Data Broker is not available");
         return dataBroker;
     }
-    
+
 
     protected AbstractBindingSalConsumerInstance(R rpcRegistry, N notificationBroker, D dataBroker) {
         this.rpcRegistry = rpcRegistry;
@@ -77,106 +71,127 @@ public abstract class AbstractBindingSalConsumerInstance<D extends DataBrokerSer
         this.dataBroker = dataBroker;
     }
 
+    @Override
     public <T extends RpcService> T getRpcService(Class<T> module) {
         return getRpcRegistryChecked().getRpcService(module);
     }
 
+    @Override
     @Deprecated
     public <T extends Notification> void addNotificationListener(Class<T> notificationType,
             NotificationListener<T> listener) {
         getNotificationBrokerChecked().addNotificationListener(notificationType, listener);
     }
 
+    @Override
     @Deprecated
     public void addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
         getNotificationBrokerChecked().addNotificationListener(listener);
     }
 
+    @Override
     @Deprecated
     public void removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
         getNotificationBrokerChecked().removeNotificationListener(listener);
     }
 
+    @Override
     @Deprecated
     public <T extends Notification> void removeNotificationListener(Class<T> notificationType,
             NotificationListener<T> listener) {
         getNotificationBrokerChecked().removeNotificationListener(notificationType, listener);
     }
 
+    @Override
     public <T extends Notification> Registration<NotificationListener<T>> registerNotificationListener(
             Class<T> notificationType, NotificationListener<T> listener) {
         return getNotificationBrokerChecked().registerNotificationListener(notificationType, listener);
     }
 
+    @Override
     public Registration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(
             org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
         return getNotificationBrokerChecked().registerNotificationListener(listener);
     }
 
+    @Override
     @Deprecated
     public <T extends DataRoot> T getData(DataStoreIdentifier store, Class<T> rootType) {
         return getDataBrokerChecked().getData(store, rootType);
     }
 
+    @Override
     @Deprecated
     public <T extends DataRoot> T getData(DataStoreIdentifier store, T filter) {
         return getDataBrokerChecked().getData(store, filter);
     }
 
+    @Override
     @Deprecated
     public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, Class<T> rootType) {
         return getDataBrokerChecked().getCandidateData(store, rootType);
     }
 
+    @Override
     @Deprecated
     public <T extends DataRoot> T getCandidateData(DataStoreIdentifier store, T filter) {
         return getDataBrokerChecked().getCandidateData(store, filter);
     }
 
+    @Override
     @Deprecated
     public RpcResult<DataRoot> editCandidateData(DataStoreIdentifier store, DataRoot changeSet) {
         return getDataBrokerChecked().editCandidateData(store, changeSet);
     }
 
+    @Override
     @Deprecated
     public Future<RpcResult<Void>> commit(DataStoreIdentifier store) {
         return getDataBrokerChecked().commit(store);
     }
 
+    @Override
     @Deprecated
     public DataObject getData(InstanceIdentifier<? extends DataObject> data) {
         return getDataBrokerChecked().getData(data);
     }
 
+    @Override
     @Deprecated
     public DataObject getConfigurationData(InstanceIdentifier<?> data) {
         return getDataBrokerChecked().getConfigurationData(data);
     }
 
+    @Override
     public DataModificationTransaction beginTransaction() {
         return getDataBrokerChecked().beginTransaction();
     }
 
+    @Override
     @Deprecated
     public void registerChangeListener(InstanceIdentifier<? extends DataObject> path, DataChangeListener changeListener) {
         getDataBrokerChecked().registerChangeListener(path, changeListener);
     }
 
+    @Override
     @Deprecated
     public void unregisterChangeListener(InstanceIdentifier<? extends DataObject> path,
             DataChangeListener changeListener) {
         getDataBrokerChecked().unregisterChangeListener(path, changeListener);
     }
 
+    @Override
     @Deprecated
     public DataObject readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
         return getDataBrokerChecked().readConfigurationData(path);
     }
 
+    @Override
     public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path) {
         return getDataBrokerChecked().readOperationalData(path);
     }
 
+    @Override
     @Deprecated
     public ListenerRegistration<DataChangeListener> registerDataChangeListener(
             InstanceIdentifier<? extends DataObject> path, DataChangeListener listener) {
index c7d6640ce1eb6c53df124c5338290519f4843e14..efa02e0b301303d9a3444771f15afe4df64d1ec0 100644 (file)
@@ -19,7 +19,6 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistr
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
@@ -99,7 +98,7 @@ public abstract class AbstractBindingSalProviderInstance<D extends DataProviderS
             L listener) {
         return getRpcRegistryChecked().registerRouteChangeListener(listener);
     }
-    
+
     @Override
     public ListenerRegistration<NotificationInterestListener> registerInterestListener(
             NotificationInterestListener interestListener) {
index d164f82222bb50781ca854b2c5a661791468c1a6..dc22891b471dc2aaa623f096e21395099f0d7328 100644 (file)
@@ -7,26 +7,24 @@
  */
 package org.opendaylight.controller.md.sal.binding.util;
 
-import java.awt.image.SinglePixelPackedSampleModel;
+import static com.google.common.base.Preconditions.checkNotNull;
 
 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
 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.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
-import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
-import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
 import org.opendaylight.controller.sal.binding.api.BindingAwareService;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-import static com.google.common.base.Preconditions.*;
-
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.MutableClassToInstanceMap;
 
@@ -38,7 +36,7 @@ public class BindingContextUtils {
         checkNotNull(serviceProvider,"Service map should not be null");
         return new SingleConsumerContextImpl(serviceProvider);
     }
-    
+
     public static ProviderContext createProviderContext(BindingAwareProvider provider,
             ClassToInstanceMap<BindingAwareService> serviceProvider) {
         checkNotNull(provider,"Provider should not be null");
@@ -52,7 +50,7 @@ public class BindingContextUtils {
         consumer.onSessionInitialized(context);
         return context;
     }
-    
+
     public static ProviderContext createProviderContextAndInitialize(BindingAwareProvider provider,
             ClassToInstanceMap<BindingAwareService> serviceProvider) {
         ProviderContext context = createProviderContext(provider, serviceProvider);
@@ -64,9 +62,9 @@ public class BindingContextUtils {
         // FIXME: Create Proxy
         return instance;
     }
-    
+
     private static class SingleConsumerContextImpl implements ConsumerContext, AutoCloseable {
-        
+
         private ClassToInstanceMap<BindingAwareService> alreadyRetrievedServices;
         private ClassToInstanceMap<BindingAwareService> serviceProvider;
 
@@ -79,7 +77,7 @@ public class BindingContextUtils {
         public final <T extends RpcService> T getRpcService(Class<T> module) {
             return getSALService(RpcConsumerRegistry.class).getRpcService(module);
         }
-        
+
         @Override
         public final <T extends BindingAwareService> T getSALService(Class<T> service) {
             checkNotNull(service,"Service class should not be null.");
@@ -89,7 +87,7 @@ public class BindingContextUtils {
             }
             return tryToRetrieveSalService(service);
         }
-        
+
         private synchronized <T extends BindingAwareService> T tryToRetrieveSalService(Class<T> service) {
             final T potential = alreadyRetrievedServices.getInstance(service);
             if(potential != null) {
@@ -103,44 +101,44 @@ public class BindingContextUtils {
             alreadyRetrievedServices.put(service, retrieved);
             return retrieved;
         }
-        
+
         @Override
         public final void close() throws Exception {
             alreadyRetrievedServices = null;
             serviceProvider = null;
         }
     }
-    
+
     private static class SingleProviderContextImpl extends SingleConsumerContextImpl implements ProviderContext {
 
         public SingleProviderContextImpl(ClassToInstanceMap<BindingAwareService> serviceProvider) {
             super(serviceProvider);
         }
-        
+
         @Override
         public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
                 L listener) {
             return getSALService(RpcProviderRegistry.class).registerRouteChangeListener(listener);
         }
-        
+
         @Override
         public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type,
                 T implementation) throws IllegalStateException {
             return getSALService(RpcProviderRegistry.class).addRoutedRpcImplementation(type, implementation);
         }
-        
+
         @Override
         public <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
                 throws IllegalStateException {
             return getSALService(RpcProviderRegistry.class).addRpcImplementation(type, implementation);
         }
-        
+
         @Deprecated
         @Override
         public void registerFunctionality(ProviderFunctionality functionality) {
             // NOOP
         }
-        
+
         @Deprecated
         @Override
         public void unregisterFunctionality(ProviderFunctionality functionality) {
index 1700411df8072c3f3ca331661323a1aedf971312..66645e5538d6efb0935231100c0a72890ed09a70 100644 (file)
@@ -9,10 +9,9 @@ package org.opendaylight.controller.md.sal.common.api.data;
 
 
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
+
 // FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
 // import org.opendaylight.yangtools.concepts.Path;
-import org.opendaylight.yangtools.concepts.Registration;
-
 public interface DataChangePublisher<P/* extends Path<P> */,D, L extends DataChangeListener<P,D>> {
 
     ListenerRegistration<L> registerDataChangeListener(P path, L listener);
index 29ba192ba821294ceff36aa8de3b83a445edce16..00db6064aa3bb54fa2a1f123be45d67289e63c52 100644 (file)
@@ -7,20 +7,18 @@
  */
 package org.opendaylight.controller.md.sal.common.api.data;
 
-import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-// FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
-// import org.opendaylight.yangtools.concepts.Path;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
+//FIXME: After 0.6 Release of YANGTools refactor to use Path marker interface for arguments.
+//import org.opendaylight.yangtools.concepts.Path;
 public interface DataModification<P/* extends Path<P> */, D> extends DataChange<P, D>, DataReader<P, D> {
 
     /**
      * Returns transaction identifier
-     * 
+     *
      * @return Transaction identifier
      */
     Object getIdentifier();
@@ -28,9 +26,9 @@ public interface DataModification<P/* extends Path<P> */, D> extends DataChange<
     TransactionStatus getStatus();
 
     /**
-     * 
+     *
      * @deprecated Use {@link #putOperationalData(Object, Object)} instead.
-     * 
+     *
      * @param path
      * @param data
      */
@@ -81,7 +79,7 @@ public interface DataModification<P/* extends Path<P> */, D> extends DataChange<
 
     /**
      * @deprecated Use {@link #removeOperationalData(Object)}
-     * 
+     *
      * @param path
      */
     @Deprecated
@@ -93,18 +91,18 @@ public interface DataModification<P/* extends Path<P> */, D> extends DataChange<
 
     /**
      * Initiates a two-phase commit of modification.
-     * 
+     *
      * <p>
      * The successful commit changes the state of the system and may affect
      * several components.
-     * 
+     *
      * <p>
      * The effects of successful commit of data are described in the
      * specifications and YANG models describing the Provider components of
      * controller. It is assumed that Consumer has an understanding of this
      * changes.
-     * 
-     * 
+     *
+     *
      * @see DataCommitHandler for further information how two-phase commit is
      *      processed.
      * @param store
index fed75f72bee5229beb26ddc3fe88e257749d8137..f337b5509e1a4cda6d4c1488bef048be5d8adeef 100644 (file)
@@ -7,13 +7,12 @@
  */
 package org.opendaylight.controller.md.sal.common.impl;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.util.Collections;
 import java.util.EventListener;
 import java.util.HashSet;
 import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static com.google.common.base.Preconditions.*;
 
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
@@ -32,15 +31,15 @@ public class ListenerRegistry<T extends EventListener> {
         return unmodifiableView;
     }
 
-    
+
     public ListenerRegistration<T> register(T listener) {
         checkNotNull(listener, "Listener should not be null.");
         ListenerRegistrationImpl<T> ret = new ListenerRegistrationImpl<T>(listener);
         listeners.add(ret);
         return ret;
     }
-    
-    
+
+
     @SuppressWarnings("rawtypes")
     private void remove(ListenerRegistrationImpl registration) {
         listeners.remove(registration);
index bd9748d3c57814184a6adf36f03102c6bbde56af..4d756f1d67380851c726a41a321a1e53ff7c8993 100644 (file)
@@ -8,8 +8,6 @@
 package org.opendaylight.controller.md.sal.common.impl.util;
 
 import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
@@ -23,8 +21,8 @@ public class AbstractLockableDelegator<T> implements Delegator<T> {
     private final ReentrantReadWriteLock delegateLock = new ReentrantReadWriteLock();
     private final ReadLock delegateReadLock = delegateLock.readLock();
     private final WriteLock delegateWriteLock = delegateLock.writeLock();
-    
-    
+
+
     protected Lock getDelegateReadLock() {
         return delegateReadLock;
     }
@@ -60,7 +58,7 @@ public class AbstractLockableDelegator<T> implements Delegator<T> {
     }
 
     /**
-     * 
+     *
      * @param newDelegate
      * @return oldDelegate
      */
@@ -75,8 +73,8 @@ public class AbstractLockableDelegator<T> implements Delegator<T> {
             delegateWriteLock.unlock();
         }
     }
-    
-    
+
+
     protected void onDelegateChanged(T oldDelegate, T newDelegate) {
         // NOOP in abstract calss;
     }
index 356ec8ff7c5ee6e84692970d702910b7bdc8c091..f30394187125153004e9b5c3a1b4d4cb2cc74886 100644 (file)
@@ -8,9 +8,7 @@
 package org.opendaylight.controller.sal.common.util;
 
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.yang.common.RpcError;
@@ -19,12 +17,12 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import com.google.common.collect.ImmutableList;
 
 public class Rpcs {
-    
+
     public static <T> RpcResult<T> getRpcResult(boolean successful) {
         RpcResult<T> ret = new RpcResultTO<T>(successful, null, ImmutableList.<RpcError>of());
         return ret;
     }
-    
+
     public static <T> RpcResult<T> getRpcResult(boolean successful, T result,
             Collection<RpcError> errors) {
         RpcResult<T> ret = new RpcResultTO<T>(successful, result, errors);
@@ -34,9 +32,9 @@ public class Rpcs {
     public static <T> RpcResult<T> getRpcResult(boolean successful, Collection<RpcError> errors) {
         return new RpcResultTO<T>(successful, null, errors);
     }
-    
-    private static class RpcResultTO<T> implements RpcResult<T>, Serializable, Immutable {
 
+    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 1cb1a2bc8522b65301e3f70470e2c41e06d3b32c..22b0bf25cf9b65958131ace905b0176d351f4147 100644 (file)
@@ -10,9 +10,6 @@ package org.opendaylight.controller.sal.core.api;
 import java.util.Collection;
 import java.util.Collections;
 
-import javax.naming.Context;
-
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -59,18 +56,18 @@ public abstract class AbstractProvider implements BundleActivator, Provider,Serv
             broker.registerProvider(this, context);
             return broker;
         }
-        
+
         return null;
     }
-    
+
     @Override
     public void modifiedService(ServiceReference<Broker> reference, Broker service) {
         // NOOP
     }
-    
+
     @Override
     public void removedService(ServiceReference<Broker> reference, Broker service) {
         stopImpl(context);
     }
-    
+
 }
index 774de271af32878a8b8d3e6dc70070c6a300f308..9706bbacdbdbee3b22c3a8b163b069617b452347 100644 (file)
@@ -8,8 +8,6 @@
 package org.opendaylight.controller.sal.core.api.data;
 
 import java.util.EventListener;
-import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
@@ -23,31 +21,28 @@ public interface DataModificationTransaction extends DataModification<InstanceId
 
     /**
      * Returns transaction identifier
-     * 
+     *
      * @return Transaction identifier
      */
+    @Override
     Object getIdentifier();
-    
+
+    @Override
     TransactionStatus getStatus();
-    
+
     /**
      * Commits transaction to be stored in global data repository.
-     * 
-     * 
-     * @return  Future object which returns RpcResult with TransactionStatus 
+     *
+     *
+     * @return  Future object which returns RpcResult with TransactionStatus
      *          when transaction is processed by store.
      */
+    @Override
     Future<RpcResult<TransactionStatus>> commit();
-    
+
     ListenerRegistration<DataTransactionListener> registerListener(DataTransactionListener listener);
-    
-    
+
     public interface DataTransactionListener extends EventListener {
-        
         void onStatusUpdated(DataModificationTransaction transaction,TransactionStatus status);
-        
     }
-    
-    
-    
 }
index 299fe1b55811495adee6c66d880cb7badc063152..29e3b911c1d1b1d8a5cdf64b30da0842bff7d11f 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.sal.core.api.mount;
 import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
 import org.opendaylight.controller.sal.core.api.data.DataProviderService;
 import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
-import com.google.common.base.Optional;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public interface MountProvisionInstance extends //
index 403f7c8da0e99cdcc0c21aa841849701bc478edf..bbe017f009e445f2ab7e21e7d19b748d3f5365f0 100644 (file)
@@ -9,14 +9,13 @@ package org.opendaylight.controller.sal.dom.broker;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
 import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
+import org.opendaylight.controller.sal.core.api.BrokerService;
 import org.opendaylight.controller.sal.core.api.Consumer.ConsumerFunctionality;
 import org.opendaylight.controller.sal.core.api.Provider.ProviderFunctionality;
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
@@ -37,7 +36,7 @@ public class NotificationModule implements BrokerModule {
     private static Logger log = LoggerFactory
             .getLogger(NotificationModule.class);
 
-    private Multimap<QName, NotificationListener> listeners = HashMultimap
+    private final Multimap<QName, NotificationListener> listeners = HashMultimap
             .create();
 
     private static final Set<Class<? extends BrokerService>> PROVIDED_SERVICE_TYPE = ImmutableSet
@@ -114,11 +113,12 @@ public class NotificationModule implements BrokerModule {
     private class NotificationConsumerSessionImpl implements
             NotificationService {
 
-        private Multimap<QName, NotificationListener> consumerListeners = HashMultimap
+        private final Multimap<QName, NotificationListener> consumerListeners = HashMultimap
                 .create();
         private boolean closed = false;
 
 
+        @Override
         public Registration<NotificationListener> addNotificationListener(QName notification,
                 NotificationListener listener) {
             checkSessionState();
index 0b184fc86ec0720193210bd8b0a997235caddca8..50af3fbfc1f097662ae4f0a8f1e1084cb87aab96 100644 (file)
@@ -8,21 +8,8 @@
 package org.opendaylight.controller.sal.dom.broker.impl;
 
 import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
 
-import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.Consumer.ConsumerFunctionality;
-import org.opendaylight.controller.sal.core.api.Provider.ProviderFunctionality;
 import org.opendaylight.controller.sal.core.api.notify.NotificationListener;
-import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
-import org.opendaylight.controller.sal.core.api.notify.NotificationService;
-import org.opendaylight.controller.sal.core.spi.BrokerModule;
 import org.opendaylight.controller.sal.dom.broker.spi.NotificationRouter;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
@@ -32,16 +19,15 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Multimaps;
 
 public class NotificationRouterImpl implements NotificationRouter {
     private static Logger log = LoggerFactory.getLogger(NotificationRouterImpl.class);
 
-    private Multimap<QName, Registration<NotificationListener>> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.<QName, Registration<NotificationListener>>create());
+    private final Multimap<QName, Registration<NotificationListener>> listeners = Multimaps.synchronizedSetMultimap(HashMultimap.<QName, Registration<NotificationListener>>create());
 //    private Registration<NotificationListener> defaultListener;
-    
+
     private void sendNotification(CompositeNode notification) {
         final QName type = notification.getNodeType();
         final Collection<Registration<NotificationListener>> toNotify = listeners.get(type);
@@ -66,7 +52,7 @@ public class NotificationRouterImpl implements NotificationRouter {
     public void publish(CompositeNode notification) {
         sendNotification(notification);
     }
-    
+
     @Override
     public Registration<NotificationListener> addNotificationListener(QName notification, NotificationListener listener) {
         ListenerRegistration ret = new ListenerRegistration(notification, listener);
index 0e63126bb36f3efbfcb7d02c5f59e694aa944bbf..24d5430d6d3713a0c6b3e5a5252eb710e9550e7d 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.sal.dom.broker.osgi;
 
-import org.opendaylight.controller.sal.core.api.data.DataBrokerService;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountProvisionService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
@@ -16,23 +15,26 @@ import org.osgi.framework.ServiceReference;
 
 public class MountProviderServiceProxy extends AbstractBrokerServiceProxy<MountProvisionService> implements MountProvisionService{
 
-    
+
     public MountProviderServiceProxy(ServiceReference<MountProvisionService> ref, MountProvisionService delegate) {
         super(ref, delegate);
     }
 
+    @Override
     public MountProvisionInstance getMountPoint(InstanceIdentifier path) {
         return getDelegate().getMountPoint(path);
     }
 
+    @Override
     public MountProvisionInstance createMountPoint(InstanceIdentifier path) {
         return getDelegate().createMountPoint(path);
     }
 
+    @Override
     public MountProvisionInstance createOrGetMountPoint(InstanceIdentifier path) {
         return getDelegate().createOrGetMountPoint(path);
     }
-    
+
     @Override
     public ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener) {
         return getDelegate().registerProvisionListener(listener);
index 9881be0481cf016a8b48259ef3719effea75f3a3..d1523a01d695f2033ee9bfa557b1aaf0ea4c592d 100644 (file)
@@ -9,12 +9,10 @@ package org.opendaylight.controller.sal.dom.broker.spi;
 
 import java.util.Set;
 
-import org.opendaylight.controller.sal.core.api.RpcImplementation;
-import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
 import org.opendaylight.controller.sal.core.api.Broker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.core.api.Broker.RpcRegistration;
-import org.opendaylight.controller.sal.core.api.RpcRegistrationListener;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.controller.sal.core.api.RpcImplementation;
+import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
@@ -23,14 +21,14 @@ public interface RpcRouter extends RpcProvisionRegistry, RpcImplementation {
 
     @Override
     public RoutedRpcRegistration addRoutedRpcImplementation(QName rpcType, RpcImplementation implementation);
-    
+
     @Override
     public RpcRegistration addRpcImplementation(QName rpcType, RpcImplementation implementation)
             throws IllegalArgumentException;
-    
+
     @Override
     public Set<QName> getSupportedRpcs();
-    
+
     @Override
     public RpcResult<CompositeNode> invokeRpc(QName rpc, CompositeNode input);
 }
index a816819cb9eb1a2ee06426ffd390833a50f7250d..c16ee170def8fe7fc13c24a15456058e0a356b8c 100644 (file)
@@ -7,15 +7,21 @@
  */
 package org.opendaylight.controller.sal.connect.netconf;
 
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_ACTION_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_CANDIDATE_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_COMMIT_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_CONFIG_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_EDIT_CONFIG_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_RUNNING_QNAME;
+import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.NETCONF_TARGET_QNAME;
+
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Set;
 
-import org.eclipse.xtext.xbase.lib.IterableExtensions;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
@@ -28,18 +34,14 @@ import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 
-import static org.opendaylight.controller.sal.connect.netconf.NetconfMapping.*;
-
 public class NetconfDeviceTwoPhaseCommitTransaction implements DataCommitTransaction<InstanceIdentifier, CompositeNode> {
 
-    private NetconfDevice device;
+    private final NetconfDevice device;
     private final DataModification<InstanceIdentifier, CompositeNode> modification;
-    private boolean candidateSupported = true;
+    private final boolean candidateSupported = true;
 
     public NetconfDeviceTwoPhaseCommitTransaction(NetconfDevice device,
             DataModification<InstanceIdentifier, CompositeNode> modification) {
@@ -70,15 +72,15 @@ public class NetconfDeviceTwoPhaseCommitTransaction implements DataCommitTransac
         CompositeNodeBuilder<ImmutableCompositeNode> builder = configurationRpcBuilder();
         builder.setQName(NETCONF_EDIT_CONFIG_QNAME);
         builder.add(editStructure);
-        
+
         RpcResult<CompositeNode> rpcResult = device.invokeRpc(NETCONF_EDIT_CONFIG_QNAME, builder.toInstance());
         Preconditions.checkState(rpcResult.isSuccessful(),"Rpc Result was unsuccessful");
-        
+
     }
 
     private CompositeNodeBuilder<ImmutableCompositeNode> configurationRpcBuilder() {
         CompositeNodeBuilder<ImmutableCompositeNode> ret = ImmutableCompositeNode.builder();
-        
+
         Node<?> targetNode;
         if(candidateSupported) {
             targetNode = ImmutableCompositeNode.create(NETCONF_CANDIDATE_QNAME, ImmutableList.<Node<?>>of());
@@ -106,7 +108,7 @@ public class NetconfDeviceTwoPhaseCommitTransaction implements DataCommitTransac
             for (Entry<QName, Object> entry : predicates.entrySet()) {
                 builder.addLeaf(entry.getKey(), entry.getValue());
             }
-            
+
             if (isLast) {
                 if (action.isPresent()) {
                     builder.setAttribute(NETCONF_ACTION_QNAME, action.get());
@@ -118,7 +120,7 @@ public class NetconfDeviceTwoPhaseCommitTransaction implements DataCommitTransac
                             builder.add(child);
                         }
                     }
-                    
+
                 }
             } else {
                 builder.add(previous);
index 49f702080cc5c6e29ce148e9c2a44f5bc32d4345..fa6b6f7ca58f4403e9c9c3b97f79fbb2aa47d2ea 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.sal.connect.netconf;
 
 import java.util.Set;
 
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
@@ -19,7 +18,6 @@ import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder;
 import org.opendaylight.yangtools.yang.model.util.repo.SchemaSourceProvider;
 
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 
 class NetconfRemoteSchemaSourceProvider implements SchemaSourceProvider<String> {
 
index a34aaff757074794cde5c4caac24670450016e74..bc819b65636abbcdb72371ed9ce8866ce88fb640 100644 (file)
@@ -10,13 +10,12 @@ package org.opendaylight.controller.sal.connect.netconf;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringBufferInputStream;
-import java.io.StringReader;
 
 import org.opendaylight.yangtools.concepts.Delegator;
 import org.opendaylight.yangtools.yang.common.QName;
 
 /**
- * 
+ *
  *
  */
 public class YangModelInputStreamAdapter extends InputStream implements Delegator<InputStream> {
@@ -24,9 +23,9 @@ public class YangModelInputStreamAdapter extends InputStream implements Delegato
     final String source;
     final QName moduleIdentifier;
     final InputStream delegate;
-    
-    
-    
+
+
+
     private YangModelInputStreamAdapter(String source, QName moduleIdentifier, InputStream delegate) {
         super();
         this.source = source;
@@ -34,46 +33,57 @@ public class YangModelInputStreamAdapter extends InputStream implements Delegato
         this.delegate = delegate;
     }
 
+    @Override
     public int read() throws IOException {
         return delegate.read();
     }
 
+    @Override
     public int hashCode() {
         return delegate.hashCode();
     }
 
+    @Override
     public int read(byte[] b) throws IOException {
         return delegate.read(b);
     }
 
+    @Override
     public boolean equals(Object obj) {
         return delegate.equals(obj);
     }
 
+    @Override
     public int read(byte[] b, int off, int len) throws IOException {
         return delegate.read(b, off, len);
     }
 
+    @Override
     public long skip(long n) throws IOException {
         return delegate.skip(n);
     }
 
+    @Override
     public int available() throws IOException {
         return delegate.available();
     }
 
+    @Override
     public void close() throws IOException {
         delegate.close();
     }
 
+    @Override
     public void mark(int readlimit) {
         delegate.mark(readlimit);
     }
 
+    @Override
     public void reset() throws IOException {
         delegate.reset();
     }
 
+    @Override
     public boolean markSupported() {
         return delegate.markSupported();
     }
index f511ff7e76049f4338eededef8d5725a14ce7cc8..95bb62f93b331257413f2273bcba32ce22fdc7e9 100644 (file)
@@ -40,8 +40,6 @@ public final class ZeroMQServerModule extends org.opendaylight.controller.config
         
         Broker broker = getDomBrokerDependency();
 
-
-        
         final int port = getPort() != null ? getPort() : ZEROMQ_ROUTER_PORT;
 
         ServerImpl serverImpl = new ServerImpl(port);
@@ -50,7 +48,6 @@ public final class ZeroMQServerModule extends org.opendaylight.controller.config
 
         RoutingTableProvider provider = new RoutingTableProvider(bundleContext,serverImpl);
 
-
         RemoteRpcProvider facade = new RemoteRpcProvider(serverImpl, clientImpl);
         
         facade.setRoutingTableProvider(provider );
index b5a67ff0df97f3d110f1842074617468ce836b61..5c14dd0c453ce8365e528506d743699edf418f3a 100644 (file)
@@ -40,6 +40,7 @@ import java.util.concurrent.FutureTask;
 import java.util.concurrent.TimeUnit;
 
 import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
 
 /**
  * ZeroMq based implementation of RpcRouter. It implements RouteChangeListener of RoutingTable
@@ -76,10 +77,6 @@ public class ServerImpl implements RemoteRpcServer, RouteChangeListener<String,
 
   public ServerImpl(int port) {
     this.port = port;
-    this.serverAddress = new StringBuilder(findIpAddress()).
-                              append(":").
-                              append(port).
-                              toString();
   }
 
   public RoutingTableProvider getRoutingTableProvider() {
@@ -134,6 +131,28 @@ public class ServerImpl implements RemoteRpcServer, RouteChangeListener<String,
         "Remote RPC Server is already running");
 
     status = State.STARTING;
+    _logger.debug("Remote RPC Server is starting...");
+
+    String hostIpAddress = findIpAddress();
+
+    //Log and silently die as per discussion in the bug (bug-362)
+    //https://bugs.opendaylight.org/show_bug.cgi?id=362
+    //
+    // A tracking enhancement defect (bug-366) is created to properly fix this issue
+    //https://bugs.opendaylight.org/show_bug.cgi?id=366
+    //checkState(hostIpAddress != null, "Remote RPC Server could not acquire host ip address");
+
+    if (hostIpAddress == null) {
+      _logger.error("Remote RPC Server could not acquire host ip address. Stopping...");
+      stop();
+      return;
+    }
+
+    this.serverAddress = new StringBuilder(hostIpAddress).
+        append(":").
+        append(port).
+        toString();
+
     context = ZMQ.context(1);
     remoteServices = new HashSet<QName>();//
     serverPool = Executors.newSingleThreadExecutor();//main server thread
@@ -334,12 +353,13 @@ public class ServerImpl implements RemoteRpcServer, RouteChangeListener<String,
    * @return
    */
   private String findIpAddress() {
-    String hostAddress = null;
     Enumeration e = null;
     try {
       e = NetworkInterface.getNetworkInterfaces();
     } catch (SocketException e1) {
-      e1.printStackTrace();
+      _logger.error("Failed to get list of interfaces", e1);
+      //throw new RuntimeException("Failed to acquire list of interfaces", e1);
+      return null;
     }
     while (e.hasMoreElements()) {
 
@@ -348,12 +368,17 @@ public class ServerImpl implements RemoteRpcServer, RouteChangeListener<String,
       Enumeration ee = n.getInetAddresses();
       while (ee.hasMoreElements()) {
         InetAddress i = (InetAddress) ee.nextElement();
-        if ((i instanceof Inet4Address) && (i.isSiteLocalAddress()))
-          hostAddress = i.getHostAddress();
+        _logger.debug("Trying address {}", i);
+        if ((i instanceof Inet4Address) && (i.isSiteLocalAddress())) {
+          String hostAddress = i.getHostAddress();
+          _logger.debug("Settled on host address {}", hostAddress);
+          return hostAddress;
+        }
       }
     }
-    return hostAddress;
 
+    _logger.error("Failed to find a suitable host address");
+    return null;
   }
 
   /**
index 17d7fe6be09eaa18f48ac5831527fc58076dbe18..dd1502ba79f5c1325aefbeca443fde34e997da90 100644 (file)
@@ -12,12 +12,10 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.Collections;
-import java.util.Set;
 
 import javax.ws.rs.WebApplicationException;
 
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider;
 import org.opendaylight.controller.sal.restconf.impl.test.DummyType;
@@ -29,7 +27,6 @@ import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
 import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode;
 import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.builder.impl.ContainerSchemaNodeBuilder;
 import org.opendaylight.yangtools.yang.parser.builder.impl.LeafSchemaNodeBuilder;
 import org.slf4j.Logger;
@@ -49,7 +46,7 @@ public class CnSnToJsonNotExistingLeafTypeTest extends YangAndXmlAndDataSchemaLo
         String jsonOutput = null;
         jsonOutput = TestUtils
                 .writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(),
-                        (Set<Module>) Collections.EMPTY_SET, prepareDataSchemaNode(),
+                        Collections.EMPTY_SET, prepareDataSchemaNode(),
                         StructuredDataToJsonProvider.INSTANCE);
         assertNotNull(jsonOutput);
         assertTrue(jsonOutput.contains("\"lf1\": \"\""));
index 4218a69d3b9821562b3a38bb7a5a87ac85470e0e..f81c1d63f5af572509a76e2fa5b1da05bafa71bb 100644 (file)
@@ -7,12 +7,10 @@
  */
 package org.opendaylight.controller.sal.restconf.impl.cnsn.to.xml.test;
 
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.Collections;
-import java.util.Set;
 
 import javax.ws.rs.WebApplicationException;
 
@@ -21,10 +19,12 @@ import org.junit.Test;
 import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
 import org.opendaylight.controller.sal.restconf.impl.test.DummyType;
 import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
-import org.opendaylight.yangtools.yang.data.api.*;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.ModifyAction;
+import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode;
+import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode;
 import org.opendaylight.yangtools.yang.data.impl.NodeFactory;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.builder.impl.ContainerSchemaNodeBuilder;
 import org.opendaylight.yangtools.yang.parser.builder.impl.LeafSchemaNodeBuilder;
 import org.slf4j.Logger;
@@ -41,7 +41,7 @@ public class CnSnToXmlNotExistingLeafTypeTest {
         boolean nullPointerExceptionRaised = false;
         try {
             TestUtils.writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(),
-                    (Set<Module>) Collections.EMPTY_SET, prepareDataSchemaNode(), StructuredDataToXmlProvider.INSTANCE);
+                    Collections.EMPTY_SET, prepareDataSchemaNode(), StructuredDataToXmlProvider.INSTANCE);
         } catch (WebApplicationException | IOException e) {
             LOG.error("WebApplicationException or IOException was raised");
         } catch (NullPointerException e) {
index f2d6aaf44f49585cfc95508f8e104bdb8ce95f32..1e01020e78925f6b8b33606da8f43967a584ff12 100644 (file)
@@ -7,12 +7,11 @@
  */
 package org.opendaylight.controller.sal.restconf.impl.test;
 
-import static org.junit.Assert.*;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.verify;
 import static org.opendaylight.controller.sal.restconf.impl.test.RestOperationUtils.createUri;
 
 import java.io.FileNotFoundException;
@@ -23,14 +22,14 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import javax.ws.rs.core.Response;
 
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.api.mount.MountInstance;
 import org.opendaylight.controller.sal.core.api.mount.MountService;
@@ -385,7 +384,7 @@ public class RestGetOperationTest extends JerseyTest {
                         responseBody).find());
         String[] split = responseBody.split("\"module\"");
         assertEquals("\"module\" element is returned more then once",2,split.length);
-        
+
 
         response = target(uri).request("application/yang.api+xml").get();
         assertEquals(200, response.getStatus());
@@ -396,9 +395,9 @@ public class RestGetOperationTest extends JerseyTest {
                         .find());
         split = responseBody.split("<module");
         assertEquals("<module element is returned more then once",2,split.length);
-        
-        
-        
+
+
+
 
     }
 
index 02e163205713a658f2131f8e6d8fef251ababae5..0a16e254ccc6cd6c1a2f838cb04917477ce7869d 100644 (file)
@@ -15,7 +15,6 @@ import io.netty.channel.SimpleChannelInboundHandler;
 import io.netty.handler.codec.http.FullHttpResponse;
 import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame;
 import io.netty.handler.codec.http.websocketx.PongWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
 import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker;
 import io.netty.handler.codec.http.websocketx.WebSocketFrame;
 import io.netty.util.CharsetUtil;
@@ -28,7 +27,7 @@ public class WebSocketClientHandler extends SimpleChannelInboundHandler<Object>
     private static final Logger logger = LoggerFactory.getLogger(WebSocketClientHandler.class.toString());
     private final WebSocketClientHandshaker handshaker;
     private ChannelPromise handshakeFuture;
-    private IClientMessageCallback messageListener;
+    private final IClientMessageCallback messageListener;
 
 
     public WebSocketClientHandler(WebSocketClientHandshaker handshaker,IClientMessageCallback listener) {
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 0f90ecac60e1f57307da4ee810cecbeb2a1a75d6..5c3fc2329af03cf5b44f079ec211a2cdff06ca26 100644 (file)
             <groupId>org.eclipse.xtend</groupId>
             <artifactId>org.eclipse.xtend.lib</artifactId>
         </dependency>
+        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>${slf4j.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
index 5f264abc2cb41cf68939ec323e54c7064707a515..a7c00d45913ccb4d5c9c44504f252735d17340a1 100644 (file)
@@ -127,13 +127,17 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         OpendaylightFlowTableStatisticsListener,
         OpendaylightQueueStatisticsListener{
     
-    public final static Logger sucLogger = LoggerFactory.getLogger(StatisticsUpdateCommiter.class);
+    private final static Logger sucLogger = LoggerFactory.getLogger(StatisticsUpdateCommiter.class);
 
     private final StatisticsProvider statisticsManager;
     private final MultipartMessageManager messageManager;
     
     private int unaccountedFlowsCounter = 1;
 
+    /**
+     * default ctor
+     * @param manager
+     */
     public StatisticsUpdateCommiter(final StatisticsProvider manager){
 
         this.statisticsManager = manager;
@@ -701,7 +705,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         
     }
 
-    private NodeRef getNodeRef(NodeKey nodeKey){
+    private static NodeRef getNodeRef(NodeKey nodeKey){
         InstanceIdentifierBuilder<?> builder = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeKey);
         return new NodeRef(builder.toInstance());
     }
@@ -861,34 +865,65 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         return true;
     }
 
-    private boolean layer3MatchEquals(Layer3Match statsLayer3Match, Layer3Match storedLayer3Match){
-
+    protected static boolean layer3MatchEquals(Layer3Match statsLayer3Match, Layer3Match storedLayer3Match){
+        boolean verdict = true; 
         if(statsLayer3Match instanceof Ipv4Match && storedLayer3Match instanceof Ipv4Match){
             Ipv4Match statsIpv4Match = (Ipv4Match)statsLayer3Match;
             Ipv4Match storedIpv4Match = (Ipv4Match)storedLayer3Match;
-            
-            if (storedIpv4Match.getIpv4Destination()== null) {
-                if (statsIpv4Match.getIpv4Destination()!= null) {
-                    return false;
-                }
-            } else if(!IpAddressEquals(statsIpv4Match.getIpv4Destination(),storedIpv4Match.getIpv4Destination())){
-                return false;
+
+            if (verdict) {
+                verdict = compareNullSafe(
+                        storedIpv4Match.getIpv4Destination(), statsIpv4Match.getIpv4Destination());
             }
-            if (storedIpv4Match.getIpv4Source() == null) {
-                if (statsIpv4Match.getIpv4Source() != null) {
-                    return false;
-                }
-            } else if(!IpAddressEquals(statsIpv4Match.getIpv4Source(),storedIpv4Match.getIpv4Source())) {
-                return false;
+            if (verdict) {
+                verdict = compareNullSafe(
+                        statsIpv4Match.getIpv4Source(), storedIpv4Match.getIpv4Source());
+            }
+        } else {
+            Boolean nullCheckOut = checkNullValues(storedLayer3Match, statsLayer3Match);
+            if (nullCheckOut != null) {
+                verdict = nullCheckOut;
+            } else {
+                verdict = storedLayer3Match.equals(statsLayer3Match);
             }
-            
-            return true;
-        }else{
-            return storedLayer3Match.equals(statsLayer3Match);
         }
+        
+        return verdict;
     }
     
-    private boolean IpAddressEquals(Ipv4Prefix statsIpAddress, Ipv4Prefix storedIpAddress) {
+    private static boolean compareNullSafe(Ipv4Prefix statsIpv4, Ipv4Prefix storedIpv4) {
+        boolean verdict = true;
+        Boolean checkDestNullValuesOut = checkNullValues(storedIpv4, statsIpv4);
+        if (checkDestNullValuesOut != null) {
+            verdict = checkDestNullValuesOut;
+        } else if(!IpAddressEquals(statsIpv4, storedIpv4)){
+            verdict = false;
+        }
+        
+        return verdict;
+    }
+    
+    private static Boolean checkNullValues(Object v1, Object v2) {
+        Boolean verdict = null;
+        if (v1 == null && v2 != null) {
+            verdict = Boolean.FALSE;
+        } else if (v1 != null && v2 == null) {
+            verdict = Boolean.FALSE;
+        } else if (v1 == null && v2 == null) {
+            verdict = Boolean.TRUE;
+        }
+        
+        return verdict;
+    }
+    
+    /**
+     * TODO: why don't we use the default Ipv4Prefix.equals()?
+     * 
+     * @param statsIpAddress
+     * @param storedIpAddress
+     * @return true if IPv4prefixes equals 
+     */
+    private static boolean IpAddressEquals(Ipv4Prefix statsIpAddress, Ipv4Prefix storedIpAddress) {
         IntegerIpAddress statsIpAddressInt = StrIpToIntIp(statsIpAddress.getValue());
         IntegerIpAddress storedIpAddressInt = StrIpToIntIp(storedIpAddress.getValue());
 
@@ -901,19 +936,19 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
         return false;
     }
 
-    private boolean IpAndMaskBasedMatch(IntegerIpAddress statsIpAddressInt,IntegerIpAddress storedIpAddressInt){
+    private static boolean IpAndMaskBasedMatch(IntegerIpAddress statsIpAddressInt,IntegerIpAddress storedIpAddressInt){
         return ((statsIpAddressInt.getIp() & statsIpAddressInt.getMask()) ==  (storedIpAddressInt.getIp() & storedIpAddressInt.getMask()));
     }
 
-    private boolean IpBasedMatch(IntegerIpAddress statsIpAddressInt,IntegerIpAddress storedIpAddressInt){
+    private static boolean IpBasedMatch(IntegerIpAddress statsIpAddressInt,IntegerIpAddress storedIpAddressInt){
         return (statsIpAddressInt.getIp() == storedIpAddressInt.getIp());
     }
     
-    /*
+    /**
      * Method return integer version of ip address. Converted int will be mask if 
      * mask specified
      */
-    private IntegerIpAddress StrIpToIntIp(String ipAddresss){
+    private static IntegerIpAddress StrIpToIntIp(String ipAddresss){
         
         String[] parts = ipAddresss.split("/");
         String ip = parts[0];
@@ -925,23 +960,26 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList
             prefix = Integer.parseInt(parts[1]);
         }
 
-        Inet4Address addr =null;
+        IntegerIpAddress integerIpAddress = null;
         try {
-            addr = (Inet4Address) InetAddress.getByName(ip);
-        } catch (UnknownHostException e){}
-
-        byte[] addrBytes = addr.getAddress();
-        int ipInt = ((addrBytes[0] & 0xFF) << 24) |
-                         ((addrBytes[1] & 0xFF) << 16) |
-                         ((addrBytes[2] & 0xFF) << 8)  |
-                         ((addrBytes[3] & 0xFF) << 0);
-
-        int mask = 0xffffffff << 32 - prefix;
+            Inet4Address addr = (Inet4Address) InetAddress.getByName(ip);
+            byte[] addrBytes = addr.getAddress();
+            int ipInt = ((addrBytes[0] & 0xFF) << 24) |
+                    ((addrBytes[1] & 0xFF) << 16) |
+                    ((addrBytes[2] & 0xFF) << 8)  |
+                    ((addrBytes[3] & 0xFF) << 0);
+            
+            int mask = 0xffffffff << 32 - prefix;
+            
+            integerIpAddress = new IntegerIpAddress(ipInt, mask);
+        } catch (UnknownHostException e){
+            sucLogger.error("Failed to determine host IP address by name: {}", e.getMessage(), e);
+        }
 
-        return new IntegerIpAddress(ipInt, mask);
+        return integerIpAddress;
     }
     
-    class IntegerIpAddress{
+    static class IntegerIpAddress{
         int ip;
         int mask;
         public IntegerIpAddress(int ip, int mask) {
diff --git a/opendaylight/md-sal/statistics-manager/src/test/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiterTest.java b/opendaylight/md-sal/statistics-manager/src/test/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiterTest.java
new file mode 100644 (file)
index 0000000..5da6ef3
--- /dev/null
@@ -0,0 +1,115 @@
+/**
+ * Copyright (c) 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.md.statistics.manager;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 
+ */
+public class StatisticsUpdateCommiterTest {
+    
+    private static final Logger LOG = LoggerFactory
+            .getLogger(StatisticsUpdateCommiterTest.class);
+
+    /**
+     * Test method for {@link org.opendaylight.controller.md.statistics.manager.StatisticsUpdateCommiter#layer3MatchEquals(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match, org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match)}.
+     */
+    @Test
+    public void testLayer3MatchEquals() {
+        String[][][] matchSeeds = new String[][][] {
+                {{"10.1.2.0/24", "10.1.2.0/24"}, {"10.1.2.0/24", "10.1.2.0/24"}},
+                {{"10.1.2.0/24", "10.1.2.0/24"}, {"10.1.2.0/24", "10.1.1.0/24"}},
+                {{"10.1.1.0/24", "10.1.2.0/24"}, {"10.1.2.0/24", "10.1.2.0/24"}},
+                {{"10.1.1.0/24", "10.1.1.0/24"}, {"10.1.2.0/24", "10.1.2.0/24"}},
+                
+                {{"10.1.1.0/24", null}, {"10.1.1.0/24", "10.1.2.0/24"}},
+                {{"10.1.1.0/24", null}, {"10.1.2.0/24", "10.1.2.0/24"}},
+                {{"10.1.1.0/24", null}, {"10.1.2.0/24", null}},
+                {{"10.1.1.0/24", null}, {"10.1.1.0/24", null}},
+                
+                {{null, "10.1.1.0/24"}, {"10.1.2.0/24", "10.1.1.0/24"}},
+                {{null, "10.1.1.0/24"}, {"10.1.2.0/24", "10.1.2.0/24"}},
+                {{null, "10.1.1.0/24"}, {null, "10.1.2.0/24"}},
+                {{null, "10.1.1.0/24"}, {null, "10.1.1.0/24"}},
+                
+                {{null, null}, {null, "10.1.1.0/24"}},
+                {{null, null}, {null, null}},
+        };
+        
+        boolean[] matches = new boolean[] {
+                true, 
+                false,
+                false,
+                false,
+                
+                false,
+                false,
+                false,
+                true,
+                
+                false,
+                false,
+                false,
+                true,
+                
+                false,
+                true
+        };
+        
+        for (int i = 0; i < matches.length; i++) {
+            checkComparisonOfL3Match(
+                    matchSeeds[i][0][0], matchSeeds[i][0][1], 
+                    matchSeeds[i][1][0], matchSeeds[i][1][1], 
+                    matches[i]);
+        }
+    }
+
+    /**
+     * @param m1Source match1 - src
+     * @param m1Destination match1 - dest
+     * @param m2Source match2 - src
+     * @param msDestination match2 - dest
+     * @param matches expected match output
+     * 
+     */
+    private static void checkComparisonOfL3Match(String m1Source, String m1Destination, 
+            String m2Source, String msDestination, boolean matches) {
+        Ipv4Match m1Layer3 = prepareIPv4Match(m1Source, m1Destination);
+        Ipv4Match m2Layer3 = prepareIPv4Match(m2Source, msDestination);
+        boolean comparisonResult;
+        try {
+            comparisonResult = StatisticsUpdateCommiter.layer3MatchEquals(m1Layer3, m2Layer3);
+            Assert.assertEquals("failed to compare: "+m1Layer3+" vs. "+m2Layer3, 
+                    matches, comparisonResult);
+        } catch (Exception e) {
+            LOG.error("failed to compare: {} vs. {}", m1Layer3, m2Layer3, e);
+            Assert.fail(e.getMessage());
+        }
+    }
+    
+    private static Ipv4Match prepareIPv4Match(String source, String destination) {
+        Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
+        if (source != null) {
+            ipv4MatchBuilder.setIpv4Source(new Ipv4Prefix(source));
+        }
+        if (destination != null) {
+            ipv4MatchBuilder.setIpv4Destination(new Ipv4Prefix(destination));
+        }
+        
+        return ipv4MatchBuilder.build();
+    }
+
+}
diff --git a/opendaylight/md-sal/statistics-manager/src/test/resources/log4j-test.xml b/opendaylight/md-sal/statistics-manager/src/test/resources/log4j-test.xml
new file mode 100644 (file)
index 0000000..bd3bf3c
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">\r
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">\r
+\r
+    <appender name="console" class="org.apache.log4j.ConsoleAppender">\r
+        <layout class="org.apache.log4j.PatternLayout">\r
+            <param name="ConversionPattern" value="%-6p %d{HH:mm:ss.SSS} [%10.10t] %30.30c %x - %m%n" />\r
+        </layout>\r
+    </appender>\r
+\r
+    <logger name="org.opendaylight.controller.md.statistics" additivity="false">\r
+        <level value="DEBUG" />\r
+        <appender-ref ref="console" />\r
+    </logger>\r
+\r
+    <root>\r
+        <priority value="INFO" />\r
+        <appender-ref ref="console" />\r
+    </root>\r
+</log4j:configuration>\r
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 f42db6938de7e6a6c2b7048271e7ce65840b0c82..6e27b48978549e95fecb9dd84663ff9a74e8154e 100644 (file)
@@ -8,14 +8,12 @@
 
 package org.opendaylight.controller.netconf.api;
 
-import org.opendaylight.protocol.framework.DeserializerException;
-
 /**
  * This exception is thrown by
  * {@link NetconfSessionListener#onMessage(NetconfMessage)} to indicate fatal
  * communication problem after which the session should be closed.
  */
-public class NetconfDeserializerException extends DeserializerException {
+public class NetconfDeserializerException extends Exception {
     private static final long serialVersionUID = 1L;
 
     public NetconfDeserializerException(final String message) {
index 1107572df1bda55be26504399697b7327f68636c..5a85e9425783c4171ce41d52b01dd71b9a3c9079 100644 (file)
@@ -11,13 +11,11 @@ package org.opendaylight.controller.netconf.api;
 import java.util.Collections;
 import java.util.Map;
 
-import org.opendaylight.protocol.framework.DocumentedException;
-
 /**
  * Checked exception to communicate an error that needs to be sent to the
  * netconf client.
  */
-public class NetconfDocumentedException extends DocumentedException {
+public class NetconfDocumentedException extends Exception {
 
     private static final long serialVersionUID = 1L;
 
index 7877843ccb99c7ad91230467720b7bbf17f72e25..afca33328ee697feaacce69d03e9e62610a9582f 100644 (file)
@@ -17,13 +17,9 @@ import com.google.common.base.Optional;
  * implementing ProtocolMessage interface.
  */
 public final class NetconfMessage {
-
-    private static final long serialVersionUID = 462175939836367285L;
-
+    private final String additionalHeader;
     private final Document doc;
 
-    private String additionalHeader;
-
     public NetconfMessage(final Document doc) {
         this(doc, null);
     }
index 6c747dbe244fde8812a17a8f923eff49c67fba4d..4770cb128fb7399f50759a2ffb599796001992b6 100644 (file)
@@ -8,26 +8,30 @@
 package org.opendaylight.controller.netconf.api;
 
 import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+
+import java.io.IOException;
+
 import org.opendaylight.protocol.framework.AbstractProtocolSession;
 import org.opendaylight.protocol.framework.SessionListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-
 public abstract class NetconfSession extends AbstractProtocolSession<NetconfMessage> {
-    protected final Channel channel;
-    private final SessionListener sessionListener;
+    private static final Logger logger = LoggerFactory.getLogger(NetconfSession.class);
+    private final SessionListener<NetconfMessage, NetconfSession, NetconfTerminationReason> sessionListener;
     private final long sessionId;
     private boolean up = false;
-    private static final Logger logger = LoggerFactory.getLogger(NetconfSession.class);
 
-    protected NetconfSession(SessionListener sessionListener, Channel channel, long sessionId) {
+    protected final Channel channel;
+
+    protected NetconfSession(SessionListener<NetconfMessage, NetconfSession, NetconfTerminationReason> sessionListener, Channel channel, long sessionId) {
         this.sessionListener = sessionListener;
         this.channel = channel;
         this.sessionId = sessionId;
         logger.debug("Session {} created", toString());
     }
+
     @Override
     public void close() {
         channel.close();
@@ -41,8 +45,8 @@ public abstract class NetconfSession extends AbstractProtocolSession<NetconfMess
         sessionListener.onMessage(this, netconfMessage);
     }
 
-    public void sendMessage(NetconfMessage netconfMessage) {
-        channel.writeAndFlush(netconfMessage);
+    public ChannelFuture sendMessage(NetconfMessage netconfMessage) {
+        return channel.writeAndFlush(netconfMessage);
     }
 
     @Override
@@ -69,11 +73,11 @@ public abstract class NetconfSession extends AbstractProtocolSession<NetconfMess
         return sb.toString();
     }
 
-    public boolean isUp() {
+    public final boolean isUp() {
         return up;
     }
 
-    public long getSessionId() {
+    public final long getSessionId() {
         return sessionId;
     }
 }
index 06239b2bfd4ef000345229c6c12c5791429751d0..c1d5b2bdf79e5ce06ac6e4a4c3121f88ae84e25a 100644 (file)
@@ -8,13 +8,15 @@
 
 package org.opendaylight.controller.netconf.client;
 
-import com.google.common.base.Optional;
-import io.netty.channel.ChannelHandler;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.Promise;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.api.NetconfTerminationReason;
@@ -22,22 +24,17 @@ import org.opendaylight.controller.netconf.util.AbstractChannelInitializer;
 import org.opendaylight.controller.netconf.util.handler.ssh.SshHandler;
 import org.opendaylight.controller.netconf.util.handler.ssh.authentication.AuthenticationHandler;
 import org.opendaylight.controller.netconf.util.handler.ssh.client.Invoker;
-import org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory;
-import org.opendaylight.protocol.framework.ProtocolHandlerFactory;
-import org.opendaylight.protocol.framework.ProtocolMessageDecoder;
-import org.opendaylight.protocol.framework.ProtocolMessageEncoder;
 import org.opendaylight.protocol.framework.ReconnectStrategy;
 import org.opendaylight.protocol.framework.SessionListener;
 import org.opendaylight.protocol.framework.SessionListenerFactory;
 
-import java.io.IOException;
-import java.net.InetSocketAddress;
+import com.google.common.base.Optional;
 
 public class NetconfSshClientDispatcher extends NetconfClientDispatcher {
 
-    private AuthenticationHandler authHandler;
-    private HashedWheelTimer timer;
-    private NetconfClientSessionNegotiatorFactory negotatorFactory;
+    private final AuthenticationHandler authHandler;
+    private final HashedWheelTimer timer;
+    private final NetconfClientSessionNegotiatorFactory negotatorFactory;
 
     public NetconfSshClientDispatcher(AuthenticationHandler authHandler, EventLoopGroup bossGroup,
             EventLoopGroup workerGroup, long connectionTimeoutMillis) {
@@ -55,6 +52,7 @@ public class NetconfSshClientDispatcher extends NetconfClientDispatcher {
         this.negotatorFactory = new NetconfClientSessionNegotiatorFactory(timer, Optional.of(additionalHeader), socketTimeoutMillis);
     }
 
+    @Override
     public Future<NetconfClientSession> createClient(InetSocketAddress address,
             final NetconfClientSessionListener sessionListener, ReconnectStrategy strat) {
         return super.createClient(address, strat, new PipelineInitializer<NetconfClientSession>() {
@@ -69,7 +67,6 @@ public class NetconfSshClientDispatcher extends NetconfClientDispatcher {
 
     private static final class NetconfSshClientInitializer extends AbstractChannelInitializer {
 
-        private final NetconfHandlerFactory handlerFactory;
         private final AuthenticationHandler authenticationHandler;
         private final NetconfClientSessionNegotiatorFactory negotiatorFactory;
         private final NetconfClientSessionListener sessionListener;
@@ -77,7 +74,6 @@ public class NetconfSshClientDispatcher extends NetconfClientDispatcher {
         public NetconfSshClientInitializer(AuthenticationHandler authHandler,
                 NetconfClientSessionNegotiatorFactory negotiatorFactory,
                 final NetconfClientSessionListener sessionListener) {
-            this.handlerFactory = new NetconfHandlerFactory(new NetconfMessageFactory());
             this.authenticationHandler = authHandler;
             this.negotiatorFactory = negotiatorFactory;
             this.sessionListener = sessionListener;
@@ -105,21 +101,4 @@ public class NetconfSshClientDispatcher extends NetconfClientDispatcher {
 
         }
     }
-
-    private static final class NetconfHandlerFactory extends ProtocolHandlerFactory<NetconfMessage> {
-
-        public NetconfHandlerFactory(final NetconfMessageFactory msgFactory) {
-            super(msgFactory);
-        }
-
-        @Override
-        public ChannelHandler[] getEncoders() {
-            return new ChannelHandler[] { new ProtocolMessageEncoder(this.msgFactory) };
-        }
-
-        @Override
-        public ChannelHandler[] getDecoders() {
-            return new ChannelHandler[] { new ProtocolMessageDecoder(this.msgFactory) };
-        }
-    }
 }
index baf2d7d761373a4dfb00895eed62a4d16b0470ee..85bccba14ff01da5d559ad83ff6080e0ef5b6b42 100644 (file)
@@ -13,30 +13,28 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-
-import java.util.Queue;
-
 import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
 import io.netty.channel.embedded.EmbeddedChannel;
 
+import java.util.Queue;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.util.handler.FramingMechanismHandlerFactory;
 import org.opendaylight.controller.netconf.util.handler.NetconfMessageAggregator;
 import org.opendaylight.controller.netconf.util.handler.NetconfMessageChunkDecoder;
+import org.opendaylight.controller.netconf.util.handler.NetconfMessageToXMLEncoder;
+import org.opendaylight.controller.netconf.util.handler.NetconfXMLToMessageDecoder;
 import org.opendaylight.controller.netconf.util.messages.FramingMechanism;
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageConstants;
-import org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory;
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageHeader;
 import org.opendaylight.controller.netconf.util.test.XmlFileLoader;
-import org.opendaylight.protocol.framework.ProtocolMessageDecoder;
-import org.opendaylight.protocol.framework.ProtocolMessageEncoder;
 
 public class MessageParserTest {
 
     private NetconfMessage msg;
-    private NetconfMessageFactory msgFactory = new NetconfMessageFactory();
 
     @Before
     public void setUp() throws Exception {
@@ -47,16 +45,20 @@ public class MessageParserTest {
     public void testChunkedFramingMechanismOnPipeline() throws Exception {
         EmbeddedChannel testChunkChannel = new EmbeddedChannel(
                 FramingMechanismHandlerFactory.createHandler(FramingMechanism.CHUNK),
-                new ProtocolMessageEncoder<NetconfMessage>(msgFactory),
+                new NetconfMessageToXMLEncoder(),
 
                 new NetconfMessageAggregator(FramingMechanism.CHUNK), new NetconfMessageChunkDecoder(),
-                new ProtocolMessageDecoder<NetconfMessage>(msgFactory));
+                new NetconfXMLToMessageDecoder());
 
         testChunkChannel.writeOutbound(this.msg);
         Queue<Object> messages = testChunkChannel.outboundMessages();
         assertFalse(messages.isEmpty());
 
-        int msgLength = this.msgFactory.put(this.msg).length;
+        final NetconfMessageToXMLEncoder enc = new NetconfMessageToXMLEncoder();
+        final ByteBuf out = Unpooled.buffer();
+        enc.encode(null, msg, out);
+        int msgLength = out.readableBytes();
+
         int chunkCount = msgLength / NetconfMessageConstants.MAX_CHUNK_SIZE;
         if ((msgLength % NetconfMessageConstants.MAX_CHUNK_SIZE) != 0) {
             chunkCount++;
@@ -92,8 +94,8 @@ public class MessageParserTest {
     public void testEOMFramingMechanismOnPipeline() throws Exception {
         EmbeddedChannel testChunkChannel = new EmbeddedChannel(
                 FramingMechanismHandlerFactory.createHandler(FramingMechanism.EOM),
-                new ProtocolMessageEncoder<NetconfMessage>(msgFactory), new NetconfMessageAggregator(
-                        FramingMechanism.EOM), new ProtocolMessageDecoder<NetconfMessage>(msgFactory));
+                new NetconfMessageToXMLEncoder(), new NetconfMessageAggregator(
+                        FramingMechanism.EOM), new NetconfXMLToMessageDecoder());
 
         testChunkChannel.writeOutbound(this.msg);
         ByteBuf recievedOutbound = (ByteBuf) testChunkChannel.readOutbound();
index aeee2fb04baea1c4bd1535d7b677fb1f50957d8e..5b4b3d02ea8839b1dddbf5132d16157d0d325324 100644 (file)
@@ -10,22 +10,22 @@ package org.opendaylight.controller.netconf.util;
 
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.concurrent.Promise;
+
 import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.util.handler.FramingMechanismHandlerFactory;
-import org.opendaylight.controller.netconf.util.handler.NetconfHandlerFactory;
 import org.opendaylight.controller.netconf.util.handler.NetconfMessageAggregator;
+import org.opendaylight.controller.netconf.util.handler.NetconfMessageToXMLEncoder;
+import org.opendaylight.controller.netconf.util.handler.NetconfXMLToMessageDecoder;
 import org.opendaylight.controller.netconf.util.messages.FramingMechanism;
-import org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory;
 
 public abstract class AbstractChannelInitializer {
 
     public void initialize(SocketChannel ch, Promise<? extends NetconfSession> promise){
-        NetconfHandlerFactory handlerFactory = new NetconfHandlerFactory(new NetconfMessageFactory());
         ch.pipeline().addLast("aggregator", new NetconfMessageAggregator(FramingMechanism.EOM));
-        ch.pipeline().addLast(handlerFactory.getDecoders());
+        ch.pipeline().addLast(new NetconfXMLToMessageDecoder());
         initializeAfterDecoder(ch, promise);
         ch.pipeline().addLast("frameEncoder", FramingMechanismHandlerFactory.createHandler(FramingMechanism.EOM));
-        ch.pipeline().addLast(handlerFactory.getEncoders());
+        ch.pipeline().addLast(new NetconfMessageToXMLEncoder());
     }
 
     protected abstract void initializeAfterDecoder(SocketChannel ch, Promise<? extends NetconfSession> promise);
diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfHandlerFactory.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfHandlerFactory.java
deleted file mode 100644 (file)
index d878c5e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2013 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,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.netconf.util.handler;
-
-import io.netty.channel.ChannelHandler;
-import org.opendaylight.controller.netconf.api.NetconfMessage;
-import org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory;
-import org.opendaylight.protocol.framework.ProtocolHandlerFactory;
-import org.opendaylight.protocol.framework.ProtocolMessageDecoder;
-import org.opendaylight.protocol.framework.ProtocolMessageEncoder;
-
-public class NetconfHandlerFactory extends ProtocolHandlerFactory<NetconfMessage> {
-
-    public NetconfHandlerFactory(final NetconfMessageFactory msgFactory) {
-        super(msgFactory);
-    }
-
-    @Override
-    public ChannelHandler[] getEncoders() {
-        return new ChannelHandler[] { new ProtocolMessageEncoder(this.msgFactory) };
-    }
-
-    @Override
-    public ChannelHandler[] getDecoders() {
-        return new ChannelHandler[] { new ProtocolMessageDecoder(this.msgFactory) };
-    }
-
-}
index 39182263b6cd9e0c1067d347ad5839efb06281bf..5c00b9b7153818082cd3b2303efec085e6619f30 100644 (file)
@@ -8,19 +8,19 @@
 
 package org.opendaylight.controller.netconf.util.handler;
 
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageDecoder;
+
 import java.nio.charset.Charset;
 import java.util.List;
 
+import org.opendaylight.controller.netconf.api.NetconfDeserializerException;
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageConstants;
-import org.opendaylight.protocol.framework.DeserializerException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.ByteToMessageDecoder;
-
 public class NetconfMessageChunkDecoder extends ByteToMessageDecoder {
 
     private final static Logger logger = LoggerFactory.getLogger(NetconfMessageChunkDecoder.class);
@@ -40,7 +40,7 @@ public class NetconfMessageChunkDecoder extends ByteToMessageDecoder {
                     in.readBytes(byteBufMsg, chunkSize);
                     isParsed = false;
                 } else {
-                    throw new DeserializerException("Unable to parse chunked data or header.");
+                    throw new NetconfDeserializerException("Unable to parse chunked data or header.");
                 }
             } catch (Exception e) {
                 logger.error("Failed to decode chunked message.", e);
diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageToXMLEncoder.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfMessageToXMLEncoder.java
new file mode 100644 (file)
index 0000000..31a4225
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.netconf.util.handler;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.MessageToByteEncoder;
+
+import java.nio.ByteBuffer;
+
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Comment;
+import org.w3c.dom.Document;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Charsets;
+import com.google.common.base.Optional;
+
+public final class NetconfMessageToXMLEncoder extends MessageToByteEncoder<NetconfMessage> {
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfMessageToXMLEncoder.class);
+
+    private final Optional<String> clientId;
+
+    public NetconfMessageToXMLEncoder() {
+        this(Optional.<String>absent());
+    }
+
+    public NetconfMessageToXMLEncoder(Optional<String> clientId) {
+        this.clientId = clientId;
+    }
+
+    @Override
+    @VisibleForTesting
+    public void encode(ChannelHandlerContext ctx, NetconfMessage msg, ByteBuf out) throws Exception {
+        LOG.debug("Sent to encode : {}", msg);
+
+        if (clientId.isPresent()) {
+            Comment comment = msg.getDocument().createComment("clientId:" + clientId.get());
+            msg.getDocument().appendChild(comment);
+        }
+
+        final ByteBuffer msgBytes;
+        if(msg.getAdditionalHeader().isPresent()) {
+            final String header = msg.getAdditionalHeader().get();
+            LOG.trace("Header of netconf message parsed \n{}", header);
+            // FIXME: this can be written in pieces
+            msgBytes = Charsets.UTF_8.encode(header + xmlToString(msg.getDocument()));
+        } else {
+            msgBytes = Charsets.UTF_8.encode(xmlToString(msg.getDocument()));
+        }
+
+        LOG.trace("Putting message \n{}", xmlToString(msg.getDocument()));
+        out.writeBytes(msgBytes);
+    }
+
+    private String xmlToString(Document doc) {
+        return XmlUtil.toString(doc, false);
+    }
+}
diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfXMLToMessageDecoder.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfXMLToMessageDecoder.java
new file mode 100644 (file)
index 0000000..2eefb91
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 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,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.netconf.util.handler;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageDecoder;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.List;
+
+import org.opendaylight.controller.netconf.api.NetconfDeserializerException;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Charsets;
+import com.google.common.collect.ImmutableList;
+
+public final class NetconfXMLToMessageDecoder extends ByteToMessageDecoder {
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfXMLToMessageDecoder.class);
+
+    private static final List<byte[]> POSSIBLE_ENDS = ImmutableList.of(
+            new byte[] { ']', '\n' },
+            new byte[] { ']', '\r', '\n' });
+    private static final List<byte[]> POSSIBLE_STARTS = ImmutableList.of(
+            new byte[] { '[' },
+            new byte[] { '\r', '\n', '[' },
+            new byte[] { '\n', '[' });
+
+    @Override
+    @VisibleForTesting
+    public void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
+        if (in.readableBytes() == 0) {
+            LOG.debug("No more content in incoming buffer.");
+            return;
+        }
+
+        in.markReaderIndex();
+        try {
+            LOG.trace("Received to decode: {}", ByteBufUtil.hexDump(in));
+            byte[] bytes = new byte[in.readableBytes()];
+            in.readBytes(bytes);
+
+            logMessage(bytes);
+
+            String additionalHeader = null;
+
+            // FIXME: this has to be moved into the negotiator and explained as to what the heck
+            // is going on. This is definitely not specified in NETCONF and has no place here. It
+            // requires reading all data and incurs inefficiency by being unable to pipe the ByteBuf
+            // directly into the XML decoder.
+            if (startsWithAdditionalHeader(bytes)) {
+                // Auth information containing username, ip address... extracted for monitoring
+                int endOfAuthHeader = getAdditionalHeaderEndIndex(bytes);
+                if (endOfAuthHeader > -1) {
+                    byte[] additionalHeaderBytes = Arrays.copyOfRange(bytes, 0, endOfAuthHeader + 2);
+                    additionalHeader = additionalHeaderToString(additionalHeaderBytes);
+                    bytes = Arrays.copyOfRange(bytes, endOfAuthHeader + 2, bytes.length);
+                }
+            }
+            NetconfMessage message;
+            try {
+                Document doc = XmlUtil.readXmlToDocument(new ByteArrayInputStream(bytes));
+                message = new NetconfMessage(doc, additionalHeader);
+            } catch (final SAXException | IOException | IllegalStateException e) {
+                throw new NetconfDeserializerException("Could not parse message from " + new String(bytes), e);
+            }
+
+            out.add(message);
+        } finally {
+            in.discardReadBytes();
+        }
+    }
+
+    private int getAdditionalHeaderEndIndex(byte[] bytes) {
+        for (byte[] possibleEnd : POSSIBLE_ENDS) {
+            int idx = findByteSequence(bytes, possibleEnd);
+
+            if (idx != -1) {
+                return idx;
+            }
+        }
+
+        return -1;
+    }
+
+    private static int findByteSequence(final byte[] bytes, final byte[] sequence) {
+        if (bytes.length < sequence.length) {
+            throw new IllegalArgumentException("Sequence to be found is longer than the given byte array.");
+        }
+        if (bytes.length == sequence.length) {
+            if (Arrays.equals(bytes, sequence)) {
+                return 0;
+            } else {
+                return -1;
+            }
+        }
+        int j = 0;
+        for (int i = 0; i < bytes.length; i++) {
+            if (bytes[i] == sequence[j]) {
+                j++;
+                if (j == sequence.length) {
+                    return i - j + 1;
+                }
+            } else {
+                j = 0;
+            }
+        }
+        return -1;
+    }
+
+    private boolean startsWithAdditionalHeader(byte[] bytes) {
+        for (byte[] possibleStart : POSSIBLE_STARTS) {
+            int i = 0;
+            for (byte b : possibleStart) {
+                if(bytes[i] != b)
+                    break;
+
+                return true;
+            }
+        }
+
+        return false;
+    };
+
+    private void logMessage(byte[] bytes) {
+        String s = Charsets.UTF_8.decode(ByteBuffer.wrap(bytes)).toString();
+        LOG.debug("Parsing message \n{}", s);
+    }
+
+    private String additionalHeaderToString(byte[] bytes) {
+        return Charsets.UTF_8.decode(ByteBuffer.wrap(bytes)).toString();
+    }
+
+}
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 86081b7f81d0f342669fdb1c7124b74dbff3157b..ba6364662cc5aae73bd0701e5084d263221c4575 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.controller.netconf.util.mapping;
 
+import java.util.Map;
+
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.api.NetconfOperationRouter;
 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;
@@ -20,8 +22,6 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
-import java.util.Map;
-
 public abstract class AbstractNetconfOperation implements NetconfOperation {
     private final String netconfSessionIdForReporting;
 
@@ -29,7 +29,7 @@ public abstract class AbstractNetconfOperation implements NetconfOperation {
         this.netconfSessionIdForReporting = netconfSessionIdForReporting;
     }
 
-    public String getNetconfSessionIdForReporting() {
+    public final String getNetconfSessionIdForReporting() {
         return netconfSessionIdForReporting;
     }
 
@@ -67,7 +67,7 @@ public abstract class AbstractNetconfOperation implements NetconfOperation {
     protected abstract HandlingPriority canHandle(String operationName, String netconfOperationNamespace);
 
     @Override
-    public Document handle(Document message, NetconfOperationRouter opRouter) throws NetconfDocumentedException {
+    public final Document handle(Document message, NetconfOperationRouter opRouter) throws NetconfDocumentedException {
 
         XmlElement requestElement = getRequestElementWithCheck(message);
 
diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageFactory.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfMessageFactory.java
deleted file mode 100644 (file)
index 6f86cc3..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2013 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,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.controller.netconf.util.messages;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.List;
-
-import org.opendaylight.controller.netconf.api.NetconfDeserializerException;
-import org.opendaylight.controller.netconf.api.NetconfMessage;
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;
-import org.opendaylight.protocol.framework.DeserializerException;
-import org.opendaylight.protocol.framework.DocumentedException;
-import org.opendaylight.protocol.framework.ProtocolMessageFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableList;
-
-/**
- * NetconfMessageFactory for (de)serializing DOM documents.
- */
-public final class NetconfMessageFactory implements ProtocolMessageFactory<NetconfMessage> {
-
-    private static final Logger logger = LoggerFactory.getLogger(NetconfMessageFactory.class);
-    private static final List<byte[]> POSSIBLE_STARTS = ImmutableList.of(
-        "[".getBytes(Charsets.UTF_8), "\r\n[".getBytes(Charsets.UTF_8), "\n[".getBytes(Charsets.UTF_8));
-    private static final List<byte[]> POSSIBLE_ENDS = ImmutableList.of(
-        "]\n".getBytes(Charsets.UTF_8), "]\r\n".getBytes(Charsets.UTF_8));
-
-    private final Optional<String> clientId;
-
-    public NetconfMessageFactory() {
-        clientId = Optional.absent();
-    }
-
-    public NetconfMessageFactory(Optional<String> clientId) {
-        this.clientId = clientId;
-    }
-
-    @Override
-    public NetconfMessage parse(byte[] bytes) throws DeserializerException, DocumentedException {
-        logMessage(bytes);
-
-        String additionalHeader = null;
-
-        if (startsWithAdditionalHeader(bytes)) {
-            // Auth information containing username, ip address... extracted for monitoring
-            int endOfAuthHeader = getAdditionalHeaderEndIndex(bytes);
-            if (endOfAuthHeader > -1) {
-                byte[] additionalHeaderBytes = Arrays.copyOfRange(bytes, 0, endOfAuthHeader + 2);
-                additionalHeader = additionalHeaderToString(additionalHeaderBytes);
-                bytes = Arrays.copyOfRange(bytes, endOfAuthHeader + 2, bytes.length);
-            }
-        }
-        NetconfMessage message;
-        try {
-            Document doc = XmlUtil.readXmlToDocument(new ByteArrayInputStream(bytes));
-            message = new NetconfMessage(doc, additionalHeader);
-        } catch (final SAXException | IOException | IllegalStateException e) {
-            throw new NetconfDeserializerException("Could not parse message from " + new String(bytes), e);
-        }
-        return message;
-    }
-
-    private static int findByteSequence(final byte[] bytes, final byte[] sequence) {
-        if (bytes.length < sequence.length) {
-            throw new IllegalArgumentException("Sequence to be found is longer than the given byte array.");
-        }
-        if (bytes.length == sequence.length) {
-            if (Arrays.equals(bytes, sequence)) {
-                return 0;
-            } else {
-                return -1;
-            }
-        }
-        int j = 0;
-        for (int i = 0; i < bytes.length; i++) {
-            if (bytes[i] == sequence[j]) {
-                j++;
-                if (j == sequence.length) {
-                    return i - j + 1;
-                }
-            } else {
-                j = 0;
-            }
-        }
-        return -1;
-    }
-
-    private int getAdditionalHeaderEndIndex(byte[] bytes) {
-        for (byte[] possibleEnd : POSSIBLE_ENDS) {
-            int idx = findByteSequence(bytes, possibleEnd);
-
-            if (idx != -1) {
-                return idx;
-            }
-        }
-
-        return -1;
-    }
-
-    private boolean startsWithAdditionalHeader(byte[] bytes) {
-        for (byte[] possibleStart : POSSIBLE_STARTS) {
-            int i = 0;
-            for (byte b : possibleStart) {
-                if(bytes[i] != b)
-                    break;
-
-                return true;
-            }
-        }
-
-        return false;
-    };
-
-    private void logMessage(byte[] bytes) {
-        String s = Charsets.UTF_8.decode(ByteBuffer.wrap(bytes)).toString();
-        logger.debug("Parsing message \n{}", s);
-    }
-
-    private String additionalHeaderToString(byte[] bytes) {
-        return Charsets.UTF_8.decode(ByteBuffer.wrap(bytes)).toString();
-    }
-
-    @Override
-    public byte[] put(NetconfMessage netconfMessage) {
-        if (clientId.isPresent()) {
-            Comment comment = netconfMessage.getDocument().createComment("clientId:" + clientId.get());
-            netconfMessage.getDocument().appendChild(comment);
-        }
-        ByteBuffer msgBytes;
-        if(netconfMessage.getAdditionalHeader().isPresent()) {
-            String header = netconfMessage.getAdditionalHeader().get();
-            logger.trace("Header of netconf message parsed \n{}", header);
-            msgBytes = Charsets.UTF_8.encode(header + xmlToString(netconfMessage.getDocument()));
-        } else {
-            msgBytes = Charsets.UTF_8.encode(xmlToString(netconfMessage.getDocument()));
-        }
-        String content = xmlToString(netconfMessage.getDocument());
-
-        logger.trace("Putting message \n{}", content);
-        byte[] b = new byte[msgBytes.limit()];
-        msgBytes.get(b);
-        return b;
-    }
-
-    private String xmlToString(Document doc) {
-        return XmlUtil.toString(doc, false);
-    }
-}
index f8c90836b977ab832bfb6b735df2e7f6d1de0b39..c405d9bcb5c364e014434eda79aa271ae87e5525 100644 (file)
@@ -7,19 +7,26 @@
  */
 package org.opendaylight.controller.netconf.util.messages;
 
-import com.google.common.io.Files;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import io.netty.buffer.Unpooled;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
 
-public class NetconfMessageFactoryTest {
+import org.junit.Test;
+import org.opendaylight.controller.netconf.util.handler.NetconfXMLToMessageDecoder;
 
+import com.google.common.io.Files;
 
+public class NetconfMessageFactoryTest {
     @Test
     public void testAuth() throws Exception {
-        NetconfMessageFactory parser = new NetconfMessageFactory();
+        NetconfXMLToMessageDecoder parser = new NetconfXMLToMessageDecoder();
         File authHelloFile = new File(getClass().getResource("/netconfMessages/client_hello_with_auth.xml").getFile());
-        parser.parse(Files.toByteArray(authHelloFile));
 
+        final List<Object> out = new ArrayList<>();
+        parser.decode(null, Unpooled.wrappedBuffer(Files.toByteArray(authHelloFile)), out);
+        assertEquals(1, out.size());
     }
 }
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));
+    }
 }