Bump upstreams 19/110219/8
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 11 Feb 2024 23:46:37 +0000 (00:46 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 3 Mar 2024 15:10:32 +0000 (16:10 +0100)
Adopt:
- yangtools-13.0.1
- mdsal-13.0.0
- controller-9.0.0
- aaa-0.19.1
- netconf-7.0.0

Change-Id: Ib107ffb24768c9192caf8024c48ecf9f671c947d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
28 files changed:
commons/parent/pom.xml
features/odl-lispflowmapping-inmemorydb/pom.xml
features/odl-lispflowmapping-inmemorydb/src/main/feature/feature.xml
features/odl-lispflowmapping-mappingservice/pom.xml
features/odl-lispflowmapping-mappingservice/src/main/feature/feature.xml
features/odl-lispflowmapping-models/pom.xml
features/odl-lispflowmapping-models/src/main/feature/feature.xml
features/odl-lispflowmapping-southbound/pom.xml
features/odl-lispflowmapping-southbound/src/main/feature/feature.xml
integrationtest/pom.xml
mappingservice/api/pom.xml
mappingservice/dsbackend/src/main/java/org/opendaylight/lispflowmapping/dsbackend/DataStoreBackEnd.java
mappingservice/dsbackend/src/test/java/org/opendaylight/lispflowmapping/dsbackend/DataStoreBackEndTest.java
mappingservice/implementation/pom.xml
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/AbstractDataListener.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/AuthenticationKeyDataListener.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/MappingDataListener.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/LispMappingServiceTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/mdsal/AuthenticationKeyDataListenerTest.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/mdsal/MappingDataListenerTest.java
mappingservice/lisp-proto/pom.xml
mappingservice/pom.xml
mappingservice/southbound/pom.xml
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/LispSouthboundPlugin.java
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/lisp/AuthenticationKeyDataListener.java
mappingservice/southbound/src/test/java/org/opendaylight/lispflowmapping/southbound/LispSouthboundPluginTest.java
mappingservice/southbound/src/test/java/org/opendaylight/lispflowmapping/southbound/lisp/AuthenticationKeyDataListenerTest.java

index b3e267f06e448eb692efdc71c12d89a5efa76c2a..700172b969d1d9ae7d768a1fa8dd32ca196e9dcf 100644 (file)
       <dependency>
         <groupId>org.opendaylight.mdsal</groupId>
         <artifactId>mdsal-artifacts</artifactId>
-        <version>12.0.4</version>
+        <version>13.0.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>controller-artifacts</artifactId>
-        <version>8.0.4</version>
+        <version>9.0.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
index 031411a5cbb64b3337d229c382c7127b939488f3..ee89eb51363fe1d4ea462a5de48798a9c510ad11 100644 (file)
@@ -29,7 +29,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>controller-artifacts</artifactId>
-        <version>8.0.4</version>
+        <version>9.0.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
index d791937115ba7141f17d5eeb609dfa286c39b48b..6de7bc5f646488112928b1d58d715c33c0f8cf15 100644 (file)
@@ -8,6 +8,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
 -->
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-lispflowmapping-inmemorydb">
     <feature name="odl-lispflowmapping-inmemorydb">
-        <feature version="[8,9)">odl-mdsal-broker</feature>
+        <feature version="[9,10)">odl-mdsal-broker</feature>
     </feature>
 </features>
index b3ada59302350cbf802f3af1e34dac2172958cf7..3378760a1cd0b14b06925e8fed257345ef214e4a 100644 (file)
@@ -29,7 +29,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <dependency>
         <groupId>org.opendaylight.netconf</groupId>
         <artifactId>netconf-artifacts</artifactId>
-        <version>6.0.6</version>
+        <version>7.0.0</version>
         <scope>import</scope>
         <type>pom</type>
       </dependency>
index a323182c6653b09d67df83f36ebadb772c0e0f8e..2ae6a076a067130a48846e71ce9fcc9ddf10995f 100644 (file)
@@ -8,6 +8,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
 -->
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-lispflowmapping-mappingservice">
     <feature name="odl-lispflowmapping-mappingservice">
-        <feature version="[6,7)">odl-restconf</feature>
+        <feature version="[7,8)">odl-restconf</feature>
     </feature>
 </features>
index 5fd5d8030a9ecfe6e80e3f55d9745558afdaedbc..d73bc7c9dc4f16e59b6e0ff673d04d83d7e09884 100644 (file)
@@ -29,7 +29,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <dependency>
         <groupId>org.opendaylight.mdsal</groupId>
         <artifactId>mdsal-artifacts</artifactId>
-        <version>12.0.4</version>
+        <version>13.0.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
index 844fd90839499324ce365790a950d0b16543529e..1e00b109ca18e6f4bbec84310533ec792dc0f190 100644 (file)
@@ -9,6 +9,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-lispflowmapping-models">
     <feature name="odl-lispflowmapping-models">
         <feature version="[13,14)">odl-apache-commons-lang3</feature>
-        <feature version="[12,13)">odl-mdsal-model-rfc6991</feature>
+        <feature version="[13,14)">odl-mdsal-model-rfc6991</feature>
     </feature>
 </features>
index 1a488c9d9d54bf592ab98fbb0b6c4b483771671b..9782bb0631df7e4e92257d8521501140fda6d048 100644 (file)
@@ -29,14 +29,14 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>controller-artifacts</artifactId>
-        <version>8.0.4</version>
+        <version>9.0.0</version>
         <scope>import</scope>
         <type>pom</type>
       </dependency>
       <dependency>
         <groupId>org.opendaylight.netconf</groupId>
         <artifactId>netconf-artifacts</artifactId>
-        <version>6.0.6</version>
+        <version>7.0.0</version>
         <scope>import</scope>
         <type>pom</type>
       </dependency>
index c436ceccdaf3f3230a15318ba595017e627301a8..75a9f1454d3f8671f1a51b3a2769e21cfb8d68a5 100644 (file)
@@ -9,7 +9,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-lispflowmapping-southbound">
     <feature name="odl-lispflowmapping-southbound">
         <feature version="[12,14)">odl-netty-4</feature>
-        <feature version="[8,9)">odl-mdsal-broker</feature>
-        <feature version="[6,7)">odl-restconf</feature>
+        <feature version="[9,10)">odl-mdsal-broker</feature>
+        <feature version="[7,8)">odl-restconf</feature>
     </feature>
 </features>
index 384f185e9fa4a21aa29b69a4951967a6819f5929..110b90c9ca80688a82399873ac46c7132d5ae6ac 100644 (file)
@@ -11,7 +11,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <parent>
     <groupId>org.opendaylight.controller</groupId>
     <artifactId>mdsal-it-parent</artifactId>
-    <version>8.0.4</version>
+    <version>9.0.0</version>
     <relativePath/>
   </parent>
 
index b425637044ba491e0c27ce025f4b7c67fd79c2ef..3a696d57e24140c83134b7587dd48cf5e8bca58e 100644 (file)
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.opendaylight.mdsal</groupId>
     <artifactId>binding-parent</artifactId>
-    <version>12.0.4</version>
+    <version>13.0.0</version>
     <relativePath/>
   </parent>
 
index 93375c4cd7453ab526957f0b10b80791b6a8b118..e02a61e8ec7bee11d25d47fe076c998a892e1e72 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.lispflowmapping.dsbackend;
 
 import static java.util.Objects.requireNonNull;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -21,9 +22,7 @@ import java.util.concurrent.ExecutionException;
 import org.opendaylight.lispflowmapping.lisp.util.LispAddressStringifier;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.Transaction;
 import org.opendaylight.mdsal.binding.api.TransactionChain;
-import org.opendaylight.mdsal.binding.api.TransactionChainListener;
 import org.opendaylight.mdsal.binding.api.WriteTransaction;
 import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
@@ -36,7 +35,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev15090
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.LastUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.LastUpdatedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier;
+import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Empty;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,7 +46,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author Lorand Jakab
  */
-public class DataStoreBackEnd implements TransactionChainListener {
+public class DataStoreBackEnd {
     private static final Logger LOG = LoggerFactory.getLogger(DataStoreBackEnd.class);
     private static final InstanceIdentifier<MappingDatabase> DATABASE_ROOT =
             InstanceIdentifier.create(MappingDatabase.class);
@@ -58,8 +59,30 @@ public class DataStoreBackEnd implements TransactionChainListener {
     @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR", justification = "Non-final for mocking")
     public DataStoreBackEnd(DataBroker broker) {
         LOG.debug("Creating DataStoreBackEnd transaction chain...");
-        configTxChain = broker.createMergingTransactionChain(this);
-        operTxChain = broker.createMergingTransactionChain(this);
+        configTxChain = broker.createMergingTransactionChain();
+        operTxChain = broker.createMergingTransactionChain();
+        configTxChain.addCallback(new FutureCallback<Empty>() {
+            @Override
+            public void onSuccess(Empty result) {
+                onTransactionChainSuccessful(configTxChain);
+            }
+
+            @Override
+            public void onFailure(Throwable cause) {
+                onTransactionChainFailed(configTxChain, cause);
+            }
+        });
+        operTxChain.addCallback(new FutureCallback<Empty>() {
+            @Override
+            public void onSuccess(Empty result) {
+                onTransactionChainSuccessful(operTxChain);
+            }
+
+            @Override
+            public void onFailure(Throwable cause) {
+                onTransactionChainFailed(operTxChain, cause);
+            }
+        });
     }
 
     public void addAuthenticationKey(AuthenticationKey authenticationKey) {
@@ -223,7 +246,7 @@ public class DataStoreBackEnd implements TransactionChainListener {
 
     public void saveLastUpdateTimestamp() {
         Long timestamp = System.currentTimeMillis();
-        LOG.debug("MD-SAL: Saving last update timestamp to operational datastore: {}", new Date(timestamp).toString());
+        LOG.debug("MD-SAL: Saving last update timestamp to operational datastore: {}", new Date(timestamp));
         writePutTransaction(LAST_UPDATED, new LastUpdatedBuilder().setLastUpdated(timestamp).build(),
                 LogicalDatastoreType.OPERATIONAL, "Couldn't save last update timestamp to operational datastore");
     }
@@ -259,15 +282,15 @@ public class DataStoreBackEnd implements TransactionChainListener {
         };
     }
 
-    private <U extends org.opendaylight.yangtools.yang.binding.DataObject> void writePutTransaction(
-            InstanceIdentifier<U> addIID, U data, LogicalDatastoreType logicalDatastoreType, String errMsg) {
+    private <U extends DataObject> void writePutTransaction(InstanceIdentifier<U> addIID, U data,
+            LogicalDatastoreType logicalDatastoreType, String errMsg) {
         WriteTransaction writeTx = getChain(logicalDatastoreType).newWriteOnlyTransaction();
         // TODO: is is a utility method, hence we do not have enough lifecycle knowledge to use plain put()
         writeTx.mergeParentStructurePut(logicalDatastoreType, addIID, data);
         writeTx.commit().addCallback(new FutureCallback<CommitInfo>() {
-
             @Override
             public void onSuccess(CommitInfo result) {
+                // No-op
             }
 
             @Override
@@ -277,8 +300,8 @@ public class DataStoreBackEnd implements TransactionChainListener {
         }, MoreExecutors.directExecutor());
     }
 
-    private <U extends org.opendaylight.yangtools.yang.binding.DataObject> U readTransaction(
-            InstanceIdentifier<U> readIID, LogicalDatastoreType logicalDatastoreType) {
+    private <U extends DataObject> U readTransaction(InstanceIdentifier<U> readIID,
+            LogicalDatastoreType logicalDatastoreType) {
         final ListenableFuture<Optional<U>> readFuture;
         try (ReadTransaction readTx = getChain(logicalDatastoreType).newReadOnlyTransaction()) {
             readFuture = readTx.read(logicalDatastoreType, readIID);
@@ -296,8 +319,8 @@ public class DataStoreBackEnd implements TransactionChainListener {
         return null;
     }
 
-    private <U extends org.opendaylight.yangtools.yang.binding.DataObject> void deleteTransaction(
-            InstanceIdentifier<U> deleteIID, LogicalDatastoreType logicalDatastoreType, String errMsg) {
+    private <U extends DataObject> void deleteTransaction(InstanceIdentifier<U> deleteIID,
+            LogicalDatastoreType logicalDatastoreType, String errMsg) {
         WriteTransaction writeTx = getChain(logicalDatastoreType).newWriteOnlyTransaction();
         writeTx.delete(logicalDatastoreType, deleteIID);
         writeTx.commit().addCallback(new FutureCallback<CommitInfo>() {
@@ -312,14 +335,13 @@ public class DataStoreBackEnd implements TransactionChainListener {
         }, MoreExecutors.directExecutor());
     }
 
-    @Override
-    public void onTransactionChainFailed(TransactionChain chain, Transaction transaction, Throwable cause) {
-        LOG.error("Broken chain {} in DataStoreBackEnd, transaction {}, cause {}", chain, transaction.getIdentifier(),
-                cause.getMessage());
+    @VisibleForTesting
+    void onTransactionChainFailed(TransactionChain chain, Throwable cause) {
+        LOG.error("Broken chain {} in DataStoreBackEnd, cause {}", chain, cause.getMessage());
     }
 
-    @Override
-    public void onTransactionChainSuccessful(TransactionChain chain) {
+    @VisibleForTesting
+    void onTransactionChainSuccessful(TransactionChain chain) {
         LOG.info("DataStoreBackEnd closed successfully, chain {}", chain);
     }
 
index 4a1e71fe9db9e166a8de72e6e71a92666aaa23fd..69b9a430d2890ed031fd2ddaebf6a957c39c765c 100644 (file)
@@ -27,7 +27,6 @@ import org.opendaylight.lispflowmapping.lisp.util.LispAddressStringifier;
 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.Transaction;
 import org.opendaylight.mdsal.binding.api.TransactionChain;
 import org.opendaylight.mdsal.binding.api.WriteTransaction;
 import org.opendaylight.mdsal.common.api.CommitInfo;
@@ -100,7 +99,7 @@ public class DataStoreBackEndTest {
         PowerMockito.when(LoggerFactory.getLogger(DataStoreBackEnd.class))
                 .thenReturn(logMock);
         Mockito.when(logMock.isDebugEnabled()).thenReturn(true);
-        Mockito.when(brokerMock.createMergingTransactionChain(Mockito.any(DataStoreBackEnd.class)))
+        Mockito.when(brokerMock.createMergingTransactionChain())
                 .thenReturn(txChainMock);
         dataStoreBackEnd = PowerMockito.spy(new DataStoreBackEnd(brokerMock));
 
@@ -306,10 +305,7 @@ public class DataStoreBackEndTest {
      */
     @Test
     public void onTransactionChainFailedTest() {
-        Transaction asyncTransactionMock = Mockito.mock(Transaction.class);
-        Mockito.when(asyncTransactionMock.getIdentifier()).thenReturn(new Object());
-        dataStoreBackEnd.onTransactionChainFailed(Mockito.mock(TransactionChain.class), asyncTransactionMock,
-                Mockito.mock(Throwable.class));
+        dataStoreBackEnd.onTransactionChainFailed(Mockito.mock(TransactionChain.class), Mockito.mock(Throwable.class));
     }
 
     /**
index 55bc216f0db7c5ff46b72b75bc6e1f854ac33129..2692504cbe11368832c13c5f99807c5c479ac5b7 100644 (file)
     <!-- needed for osgi console -->
     <dependency>
       <groupId>org.opendaylight.mdsal</groupId>
-      <artifactId>mdsal-singleton-common-api</artifactId>
+      <artifactId>mdsal-singleton-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.mdsal</groupId>
-      <artifactId>mdsal-singleton-dom-impl</artifactId>
+      <artifactId>mdsal-singleton-impl</artifactId>
     </dependency>
   </dependencies>
 
index c9b28994441bbef82e16cac1a9326094c958a8b1..aeaa3f4d12beae6b19317168643ef5f2ac8e565a 100644 (file)
@@ -31,10 +31,10 @@ import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
 import org.opendaylight.lispflowmapping.lisp.util.LispAddressStringifier;
 import org.opendaylight.mdsal.binding.api.NotificationService;
 import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
-import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
+import org.opendaylight.mdsal.binding.api.RpcService;
+import org.opendaylight.mdsal.singleton.api.ClusterSingletonService;
+import org.opendaylight.mdsal.singleton.api.ClusterSingletonServiceProvider;
+import org.opendaylight.mdsal.singleton.api.ServiceGroupIdentifier;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.AddMapping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify;
@@ -76,9 +76,8 @@ import org.slf4j.LoggerFactory;
         immediate = true, property = "type=default")
 public class LispMappingService implements IFlowMapping, IMapRequestResultHandler,
         IMapNotifyHandler, AutoCloseable, ClusterSingletonService {
-    private static final String LISPFLOWMAPPING_ENTITY_NAME = "lispflowmapping";
-    private static final ServiceGroupIdentifier SERVICE_GROUP_IDENTIFIER = ServiceGroupIdentifier.create(
-            LISPFLOWMAPPING_ENTITY_NAME);
+    private static final ServiceGroupIdentifier SERVICE_GROUP_IDENTIFIER =
+        new ServiceGroupIdentifier("lispflowmapping");
 
     private static final Logger LOG = LoggerFactory.getLogger(LispMappingService.class);
 
@@ -104,7 +103,7 @@ public class LispMappingService implements IFlowMapping, IMapRequestResultHandle
     @Activate
     public LispMappingService(@Reference final IMappingService mappingService,
             @Reference final ClusterSingletonServiceProvider clusterSingletonService,
-            @Reference final RpcConsumerRegistry rpcService, @Reference final NotificationService notificationService) {
+            @Reference final RpcService rpcService, @Reference final NotificationService notificationService) {
         this.mapService = mappingService;
         sendMapRequest = rpcService.getRpc(SendMapRequest.class);
         sendMapReply = rpcService.getRpc(SendMapReply.class);
index 40ba2704f074dcc2cc77ddd6b09af7d65fc996a2..88ef3aeeade570df5b358387d7fe2af558979b09 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.lispflowmapping.implementation.mdsal;
 
-import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-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;
 
@@ -19,20 +19,17 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * The superclass for the different MD-SAL data change event listeners.
  *
  */
-public abstract class AbstractDataListener<T extends DataObject> implements ClusteredDataTreeChangeListener<T> {
+public abstract class AbstractDataListener<T extends DataObject> implements DataTreeChangeListener<T> {
     private DataBroker broker;
     private InstanceIdentifier<T> path;
-    private ListenerRegistration<ClusteredDataTreeChangeListener<T>> configRegistration;
-    private ListenerRegistration<ClusteredDataTreeChangeListener<T>> operRegistration;
+    private Registration configRegistration;
+    private Registration operRegistration;
 
     void registerDataChangeListener() {
-        final DataTreeIdentifier<T> configDataTreeIdentifier = DataTreeIdentifier.create(
-                LogicalDatastoreType.CONFIGURATION, path);
-        final DataTreeIdentifier<T> operDataTreeIdentifier = DataTreeIdentifier.create(
-                LogicalDatastoreType.OPERATIONAL, path);
-
-        configRegistration = broker.registerDataTreeChangeListener(configDataTreeIdentifier, this);
-        operRegistration = broker.registerDataTreeChangeListener(operDataTreeIdentifier, this);
+        configRegistration = broker.registerTreeChangeListener(
+            DataTreeIdentifier.of(LogicalDatastoreType.CONFIGURATION, path), this);
+        operRegistration = broker.registerTreeChangeListener(
+            DataTreeIdentifier.of(LogicalDatastoreType.OPERATIONAL, path), this);
     }
 
     public void closeDataChangeListener() {
@@ -47,5 +44,4 @@ public abstract class AbstractDataListener<T extends DataObject> implements Clus
     void setPath(InstanceIdentifier<T> path) {
         this.path = path;
     }
-
 }
index 17a8c21ee42ba0fd91faeac19250ab1f458ae9fd..941d001d8a03f5f07fda3d7799e354a3c74925c9 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.lispflowmapping.implementation.mdsal;
 
-import java.util.Collection;
+import java.util.List;
 import org.opendaylight.lispflowmapping.interfaces.mapcache.IMappingSystem;
 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
 import org.opendaylight.mdsal.binding.api.DataBroker;
@@ -43,38 +43,38 @@ public class AuthenticationKeyDataListener extends AbstractDataListener<Authenti
     }
 
     @Override
-    public void onDataTreeChanged(Collection<DataTreeModification<AuthenticationKey>> changes) {
+    public void onDataTreeChanged(List<DataTreeModification<AuthenticationKey>> changes) {
         for (DataTreeModification<AuthenticationKey> change : changes) {
             final DataObjectModification<AuthenticationKey> mod = change.getRootNode();
 
-            if (ModificationType.DELETE == mod.getModificationType()) {
-                final AuthenticationKey authKey = mod.getDataBefore();
+            if (ModificationType.DELETE == mod.modificationType()) {
+                final AuthenticationKey authKey = mod.dataBefore();
 
                 LOG.trace("Received deleted data");
-                LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
+                LOG.trace("Key: {}", change.getRootPath().path());
                 LOG.trace("Value: {}", authKey);
 
                 final AuthenticationKey convertedAuthKey = convertToBinaryIfNecessary(authKey);
 
                 mapSystem.removeAuthenticationKey(convertedAuthKey.getEid());
-            } else if (ModificationType.WRITE == mod.getModificationType() || ModificationType.SUBTREE_MODIFIED == mod
-                    .getModificationType()) {
-                if (ModificationType.WRITE == mod.getModificationType()) {
+            } else if (ModificationType.WRITE == mod.modificationType()
+                    || ModificationType.SUBTREE_MODIFIED == mod.modificationType()) {
+                if (ModificationType.WRITE == mod.modificationType()) {
                     LOG.trace("Received created data");
                 } else {
                     LOG.trace("Received updated data");
                 }
                 // Process newly created or updated authentication keys
-                final AuthenticationKey authKey = mod.getDataAfter();
+                final AuthenticationKey authKey = mod.dataAfter();
 
-                LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
+                LOG.trace("Key: {}", change.getRootPath().path());
                 LOG.trace("Value: {}", authKey);
 
                 final AuthenticationKey convertedAuthKey = convertToBinaryIfNecessary(authKey);
 
                 mapSystem.addAuthenticationKey(convertedAuthKey.getEid(), convertedAuthKey.getMappingAuthkey());
             } else {
-                LOG.warn("Ignoring unhandled modification type {}", mod.getModificationType());
+                LOG.warn("Ignoring unhandled modification type {}", mod.modificationType());
             }
         }
     }
@@ -90,6 +90,6 @@ public class AuthenticationKeyDataListener extends AbstractDataListener<Authenti
     }
 
     void setMappingSystem(IMappingSystem msmr) {
-        this.mapSystem = msmr;
+        mapSystem = msmr;
     }
 }
index a7cde7558a9edfddb6e8db38bb3044fdf2c45963..e2a0afdb1e4bf216fb1ca23a83ecc2bc8eb80498 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.lispflowmapping.implementation.mdsal;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import org.opendaylight.lispflowmapping.interfaces.mapcache.IMappingSystem;
 import org.opendaylight.lispflowmapping.lisp.type.MappingData;
@@ -64,14 +63,14 @@ public class MappingDataListener extends AbstractDataListener<Mapping> {
     }
 
     @Override
-    public void onDataTreeChanged(Collection<DataTreeModification<Mapping>> changes) {
+    public void onDataTreeChanged(List<DataTreeModification<Mapping>> changes) {
         for (DataTreeModification<Mapping> change : changes) {
             final DataObjectModification<Mapping> mod = change.getRootNode();
 
-            if (ModificationType.DELETE == mod.getModificationType()) {
+            if (ModificationType.DELETE == mod.modificationType()) {
                 // Process deleted mappings
 
-                final Mapping mapping = mod.getDataBefore();
+                final Mapping mapping = mod.dataBefore();
 
                 // Only treat mapping changes caused by Northbound, since Southbound changes are already handled
                 // before being persisted, except for cluster slaves
@@ -80,16 +79,16 @@ public class MappingDataListener extends AbstractDataListener<Mapping> {
                 }
 
                 LOG.trace("Received deleted data");
-                LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
+                LOG.trace("Key: {}", change.getRootPath().path());
                 LOG.trace("Value: {}", mapping);
 
                 final Mapping convertedMapping = convertToBinaryIfNecessary(mapping);
 
                 mapSystem.removeMapping(convertedMapping.getOrigin(), convertedMapping.getMappingRecord().getEid());
 
-            } else if (ModificationType.SUBTREE_MODIFIED == mod.getModificationType() || ModificationType.WRITE == mod
-                    .getModificationType()) {
-                final Mapping mapping = mod.getDataAfter();
+            } else if (ModificationType.SUBTREE_MODIFIED == mod.modificationType()
+                       || ModificationType.WRITE == mod.modificationType()) {
+                final Mapping mapping = mod.dataAfter();
 
                 // Only treat mapping changes caused by Northbound, since Southbound changes are already handled
                 // before being persisted, except for cluster slaves XXX separate NB and SB to avoid ignoring
@@ -101,21 +100,21 @@ public class MappingDataListener extends AbstractDataListener<Mapping> {
                 final Mapping convertedMapping = convertToBinaryIfNecessary(mapping);
                 Eid convertedEid = convertedMapping.getMappingRecord().getEid();
 
-                if (ModificationType.SUBTREE_MODIFIED == mod.getModificationType()) {
+                if (ModificationType.SUBTREE_MODIFIED == mod.modificationType()) {
                     LOG.trace("Received update data");
-                    LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
+                    LOG.trace("Key: {}", change.getRootPath().path());
                     LOG.trace("Value: {}", mapping);
                     mapSystem.updateMapping(convertedMapping.getOrigin(), convertedEid,
                             new MappingData(convertedMapping.getMappingRecord()));
                 } else {
                     LOG.trace("Received write data");
-                    LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
+                    LOG.trace("Key: {}", change.getRootPath().path());
                     LOG.trace("Value: {}", mapping);
                     mapSystem.addMapping(convertedMapping.getOrigin(), convertedEid,
                             new MappingData(convertedMapping.getMappingRecord()));
                 }
             } else {
-                LOG.warn("Ignoring unhandled modification type {}", mod.getModificationType());
+                LOG.warn("Ignoring unhandled modification type {}", mod.modificationType());
             }
         }
     }
index 711f2ae6b98cecd6649582264f911dc5a2f09008..49ef8f72ff677a21b40b7fbfea53bb3ce6c499a9 100644 (file)
@@ -30,8 +30,8 @@ import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServic
 import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
 import org.opendaylight.mdsal.binding.api.NotificationService;
-import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.opendaylight.mdsal.binding.api.RpcService;
+import org.opendaylight.mdsal.singleton.api.ClusterSingletonServiceProvider;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary;
@@ -87,7 +87,7 @@ public class LispMappingServiceTest {
     @Mock(name = "sendMapNotify") private static SendMapNotify sendMapNotify;
 
     private final NotificationService notificationService = Mockito.mock(NotificationService.class);
-    private final RpcConsumerRegistry rpcService = Mockito.mock(RpcConsumerRegistry.class);
+    private final RpcService rpcService = Mockito.mock(RpcService.class);
     private final IMappingService mappingService = Mockito.mock(IMappingService.class);
     private final ClusterSingletonServiceProvider clusterSingletonService = Mockito.mock(
             ClusterSingletonServiceProvider.class);
index de55207a06812e8bd6946595c88a404abedaa153..269cb58ab11426b8590765f4f2c91f04dcf8b93c 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.lispflowmapping.implementation.mdsal;
 
-import com.google.common.collect.Lists;
 import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
@@ -23,9 +22,11 @@ import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkeyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingDatabase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.Uint16;
 
@@ -58,9 +59,10 @@ public class AuthenticationKeyDataListenerTest {
         iMappingSystemMock = Mockito.mock(IMappingSystem.class);
         authenticationKeyDataListener = new AuthenticationKeyDataListener(dataBrokerMock, iMappingSystemMock);
 
-        final InstanceIdentifier<AuthenticationKey> instanceIdentifierMock = Mockito.mock(InstanceIdentifier.class);
-        final DataTreeIdentifier<AuthenticationKey> dataTreeIdentifier =
-                DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, instanceIdentifierMock);
+        final DataTreeIdentifier<AuthenticationKey> dataTreeIdentifier = DataTreeIdentifier.of(
+            LogicalDatastoreType.CONFIGURATION,
+            InstanceIdentifier.create(MappingDatabase.class).child(VirtualNetworkIdentifier.class)
+                .child(AuthenticationKey.class));
 
         change_del = Mockito.mock(DataTreeModification.class);
         change_subtreeModified = Mockito.mock(DataTreeModification.class);
@@ -75,9 +77,9 @@ public class AuthenticationKeyDataListenerTest {
         Mockito.when(change_subtreeModified.getRootNode()).thenReturn(mod_subtreeModified);
         Mockito.when(change_write.getRootPath()).thenReturn(dataTreeIdentifier);
         Mockito.when(change_write.getRootNode()).thenReturn(mod_write);
-        Mockito.when(mod_del.getModificationType()).thenReturn(ModificationType.DELETE);
-        Mockito.when(mod_subtreeModified.getModificationType()).thenReturn(ModificationType.SUBTREE_MODIFIED);
-        Mockito.when(mod_write.getModificationType()).thenReturn(ModificationType.WRITE);
+        Mockito.when(mod_del.modificationType()).thenReturn(ModificationType.DELETE);
+        Mockito.when(mod_subtreeModified.modificationType()).thenReturn(ModificationType.SUBTREE_MODIFIED);
+        Mockito.when(mod_write.modificationType()).thenReturn(ModificationType.WRITE);
     }
 
     /**
@@ -85,10 +87,9 @@ public class AuthenticationKeyDataListenerTest {
      */
     @Test
     public void onDataTreeChangedTest_delete() {
-        final List<DataTreeModification<AuthenticationKey>> changes = Lists.newArrayList(change_del);
-        Mockito.when(mod_del.getDataBefore()).thenReturn(AUTHENTICATION_KEY_1);
+        Mockito.when(mod_del.dataBefore()).thenReturn(AUTHENTICATION_KEY_1);
 
-        authenticationKeyDataListener.onDataTreeChanged(changes);
+        authenticationKeyDataListener.onDataTreeChanged(List.of(change_del));
         Mockito.verify(iMappingSystemMock).removeAuthenticationKey(IPV4_EID_1);
     }
 
@@ -97,10 +98,9 @@ public class AuthenticationKeyDataListenerTest {
      */
     @Test
     public void onDataTreeChangedTest_write() {
-        final List<DataTreeModification<AuthenticationKey>> changes = Lists.newArrayList(change_write);
-        Mockito.when(mod_write.getDataAfter()).thenReturn(AUTHENTICATION_KEY_2);
+        Mockito.when(mod_write.dataAfter()).thenReturn(AUTHENTICATION_KEY_2);
 
-        authenticationKeyDataListener.onDataTreeChanged(changes);
+        authenticationKeyDataListener.onDataTreeChanged(List.of(change_write));
         Mockito.verify(iMappingSystemMock).addAuthenticationKey(IPV4_EID_2, AUTHENTICATION_KEY_2.getMappingAuthkey());
     }
 
@@ -109,10 +109,9 @@ public class AuthenticationKeyDataListenerTest {
      */
     @Test
     public void onDataTreeChangedTest_subtreeModified() {
-        final List<DataTreeModification<AuthenticationKey>> changes = Lists.newArrayList(change_subtreeModified);
-        Mockito.when(mod_subtreeModified.getDataAfter()).thenReturn(AUTHENTICATION_KEY_3);
+        Mockito.when(mod_subtreeModified.dataAfter()).thenReturn(AUTHENTICATION_KEY_3);
 
-        authenticationKeyDataListener.onDataTreeChanged(changes);
+        authenticationKeyDataListener.onDataTreeChanged(List.of(change_subtreeModified));
         Mockito.verify(iMappingSystemMock).addAuthenticationKey(IPV4_EID_3, AUTHENTICATION_KEY_3.getMappingAuthkey());
     }
 
@@ -121,14 +120,11 @@ public class AuthenticationKeyDataListenerTest {
      */
     @Test
     public void onDataTreeChangedTest_multipleModTypes() {
-        final List<DataTreeModification<AuthenticationKey>> changes =
-                Lists.newArrayList(change_del, change_write, change_subtreeModified);
+        Mockito.when(mod_del.dataBefore()).thenReturn(AUTHENTICATION_KEY_1);
+        Mockito.when(mod_write.dataAfter()).thenReturn(AUTHENTICATION_KEY_2);
+        Mockito.when(mod_subtreeModified.dataAfter()).thenReturn(AUTHENTICATION_KEY_3);
 
-        Mockito.when(mod_del.getDataBefore()).thenReturn(AUTHENTICATION_KEY_1);
-        Mockito.when(mod_write.getDataAfter()).thenReturn(AUTHENTICATION_KEY_2);
-        Mockito.when(mod_subtreeModified.getDataAfter()).thenReturn(AUTHENTICATION_KEY_3);
-
-        authenticationKeyDataListener.onDataTreeChanged(changes);
+        authenticationKeyDataListener.onDataTreeChanged(List.of(change_del, change_write, change_subtreeModified));
         Mockito.verify(iMappingSystemMock).removeAuthenticationKey(IPV4_EID_1);
         Mockito.verify(iMappingSystemMock).addAuthenticationKey(IPV4_EID_2, AUTHENTICATION_KEY_2.getMappingAuthkey());
         Mockito.verify(iMappingSystemMock).addAuthenticationKey(IPV4_EID_3, AUTHENTICATION_KEY_3.getMappingAuthkey());
@@ -142,12 +138,11 @@ public class AuthenticationKeyDataListenerTest {
     public void onDataTreeChangedTest_noModType() {
         final DataTreeModification<AuthenticationKey> changeNoModType = Mockito.mock(DataTreeModification.class);
         final DataObjectModification<AuthenticationKey> modNoType = Mockito.mock(DataObjectModification.class);
-        final List<DataTreeModification<AuthenticationKey>> changes = Lists.newArrayList(changeNoModType);
 
         Mockito.when(changeNoModType.getRootNode()).thenReturn(modNoType);
-        Mockito.when(modNoType.getModificationType()).thenReturn(null);
+        Mockito.when(modNoType.modificationType()).thenReturn(null);
 
-        authenticationKeyDataListener.onDataTreeChanged(changes);
+        authenticationKeyDataListener.onDataTreeChanged(List.of(changeNoModType));
         Mockito.verifyZeroInteractions(iMappingSystemMock);
     }
 
index dbe7807bcc82b01f72ea26f46024db56541d409d..8e5558f6455be6a2cdb695ee6e52036c7b6663f2 100644 (file)
@@ -34,14 +34,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.ma
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.EidUri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChange;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChanged;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingDatabase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.Mapping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.MappingKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public class MappingDataListenerTest {
-
     private static IMappingSystem iMappingSystemMock;
     private static NotificationPublishService notificationPublishServiceMock;
 
@@ -77,9 +78,11 @@ public class MappingDataListenerTest {
         mappingDataListener =
                 new MappingDataListener(dataBrokerMock, iMappingSystemMock, notificationPublishServiceMock);
 
-        final InstanceIdentifier<Mapping> instanceIdentifierMock = Mockito.mock(InstanceIdentifier.class);
-        final DataTreeIdentifier<Mapping> dataTreeIdentifier =
-                DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, instanceIdentifierMock);
+        final DataTreeIdentifier<Mapping> dataTreeIdentifier = DataTreeIdentifier.of(
+            LogicalDatastoreType.CONFIGURATION,
+            InstanceIdentifier.create(MappingDatabase.class)
+                .child(VirtualNetworkIdentifier.class)
+                .child(Mapping.class));
 
         change_del = Mockito.mock(DataTreeModification.class);
         change_subtreeModified = Mockito.mock(DataTreeModification.class);
@@ -94,9 +97,9 @@ public class MappingDataListenerTest {
         Mockito.when(change_subtreeModified.getRootNode()).thenReturn(mod_subtreeModified);
         Mockito.when(change_write.getRootPath()).thenReturn(dataTreeIdentifier);
         Mockito.when(change_write.getRootNode()).thenReturn(mod_write);
-        Mockito.when(mod_del.getModificationType()).thenReturn(ModificationType.DELETE);
-        Mockito.when(mod_subtreeModified.getModificationType()).thenReturn(ModificationType.SUBTREE_MODIFIED);
-        Mockito.when(mod_write.getModificationType()).thenReturn(ModificationType.WRITE);
+        Mockito.when(mod_del.modificationType()).thenReturn(ModificationType.DELETE);
+        Mockito.when(mod_subtreeModified.modificationType()).thenReturn(ModificationType.SUBTREE_MODIFIED);
+        Mockito.when(mod_write.modificationType()).thenReturn(ModificationType.WRITE);
         Mockito.when(iMappingSystemMock.isMaster()).thenReturn(true);
     }
 
@@ -106,7 +109,7 @@ public class MappingDataListenerTest {
     @Test
     public void onDataTreeChangedTest_delete_NB() throws InterruptedException {
         final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(change_del);
-        Mockito.when(mod_del.getDataBefore()).thenReturn(MAPPING_EID_1_NB);
+        Mockito.when(mod_del.dataBefore()).thenReturn(MAPPING_EID_1_NB);
 
         mappingDataListener.onDataTreeChanged(changes);
         Mockito.verify(iMappingSystemMock).removeMapping(MappingOrigin.Northbound, IPV4_EID_1);
@@ -118,7 +121,7 @@ public class MappingDataListenerTest {
     @Test
     public void onDataTreeChangedTest_delete_SB() {
         final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(change_del);
-        Mockito.when(mod_del.getDataBefore()).thenReturn(MAPPING_EID_1_SB);
+        Mockito.when(mod_del.dataBefore()).thenReturn(MAPPING_EID_1_SB);
 
         mappingDataListener.onDataTreeChanged(changes);
         //Mockito.verifyZeroInteractions(iMappingSystemMock);
@@ -135,7 +138,7 @@ public class MappingDataListenerTest {
         final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(change_subtreeModified);
         final MappingChanged mapChanged = MSNotificationInputUtil.toMappingChanged(
                 MAPPING_EID_2_NB.getMappingRecord(), null, null, null, MappingChange.Updated);
-        Mockito.when(mod_subtreeModified.getDataAfter()).thenReturn(MAPPING_EID_2_NB);
+        Mockito.when(mod_subtreeModified.dataAfter()).thenReturn(MAPPING_EID_2_NB);
 
         mappingDataListener.onDataTreeChanged(changes);
         final ArgumentCaptor<MappingData> captor = ArgumentCaptor.forClass(MappingData.class);
@@ -152,7 +155,7 @@ public class MappingDataListenerTest {
     @Test
     public void onDataTreeChangedTest_subtreeModified_SB() {
         final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(change_subtreeModified);
-        Mockito.when(mod_subtreeModified.getDataAfter()).thenReturn(MAPPING_EID_2_SB);
+        Mockito.when(mod_subtreeModified.dataAfter()).thenReturn(MAPPING_EID_2_SB);
 
         mappingDataListener.onDataTreeChanged(changes);
         //Mockito.verifyZeroInteractions(iMappingSystemMock);
@@ -168,7 +171,7 @@ public class MappingDataListenerTest {
         final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(change_write);
         final MappingChanged mapChanged = MSNotificationInputUtil.toMappingChanged(
                 MAPPING_EID_3_NB.getMappingRecord(), null, null, null, MappingChange.Created);
-        Mockito.when(mod_write.getDataAfter()).thenReturn(MAPPING_EID_3_NB);
+        Mockito.when(mod_write.dataAfter()).thenReturn(MAPPING_EID_3_NB);
 
         mappingDataListener.onDataTreeChanged(changes);
         final ArgumentCaptor<MappingData> captor = ArgumentCaptor.forClass(MappingData.class);
@@ -184,7 +187,7 @@ public class MappingDataListenerTest {
     @Test
     public void onDataTreeChangedTest_write_SB() {
         final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(change_write);
-        Mockito.when(mod_write.getDataAfter()).thenReturn(MAPPING_EID_3_SB);
+        Mockito.when(mod_write.dataAfter()).thenReturn(MAPPING_EID_3_SB);
 
         mappingDataListener.onDataTreeChanged(changes);
         //Mockito.verifyZeroInteractions(iMappingSystemMock);
@@ -202,9 +205,9 @@ public class MappingDataListenerTest {
         final MappingChanged mapChangedSubtreeMod = MSNotificationInputUtil.toMappingChanged(
                 MAPPING_EID_2_NB.getMappingRecord(), null, null, null, MappingChange.Updated);
 
-        Mockito.when(mod_del.getDataBefore()).thenReturn(MAPPING_EID_1_NB);
-        Mockito.when(mod_subtreeModified.getDataAfter()).thenReturn(MAPPING_EID_2_NB);
-        Mockito.when(mod_write.getDataAfter()).thenReturn(MAPPING_EID_3_SB);
+        Mockito.when(mod_del.dataBefore()).thenReturn(MAPPING_EID_1_NB);
+        Mockito.when(mod_subtreeModified.dataAfter()).thenReturn(MAPPING_EID_2_NB);
+        Mockito.when(mod_write.dataAfter()).thenReturn(MAPPING_EID_3_SB);
 
         mappingDataListener.onDataTreeChanged(changes);
         final ArgumentCaptor<MappingData> captor = ArgumentCaptor.forClass(MappingData.class);
@@ -228,7 +231,7 @@ public class MappingDataListenerTest {
         final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(changeNoModType);
 
         Mockito.when(changeNoModType.getRootNode()).thenReturn(modNoType);
-        Mockito.when(modNoType.getModificationType()).thenReturn(null);
+        Mockito.when(modNoType.modificationType()).thenReturn(null);
 
         mappingDataListener.onDataTreeChanged(changes);
 
@@ -236,7 +239,6 @@ public class MappingDataListenerTest {
         Mockito.verifyZeroInteractions(notificationPublishServiceMock);
     }
 
-
     private static Mapping getDefaultMapping(Eid eid, MappingOrigin origin) {
         final MappingRecord record = new MappingRecordBuilder().setEid(eid).build();
         return new MappingBuilder()
index d5d2708ca18ffae1d2287313a3acd62b96a28b37..e1bdc8ea3f2ccecd1e297ebbba57b4d0adbe7405 100644 (file)
@@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <parent>
     <groupId>org.opendaylight.mdsal</groupId>
     <artifactId>binding-parent</artifactId>
-    <version>12.0.4</version>
+    <version>13.0.0</version>
     <relativePath/>
   </parent>
 
index 93f1528798bdb1f1e4e31b2ffd3cdbc5cea61a7e..3395f56cae27c2882c8b8b57fcb836df2a1475d9 100644 (file)
@@ -38,7 +38,7 @@
       <dependency>
         <groupId>org.opendaylight.mdsal</groupId>
         <artifactId>mdsal-artifacts</artifactId>
-        <version>12.0.4</version>
+        <version>13.0.0</version>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
index 2db47b7138fc007d2a44581f8d48dd613327f022..91ef7ee84852a7c6c62b008f40e7f041dc7a2f63 100644 (file)
     </dependency>
     <dependency>
       <groupId>org.opendaylight.mdsal</groupId>
-      <artifactId>mdsal-singleton-common-api</artifactId>
+      <artifactId>mdsal-singleton-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.mdsal</groupId>
-      <artifactId>mdsal-singleton-dom-impl</artifactId>
+      <artifactId>mdsal-singleton-impl</artifactId>
     </dependency>
     <!-- osgi annotations -->
     <dependency>
index e481fc0f9a0ae4f36044fb4dedba2ff7de2bf062..662030455bd17736ff228dddfc90775d12c2e193 100644 (file)
@@ -50,9 +50,9 @@ import org.opendaylight.lispflowmapping.southbound.lisp.cache.MapRegisterCache;
 import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispSouthboundPlugin;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
+import org.opendaylight.mdsal.singleton.api.ClusterSingletonService;
+import org.opendaylight.mdsal.singleton.api.ClusterSingletonServiceProvider;
+import org.opendaylight.mdsal.singleton.api.ServiceGroupIdentifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MessageType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
@@ -91,7 +91,7 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
     protected static final Logger LOG = LoggerFactory.getLogger(LispSouthboundPlugin.class);
     public static final String LISPFLOWMAPPING_ENTITY_NAME = "lispflowmapping";
     public static final ServiceGroupIdentifier SERVICE_GROUP_IDENTIFIER =
-        ServiceGroupIdentifier.create(LISPFLOWMAPPING_ENTITY_NAME);
+        new ServiceGroupIdentifier(LISPFLOWMAPPING_ENTITY_NAME);
 
     private static final String DEFAULT_BINDING_ADDRESS = "0.0.0.0";
     private static final long DEFAULT_MAP_REGISTER_CACHE_TIMEOUT = 90000;
index 8da1c3e5137ac4abf82f22cfe3d014d87ce02048..e5bf1bd3771a5e489de160f659dd7a4906e80e93 100644 (file)
@@ -7,15 +7,15 @@
  */
 package org.opendaylight.lispflowmapping.southbound.lisp;
 
-import java.util.Collection;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
 import org.opendaylight.lispflowmapping.mapcache.AuthKeyDb;
-import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.DataObjectModification;
 import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
+import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
 import org.opendaylight.mdsal.binding.api.DataTreeModification;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
@@ -26,7 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev15090
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.VirtualNetworkIdentifier;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,25 +35,22 @@ import org.slf4j.LoggerFactory;
  * DataListener for all AuthenticationKey modification events.
  *
  */
-public class AuthenticationKeyDataListener implements ClusteredDataTreeChangeListener<AuthenticationKey> {
+public class AuthenticationKeyDataListener implements DataTreeChangeListener<AuthenticationKey> {
     private static final Logger LOG = LoggerFactory.getLogger(AuthenticationKeyDataListener.class);
 
     private final AuthKeyDb akdb;
-    private final DataBroker broker;
     private final InstanceIdentifier<AuthenticationKey> path;
-    private final ListenerRegistration<ClusteredDataTreeChangeListener<AuthenticationKey>> registration;
+    private final Registration registration;
     private final ConcurrentHashMap<Eid, Long> updatedEntries;
 
     public AuthenticationKeyDataListener(final DataBroker broker, final AuthKeyDb akdb) {
-        this.broker = broker;
         this.akdb = akdb;
-        this.path = InstanceIdentifier.create(MappingDatabase.class).child(VirtualNetworkIdentifier.class)
+        path = InstanceIdentifier.create(MappingDatabase.class).child(VirtualNetworkIdentifier.class)
                 .child(AuthenticationKey.class);
         LOG.trace("Registering AuthenticationKey listener.");
-        final DataTreeIdentifier<AuthenticationKey> dataTreeIdentifier = DataTreeIdentifier.create(
-                LogicalDatastoreType.CONFIGURATION, path);
-        registration = broker.registerDataTreeChangeListener(dataTreeIdentifier, this);
-        this.updatedEntries = new ConcurrentHashMap<>();
+        registration = broker.registerTreeChangeListener(
+            DataTreeIdentifier.of(LogicalDatastoreType.CONFIGURATION, path), this);
+        updatedEntries = new ConcurrentHashMap<>();
     }
 
     public void closeDataChangeListener() {
@@ -61,32 +58,32 @@ public class AuthenticationKeyDataListener implements ClusteredDataTreeChangeLis
     }
 
     @Override
-    public synchronized void onDataTreeChanged(Collection<DataTreeModification<AuthenticationKey>> changes) {
+    public synchronized void onDataTreeChanged(final List<DataTreeModification<AuthenticationKey>> changes) {
         for (DataTreeModification<AuthenticationKey> change : changes) {
             final DataObjectModification<AuthenticationKey> mod = change.getRootNode();
 
-            if (ModificationType.DELETE == mod.getModificationType()) {
-                final AuthenticationKey authKey = mod.getDataBefore();
+            if (ModificationType.DELETE == mod.modificationType()) {
+                final AuthenticationKey authKey = mod.dataBefore();
 
                 LOG.trace("Received deleted data");
-                LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
+                LOG.trace("Key: {}", change.getRootPath().path());
                 LOG.trace("Value: {}", authKey);
 
                 final AuthenticationKey convertedAuthKey = convertToBinaryIfNecessary(authKey);
 
                 akdb.removeAuthenticationKey(convertedAuthKey.getEid());
                 updatedEntries.put(convertedAuthKey.getEid(), System.currentTimeMillis());
-            } else if (ModificationType.WRITE == mod.getModificationType() || ModificationType.SUBTREE_MODIFIED == mod
-                    .getModificationType()) {
-                if (ModificationType.WRITE == mod.getModificationType()) {
+            } else if (ModificationType.WRITE == mod.modificationType()
+                    || ModificationType.SUBTREE_MODIFIED == mod.modificationType()) {
+                if (ModificationType.WRITE == mod.modificationType()) {
                     LOG.trace("Received created data");
                 } else {
                     LOG.trace("Received updated data");
                 }
                 // Process newly created or updated authentication keys
-                final AuthenticationKey authKey = mod.getDataAfter();
+                final AuthenticationKey authKey = mod.dataAfter();
 
-                LOG.trace("Key: {}", change.getRootPath().getRootIdentifier());
+                LOG.trace("Key: {}", change.getRootPath().path());
                 LOG.trace("Value: {}", authKey);
 
                 final AuthenticationKey convertedAuthKey = convertToBinaryIfNecessary(authKey);
@@ -94,7 +91,7 @@ public class AuthenticationKeyDataListener implements ClusteredDataTreeChangeLis
                 akdb.addAuthenticationKey(convertedAuthKey.getEid(), convertedAuthKey.getMappingAuthkey());
                 updatedEntries.put(convertedAuthKey.getEid(), System.currentTimeMillis());
             } else {
-                LOG.warn("Ignoring unhandled modification type {}", mod.getModificationType());
+                LOG.warn("Ignoring unhandled modification type {}", mod.modificationType());
             }
         }
     }
@@ -112,7 +109,8 @@ public class AuthenticationKeyDataListener implements ClusteredDataTreeChangeLis
      * @param timeout MapRegister cache timeout value
      * @return false if any of the EIDs in the eids list was updated in the last timout period, true otherwise
      */
-    public synchronized boolean authKeysForEidsUnchanged(Map<EidLispAddressKey, EidLispAddress> eids, long timeout) {
+    public synchronized boolean authKeysForEidsUnchanged(final Map<EidLispAddressKey, EidLispAddress> eids,
+            final long timeout) {
         boolean result = true;
         Long currentTime = System.currentTimeMillis();
         for (EidLispAddress eidLispAddress : eids.values()) {
@@ -127,7 +125,7 @@ public class AuthenticationKeyDataListener implements ClusteredDataTreeChangeLis
         return result;
     }
 
-    private static AuthenticationKey convertToBinaryIfNecessary(AuthenticationKey authKey) {
+    private static AuthenticationKey convertToBinaryIfNecessary(final AuthenticationKey authKey) {
         Eid originalEid = authKey.getEid();
         if (LispAddressUtil.addressNeedsConversionToBinary(originalEid.getAddress())) {
             AuthenticationKeyBuilder akb = new AuthenticationKeyBuilder(authKey);
index 1f55e415dfa86f184b08ae0091dc50e4f249e936..3b0a7ab329c2dd42c3e0dbc45ec0fe91a3c4fb42 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
 import org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
+import org.opendaylight.mdsal.singleton.api.ClusterSingletonServiceProvider;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.Ipv4AddressBinary;
index 18bd462eea7bc9dcc024b173f5ab5ee997a8849d..c51a657aef1e82ca0196b7ead3133f09aa2d16d6 100644 (file)
@@ -29,7 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev15090
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKeyKey;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.Uint16;
 
@@ -38,8 +38,7 @@ public class AuthenticationKeyDataListenerTest {
 
     @Mock(name = "akdb") private static AuthKeyDb akdbMock;
     @Mock(name = "broker") private static DataBroker brokerMock;
-    @Mock(name = "registration") private static ListenerRegistration<AuthenticationKeyDataListener>
-            registrationMock;
+    @Mock(name = "registration") private static Registration registrationMock;
     @InjectMocks private static AuthenticationKeyDataListener authenticationKeyDataListener;
 
     private static DataTreeModification<AuthenticationKey> change_del;
@@ -73,7 +72,7 @@ public class AuthenticationKeyDataListenerTest {
     public void init() {
         final InstanceIdentifier<AuthenticationKey> instanceIdentifierMock = Mockito.mock(InstanceIdentifier.class);
         final DataTreeIdentifier<AuthenticationKey> dataTreeIdentifier =
-                DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, instanceIdentifierMock);
+                DataTreeIdentifier.of(LogicalDatastoreType.CONFIGURATION, instanceIdentifierMock);
 
         change_del = Mockito.mock(DataTreeModification.class);
         change_subtreeModified = Mockito.mock(DataTreeModification.class);
@@ -88,12 +87,12 @@ public class AuthenticationKeyDataListenerTest {
         Mockito.when(change_subtreeModified.getRootNode()).thenReturn(mod_subtreeModified);
         Mockito.when(change_write.getRootPath()).thenReturn(dataTreeIdentifier);
         Mockito.when(change_write.getRootNode()).thenReturn(mod_write);
-        Mockito.when(mod_del.getModificationType()).thenReturn(DataObjectModification.ModificationType.DELETE);
-        Mockito.when(mod_subtreeModified.getModificationType())
+        Mockito.when(mod_del.modificationType()).thenReturn(DataObjectModification.ModificationType.DELETE);
+        Mockito.when(mod_subtreeModified.modificationType())
                 .thenReturn(DataObjectModification.ModificationType.SUBTREE_MODIFIED);
-        Mockito.when(mod_write.getModificationType()).thenReturn(DataObjectModification.ModificationType.WRITE);
+        Mockito.when(mod_write.modificationType()).thenReturn(DataObjectModification.ModificationType.WRITE);
 
-        Mockito.when(brokerMock.registerDataTreeChangeListener(Mockito.any(DataTreeIdentifier.class),
+        Mockito.when(brokerMock.registerTreeChangeListener(Mockito.any(DataTreeIdentifier.class),
                 Mockito.any(AuthenticationKeyDataListener.class))).thenReturn(registrationMock);
         authenticationKeyDataListener = new AuthenticationKeyDataListener(brokerMock, akdbMock);
     }
@@ -103,7 +102,7 @@ public class AuthenticationKeyDataListenerTest {
      */
     @Test
     public void onDataTreeChangedTest_delete_BinaryEid() {
-        Mockito.when(mod_del.getDataBefore()).thenReturn(AUTHENTICATION_KEY_1);
+        Mockito.when(mod_del.dataBefore()).thenReturn(AUTHENTICATION_KEY_1);
 
         authenticationKeyDataListener.onDataTreeChanged(Lists.newArrayList(change_del));
         Mockito.verify(akdbMock).removeAuthenticationKey(IPV4_BINARY_EID_1);
@@ -114,7 +113,7 @@ public class AuthenticationKeyDataListenerTest {
      */
     @Test
     public void onDataTreeChangedTest_delete_Ipv4PrefixEid() {
-        Mockito.when(mod_del.getDataBefore()).thenReturn(AUTHENTICATION_KEY_PREFIX);
+        Mockito.when(mod_del.dataBefore()).thenReturn(AUTHENTICATION_KEY_PREFIX);
 
         authenticationKeyDataListener.onDataTreeChanged(Lists.newArrayList(change_del));
         Mockito.verify(akdbMock).removeAuthenticationKey(IPV4_PREFIX_BINARY_EID);
@@ -125,7 +124,7 @@ public class AuthenticationKeyDataListenerTest {
      */
     @Test
     public void onDataTreeChangedTest_subtreeModified() {
-        Mockito.when(mod_subtreeModified.getDataAfter()).thenReturn(AUTHENTICATION_KEY_2);
+        Mockito.when(mod_subtreeModified.dataAfter()).thenReturn(AUTHENTICATION_KEY_2);
 
         authenticationKeyDataListener.onDataTreeChanged(Lists.newArrayList(change_subtreeModified));
         Mockito.verify(akdbMock).addAuthenticationKey(IPV4_BINARY_EID_2, MAPPING_AUTHKEY);
@@ -136,7 +135,7 @@ public class AuthenticationKeyDataListenerTest {
      */
     @Test
     public void onDataTreeChangedTest_write() {
-        Mockito.when(mod_write.getDataAfter()).thenReturn(AUTHENTICATION_KEY_3);
+        Mockito.when(mod_write.dataAfter()).thenReturn(AUTHENTICATION_KEY_3);
 
         authenticationKeyDataListener.onDataTreeChanged(Lists.newArrayList(change_write));
         Mockito.verify(akdbMock).addAuthenticationKey(IPV4_BINARY_EID_3, MAPPING_AUTHKEY);
@@ -151,7 +150,7 @@ public class AuthenticationKeyDataListenerTest {
         final DataTreeModification<AuthenticationKey> change_nullModType = Mockito.mock(DataTreeModification.class);
         final DataObjectModification mod_nullModType = Mockito.mock(DataObjectModification.class);
         Mockito.when(change_nullModType.getRootNode()).thenReturn(mod_nullModType);
-        Mockito.when(mod_nullModType.getModificationType()).thenReturn(null);
+        Mockito.when(mod_nullModType.modificationType()).thenReturn(null);
 
         authenticationKeyDataListener.onDataTreeChanged(Lists.newArrayList(change_nullModType));
         Mockito.verifyNoInteractions(akdbMock);
@@ -166,7 +165,7 @@ public class AuthenticationKeyDataListenerTest {
         Mockito.verify(registrationMock).close();
     }
 
-    private static AuthenticationKey getAuthenticationKey(Eid eid) {
+    private static AuthenticationKey getAuthenticationKey(final Eid eid) {
         return new AuthenticationKeyBuilder()
                 .withKey(new AuthenticationKeyKey(new EidUri("uri-1")))
                 .setEid(eid)