From a7ba91828c9eb44748e5c030fbcb0323541c9ce5 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 7 Aug 2024 18:15:25 +0200 Subject: [PATCH 1/5] Refactor DependencyQueue Rather than having a static single-threaded executor, allocate it in HwvtepConnectionManager, matching their lifecycle. This fixes the problem that a restarted HwvtepConnectionManager would end up talking to a shutdown ExecutorService. It also removes one instance of modifying a static final field. Change-Id: I4d6252d0147e3866cd9387c28eaf78071b743b38 Signed-off-by: Robert Varga --- .../HwvtepConnectionInstance.java | 2 +- .../HwvtepConnectionManager.java | 24 +++++- .../hwvtepsouthbound/HwvtepDeviceInfo.java | 7 +- .../transact/DependencyQueue.java | 76 +++++++++---------- .../DataChangeListenerTestBase.java | 62 +++++++-------- .../HwvtepDataChangeListenerTest.java | 19 ++--- .../SameThreadScheduledExecutor.java | 28 ------- .../transact/DependencyQueueTest.java | 12 +-- 8 files changed, 99 insertions(+), 131 deletions(-) delete mode 100644 hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/SameThreadScheduledExecutor.java diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionInstance.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionInstance.java index 6162ac520..c685e817f 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionInstance.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionInstance.java @@ -96,7 +96,7 @@ public class HwvtepConnectionInstance { this.client = client; this.instanceIdentifier = iid; this.txInvoker = txInvoker; - this.deviceInfo = new HwvtepDeviceInfo(this); + this.deviceInfo = new HwvtepDeviceInfo(hwvtepConnectionManager.dependencyExecutor(), this); this.dataBroker = dataBroker; this.hwvtepTableReader = new HwvtepTableReader(this); } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionManager.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionManager.java index 58bd11daa..a9b7d641f 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionManager.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionManager.java @@ -10,10 +10,12 @@ package org.opendaylight.ovsdb.hwvtepsouthbound; import static java.util.Objects.requireNonNull; import static org.opendaylight.ovsdb.lib.operations.Operations.op; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; import com.google.common.util.concurrent.FluentFuture; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.MoreExecutors; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.net.ConnectException; import java.net.InetAddress; @@ -25,6 +27,9 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.eclipse.jdt.annotation.NonNull; @@ -42,7 +47,6 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.ReconciliationMana import org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.ReconciliationTask; import org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.configuration.HwvtepReconciliationTask; import org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.connection.ConnectionReconciliationTask; -import org.opendaylight.ovsdb.hwvtepsouthbound.transact.DependencyQueue; import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.HwvtepGlobalRemoveCommand; import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.TransactionInvoker; import org.opendaylight.ovsdb.lib.OvsdbClient; @@ -74,6 +78,9 @@ public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoClo private static final int DB_FETCH_TIMEOUT = 1000; private static final int TRANSACTION_HISTORY_CAPACITY = 10000; private static final int TRANSACTION_HISTORY_WATERMARK = 7500; + private static final ThreadFactory DEPENDENCY_THREAD_FACTORY = new ThreadFactoryBuilder() + .setNameFormat("hwvtep-waiting-job-%d") + .build(); private final DataBroker db; private final TransactionInvoker txInvoker; @@ -89,16 +96,19 @@ public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoClo private final Map, TransactionHistory> deviceUpdateHistory = new ConcurrentHashMap<>(); private final OvsdbConnection ovsdbConnectionService; private final Map alreadyProcessedClients = new ConcurrentHashMap<>(); + private final ScheduledExecutorService dependencyExecutor; public HwvtepConnectionManager(final DataBroker db, final TransactionInvoker txInvoker, final EntityOwnershipService entityOwnershipService, final OvsdbConnection ovsdbConnectionService) { this.db = db; this.txInvoker = txInvoker; this.entityOwnershipService = entityOwnershipService; - hwvtepDeviceEntityOwnershipListener = new HwvtepDeviceEntityOwnershipListener(this,entityOwnershipService); + this.ovsdbConnectionService = ovsdbConnectionService; + dependencyExecutor = Executors.newSingleThreadScheduledExecutor(DEPENDENCY_THREAD_FACTORY); + + hwvtepDeviceEntityOwnershipListener = new HwvtepDeviceEntityOwnershipListener(this, entityOwnershipService); reconciliationManager = new ReconciliationManager(db); hwvtepOperGlobalListener = new HwvtepOperGlobalListener(db, this); - this.ovsdbConnectionService = ovsdbConnectionService; } @Override @@ -113,7 +123,8 @@ public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoClo for (HwvtepConnectionInstance client : clients.values()) { client.disconnect(); } - DependencyQueue.close(); + + dependencyExecutor.shutdown(); } @Override @@ -719,4 +730,9 @@ public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoClo */ ON_DISCONNECT } + + @VisibleForTesting + public ScheduledExecutorService dependencyExecutor() { + return dependencyExecutor; + } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDeviceInfo.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDeviceInfo.java index b555be074..8b4d691f8 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDeviceInfo.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDeviceInfo.java @@ -14,6 +14,7 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.atomic.AtomicInteger; import org.opendaylight.ovsdb.hwvtepsouthbound.transact.DependencyQueue; import org.opendaylight.ovsdb.hwvtepsouthbound.transact.DependentJob; @@ -150,9 +151,9 @@ public class HwvtepDeviceInfo { private TransactionHistory controllerTxHistory = null; private TransactionHistory deviceUpdateHistory = null; - public HwvtepDeviceInfo(HwvtepConnectionInstance hwvtepConnectionInstance) { - this.connectionInstance = hwvtepConnectionInstance; - this.dependencyQueue = new DependencyQueue(this); + public HwvtepDeviceInfo(ScheduledExecutorService dependencyExecutor, HwvtepConnectionInstance connectionInstance) { + this.connectionInstance = connectionInstance; + this.dependencyQueue = new DependencyQueue(dependencyExecutor, this); } public LogicalSwitch getLogicalSwitch(UUID uuid) { diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueue.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueue.java index c1df1d0ab..51ea67f35 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueue.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueue.java @@ -7,12 +7,11 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import com.google.common.util.concurrent.ThreadFactoryBuilder; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.concurrent.Executors; +import java.util.concurrent.Executor; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -27,23 +26,22 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DependencyQueue { - private static final Logger LOG = LoggerFactory.getLogger(DependencyQueue.class); - private static final ScheduledExecutorService EXECUTOR_SERVICE = Executors.newSingleThreadScheduledExecutor( - new ThreadFactoryBuilder().setNameFormat("hwvtep-waiting-job-%d").build()); private final LinkedBlockingQueue configWaitQueue = new LinkedBlockingQueue<>( HwvtepSouthboundConstants.WAITING_QUEUE_CAPACITY); private final LinkedBlockingQueue opWaitQueue = new LinkedBlockingQueue<>( HwvtepSouthboundConstants.WAITING_QUEUE_CAPACITY); private final HwvtepDeviceInfo deviceInfo; + private final Executor executor; @SuppressWarnings("checkstyle:IllegalCatch") - public DependencyQueue(HwvtepDeviceInfo hwvtepDeviceInfo) { + public DependencyQueue(final ScheduledExecutorService executor, HwvtepDeviceInfo hwvtepDeviceInfo) { + this.executor = executor; this.deviceInfo = hwvtepDeviceInfo; final AtomicReference> expiredTasksMonitorJob = new AtomicReference<>(); - expiredTasksMonitorJob.set(EXECUTOR_SERVICE.scheduleWithFixedDelay(() -> { + expiredTasksMonitorJob.set(executor.scheduleWithFixedDelay(() -> { try { LOG.debug("Processing dependencies"); if (!deviceInfo.getConnectionInstance().getOvsdbClient().isActive()) { @@ -101,41 +99,39 @@ public class DependencyQueue { @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") private void processReadyJobs(final HwvtepConnectionInstance hwvtepConnectionInstance, LinkedBlockingQueue queue) { - final List readyJobs = getReadyJobs(queue); - readyJobs.forEach((job) -> { - EXECUTOR_SERVICE.execute(() -> - hwvtepConnectionInstance.transact(new TransactCommand() { - HwvtepOperationalState operationalState = new HwvtepOperationalState(hwvtepConnectionInstance); - AtomicInteger retryCount = new AtomicInteger(5); - - @Override - public boolean retry() { - return retryCount.decrementAndGet() > 0; - } + final var readyJobs = getReadyJobs(queue); + readyJobs.forEach(job -> { + executor.execute(() -> hwvtepConnectionInstance.transact(new TransactCommand() { + final HwvtepOperationalState operationalState = new HwvtepOperationalState(hwvtepConnectionInstance); + final AtomicInteger retryCount = new AtomicInteger(5); + + @Override + public boolean retry() { + return retryCount.decrementAndGet() > 0; + } - @Override - public void execute(TransactionBuilder transactionBuilder) { - deviceInfo.clearKeyFromDependencyQueue(job.getKey()); - if (operationalState.getConnectionInstance() != null - && operationalState.getConnectionInstance().isActive()) { - job.onDependencyResolved(operationalState, transactionBuilder); - } + @Override + public void execute(TransactionBuilder transactionBuilder) { + deviceInfo.clearKeyFromDependencyQueue(job.getKey()); + if (operationalState.getConnectionInstance() != null + && operationalState.getConnectionInstance().isActive()) { + job.onDependencyResolved(operationalState, transactionBuilder); } + } - @Override - @SuppressFBWarnings(value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR") - public void onFailure(TransactionBuilder tx) { - job.onFailure(); - operationalState.clearIntransitKeys(); + @Override + public void onFailure(TransactionBuilder tx) { + job.onFailure(); + operationalState.clearIntransitKeys(); - } + } - @Override - public void onSuccess(TransactionBuilder tx) { - job.onSuccess(); - operationalState.getDeviceInfo().onOperDataAvailable(); - } - })); + @Override + public void onSuccess(TransactionBuilder tx) { + job.onSuccess(); + operationalState.getDeviceInfo().onOperDataAvailable(); + } + })); }); } @@ -159,11 +155,7 @@ public class DependencyQueue { return readyJobs; } - public static void close() { - EXECUTOR_SERVICE.shutdown(); - } - public void submit(Runnable runnable) { - EXECUTOR_SERVICE.execute(runnable); + executor.execute(runnable); } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java index 8ab8a2939..d4baf518f 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java @@ -98,7 +98,7 @@ public class DataChangeListenerTestBase extends AbstractDataBrokerTest { OvsdbConnectionInfo connectionInfo; Operations operations; HwvtepDataChangeListener hwvtepDataChangeListener; - HwvtepConnectionManager hwvtepConnectionManager; + protected HwvtepConnectionManager hwvtepConnectionManager; protected HwvtepConnectionInstance connectionInstance; ArgumentCaptor insertOpCapture; @@ -119,8 +119,34 @@ public class DataChangeListenerTestBase extends AbstractDataBrokerTest { ls1Iid = nodeIid.augmentation(HwvtepGlobalAugmentation.class).child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName("ls1"))); loadSchema(); - mockConnectionInstance(); - mockConnectionManager(); + + transactionInvoker = new TransactionInvokerImpl(getDataBroker()); + hwvtepConnectionManager = spy(new HwvtepConnectionManager(getDataBroker(), transactionInvoker, + entityOwnershipService, mock(OvsdbConnection.class))); + + connectionInfo = mock(OvsdbConnectionInfo.class); + doReturn(mock(InetAddress.class)).when(connectionInfo).getRemoteAddress(); + + ovsdbClient = mock(OvsdbClient.class); + doReturn(true).when(ovsdbClient).isActive(); + doReturn(connectionInfo).when(ovsdbClient).getConnectionInfo(); + doReturn(listenableDbSchema).when(ovsdbClient).getSchema(anyString()); + + connectionInstance = new HwvtepConnectionInstance(hwvtepConnectionManager, null, ovsdbClient, nodeIid, + transactionInvoker, getDataBroker()); + connectionInstance.reconciliationFt.set(Boolean.TRUE); + connectionInstance.firstUpdateTriggered.set(true); + connectionInstance.setControllerTxHistory(new TransactionHistory(10000, 7500)); + connectionInstance.setDeviceUpdateHistory(new TransactionHistory(10000, 7500)); + connectionInstance.createTransactInvokers(); + + doReturn(connectionInstance).when(hwvtepConnectionManager).getConnectionInstance( + any(HwvtepPhysicalSwitchAttributes.class)); + doReturn(connectionInstance).when(hwvtepConnectionManager).getConnectionInstance(any(Node.class)); + doReturn(connectionInstance).when(hwvtepConnectionManager).getConnectionInstanceFromNodeIid( + any(InstanceIdentifier.class)); + + mockOperations(); addNode(LogicalDatastoreType.OPERATIONAL); @@ -167,36 +193,6 @@ public class DataChangeListenerTestBase extends AbstractDataBrokerTest { } } - private void mockConnectionManager() throws IllegalAccessException { - hwvtepConnectionManager = spy(new HwvtepConnectionManager(getDataBroker(), transactionInvoker, - entityOwnershipService, mock(OvsdbConnection.class))); - doReturn(connectionInstance).when(hwvtepConnectionManager).getConnectionInstance( - any(HwvtepPhysicalSwitchAttributes.class)); - doReturn(connectionInstance).when(hwvtepConnectionManager).getConnectionInstance(any(Node.class)); - doReturn(connectionInstance).when(hwvtepConnectionManager).getConnectionInstanceFromNodeIid( - any(InstanceIdentifier.class)); - } - - void mockConnectionInstance() { - connectionInfo = mock(OvsdbConnectionInfo.class); - doReturn(mock(InetAddress.class)).when(connectionInfo).getRemoteAddress(); - - ovsdbClient = mock(OvsdbClient.class); - doReturn(true).when(ovsdbClient).isActive(); - doReturn(connectionInfo).when(ovsdbClient).getConnectionInfo(); - doReturn(listenableDbSchema).when(ovsdbClient).getSchema(anyString()); - - transactionInvoker = new TransactionInvokerImpl(getDataBroker()); - - connectionInstance = new HwvtepConnectionInstance(null, null, ovsdbClient, nodeIid, transactionInvoker, - getDataBroker()); - connectionInstance.reconciliationFt.set(Boolean.TRUE); - connectionInstance.firstUpdateTriggered.set(true); - connectionInstance.setControllerTxHistory(new TransactionHistory(10000, 7500)); - connectionInstance.setDeviceUpdateHistory(new TransactionHistory(10000, 7500)); - connectionInstance.createTransactInvokers(); - } - void mockOperations() { resetOperations(); } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java index 8557b0f1d..219f0b1d7 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java @@ -5,13 +5,12 @@ * 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.ovsdb.hwvtepsouthbound; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -23,10 +22,8 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; -import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.ovsdb.hwvtepsouthbound.transact.DependencyQueue; import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable; import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalSwitch; @@ -91,8 +88,6 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { @Before public void setupListener() throws Exception { - setFinalStatic(DependencyQueue.class, "EXECUTOR_SERVICE", mock(SameThreadScheduledExecutor.class, - Mockito.CALLS_REAL_METHODS)); opDataChangeListener = new HwvtepOperationalDataChangeListener(getDataBroker(), hwvtepConnectionManager, connectionInstance); } @@ -267,26 +262,26 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.CONFIGURATION, RemoteUcastMacs.class, ucastMacs); - verify(Operations.op, times(4)).insert(any(UcastMacsRemote.class)); + verify(Operations.op, times(4)).insert(any(UcastMacsRemote.class)); resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMacs); //2 mcast mac + 2 locator sets ( termination point already added ) - verify(Operations.op, times(0)).insert(ArgumentMatchers.any()); + verify(Operations.op, times(0)).insert(ArgumentMatchers.any()); resetOperations(); addData(LogicalDatastoreType.OPERATIONAL, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.OPERATIONAL, RemoteUcastMacs.class, ucastMacs); connectionInstance.getDeviceInfo().onOperDataAvailable(); //2 mcast mac + 2 locator sets ( termination point already added ) - verify(Operations.op, times(4)).insert(ArgumentMatchers.any()); + verify(Operations.op, timeout(2000).times(4)).insert(ArgumentMatchers.any()); resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMac2); - verify(Operations.op, times(0)).insert(ArgumentMatchers.any()); + verify(Operations.op, times(0)).insert(ArgumentMatchers.any()); addData(LogicalDatastoreType.OPERATIONAL, RemoteMcastMacs.class, mcastMacs); connectionInstance.getDeviceInfo().onOperDataAvailable(); - verify(Operations.op, times(2)).insert(ArgumentMatchers.any()); - verify(Operations.op, times(2)).update(ArgumentMatchers.any()); + verify(Operations.op, timeout(2000).times(2)).insert(ArgumentMatchers.any()); + verify(Operations.op, times(2)).update(ArgumentMatchers.any()); } private void verifyThatLogicalSwitchCreated() { diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/SameThreadScheduledExecutor.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/SameThreadScheduledExecutor.java deleted file mode 100644 index ed7df7348..000000000 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/SameThreadScheduledExecutor.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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.ovsdb.hwvtepsouthbound; - -import com.google.common.util.concurrent.SettableFuture; -import java.util.concurrent.Future; -import java.util.concurrent.ScheduledExecutorService; - -public abstract class SameThreadScheduledExecutor implements ScheduledExecutorService { - - @Override - public void execute(Runnable runnable) { - runnable.run(); - } - - @Override - public Future submit(Runnable runnable) { - runnable.run(); - SettableFuture ft = SettableFuture.create(); - ft.set(null); - return ft; - } -} diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueueTest.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueueTest.java index aeef2444c..49602158e 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueueTest.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueueTest.java @@ -14,11 +14,9 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.ovsdb.hwvtepsouthbound.DataChangeListenerTestBase; -import org.opendaylight.ovsdb.hwvtepsouthbound.SameThreadScheduledExecutor; import org.opendaylight.ovsdb.hwvtepsouthbound.TestBuilders; import org.opendaylight.ovsdb.lib.notation.UUID; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; @@ -56,8 +54,6 @@ public class DependencyQueueTest extends DataChangeListenerTestBase { .child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName("ls0"))); macIid = nodeIid.augmentation(HwvtepGlobalAugmentation.class) .child(RemoteMcastMacs.class, new RemoteMcastMacsKey(mac.key())); - setFinalStatic(DependencyQueue.class, "EXECUTOR_SERVICE", Mockito.mock(SameThreadScheduledExecutor.class, - Mockito.CALLS_REAL_METHODS)); } @Test @@ -69,8 +65,8 @@ public class DependencyQueueTest extends DataChangeListenerTestBase { final CountDownLatch latch = new CountDownLatch(1); opState.getDeviceInfo().addJobToQueue(new DependentJob.ConfigWaitingJob(macIid, mac, unMetDependencies) { @Override - protected void onDependencyResolved(HwvtepOperationalState operationalState, - TransactionBuilder transactionBuilder) { + protected void onDependencyResolved(final HwvtepOperationalState operationalState, + final TransactionBuilder transactionBuilder) { latch.countDown(); } }); @@ -90,8 +86,8 @@ public class DependencyQueueTest extends DataChangeListenerTestBase { opState.getDeviceInfo().addJobToQueue(new DependentJob.OpWaitingJob( macIid, mac, (Map)unMetDependencies, 0) { @Override - protected void onDependencyResolved(HwvtepOperationalState operationalState, - TransactionBuilder transactionBuilder) { + protected void onDependencyResolved(final HwvtepOperationalState operationalState, + final TransactionBuilder transactionBuilder) { latch.countDown(); } }); -- 2.43.0 From 8d8ed9678259dee329d696fc536c0aa8b286c49a Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 7 Aug 2024 20:05:56 +0200 Subject: [PATCH 2/5] Return plain booleans The state we are tracking are plain booleans, with no possibility of there being nulls. I am not sure now we have come by this, but fix the return types to prevent boxing to Boolean and repetitive volatile access (which happens to work exactly because there can never be nulls). Change-Id: Ibbce2ffacb0860bc2ab258aacaa374b18a2a5f0b Signed-off-by: Robert Varga --- .../ovsdb/southbound/OvsdbConnectionInstance.java | 4 ++-- .../ovsdb/southbound/OvsdbOperGlobalListener.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java index b0c5e0dc2..3c36c9e89 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java @@ -389,11 +389,11 @@ public class OvsdbConnectionInstance { connectedEntity = entity; } - public Boolean hasOvsdbClient(final OvsdbClient otherClient) { + public boolean hasOvsdbClient(final OvsdbClient otherClient) { return client.equals(otherClient); } - public Boolean getHasDeviceOwnership() { + public boolean getHasDeviceOwnership() { return hasDeviceOwnership; } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbOperGlobalListener.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbOperGlobalListener.java index 4ebebaddb..ff767fd4e 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbOperGlobalListener.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbOperGlobalListener.java @@ -84,7 +84,6 @@ public final class OvsdbOperGlobalListener implements DataTreeChangeListener Date: Mon, 8 Jul 2024 23:43:22 +0200 Subject: [PATCH 3/5] Eliminate static Operations wiring Operations.op is a static field, from whence everybody is getting their operations. This is not exactly nice, as it makes library not really a library and it means tests are relying on changing a static final field -- which is a huge no-no with Java 21. This patch turns Operations into an interface, provided by DefaultOperations. Everybody is then taught to get Operations injected, eliminating the need for statics. We also clean attempts to mock InetAddress, which is a sealed class now. Change-Id: Ied3fbfe062f081f2ea9d8640d09513fabeab9268 Signed-off-by: Robert Varga --- .../hwvtepsouthbound-impl/pom.xml | 8 +- .../HwvtepConnectionInstance.java | 9 +- .../HwvtepConnectionManager.java | 9 +- .../HwvtepSouthboundProvider.java | 5 +- .../hwvtepsouthbound/HwvtepTableReader.java | 11 +-- .../transact/AbstractTransactCommand.java | 5 + .../transact/LogicalRouterRemoveCommand.java | 4 +- .../transact/LogicalRouterUpdateCommand.java | 4 +- .../LogicalSwitchUcastsRemoveCommand.java | 4 +- .../transact/LogicalSwitchUpdateCommand.java | 3 +- .../transact/McastMacsLocalRemoveCommand.java | 4 +- .../transact/McastMacsLocalUpdateCommand.java | 5 +- .../McastMacsRemoteRemoveCommand.java | 6 +- .../McastMacsRemoteUpdateCommand.java | 6 +- .../transact/PhysicalPortRemoveCommand.java | 4 +- .../transact/PhysicalPortUpdateCommand.java | 4 +- .../transact/PhysicalSwitchRemoveCommand.java | 4 +- .../transact/PhysicalSwitchUpdateCommand.java | 8 +- .../transact/PlainLogicalSwitchRemoveCmd.java | 4 +- .../transact/TransactUtils.java | 8 +- .../transact/UcastMacsLocalRemoveCommand.java | 4 +- .../transact/UcastMacsLocalUpdateCommand.java | 4 +- .../UcastMacsRemoteRemoveCommand.java | 4 +- .../UcastMacsRemoteUpdateCommand.java | 6 +- .../DataChangeListenerTestBase.java | 55 ++--------- .../HwvtepDataChangeListenerTest.java | 49 +++++---- .../lib/operations/DefaultOperations.java | 99 +++++++++++++++++++ .../ovsdb/lib/operations/Operations.java | 64 +++--------- .../ovsdbclient/OvsdbClientTestIT.java | 1 - .../ovsdbclient/OvsdbClientTestTypedIT.java | 1 - .../schema/HardwareVTEPIT.java | 1 - .../integrationtest/schema/OpenVSwitchIT.java | 1 - .../opendaylight/ovsdb/lib/it/LibraryIT.java | 1 - .../lib/it/LibraryIntegrationTestBase.java | 4 + .../southbound/OvsdbConnectionInstance.java | 27 ++--- .../southbound/OvsdbConnectionManager.java | 46 ++++----- .../OvsdbDataTreeChangeListener.java | 2 +- .../southbound/OvsdbOperGlobalListener.java | 22 ++--- .../ovsdb/southbound/SouthboundProvider.java | 12 ++- .../transact/AbstractTransactCommand.java | 20 ++++ .../transact/AutoAttachRemovedCommand.java | 20 ++-- .../transact/AutoAttachUpdateCommand.java | 20 ++-- .../ovsdb/transact/BridgeRemovedCommand.java | 12 ++- .../ovsdb/transact/BridgeUpdateCommand.java | 29 +++--- .../transact/ControllerRemovedCommand.java | 16 +-- .../transact/ControllerUpdateCommand.java | 12 ++- .../transact/OpenVSwitchBridgeAddCommand.java | 10 +- .../transact/OvsdbNodeUpdateCommand.java | 19 ++-- .../transact/ProtocolRemovedCommand.java | 15 +-- .../ovsdb/transact/ProtocolUpdateCommand.java | 12 ++- .../ovsdb/transact/QosRemovedCommand.java | 14 +-- .../ovsdb/transact/QosUpdateCommand.java | 10 +- .../ovsdb/transact/QueueRemovedCommand.java | 15 +-- .../ovsdb/transact/QueueUpdateCommand.java | 10 +- .../TerminationPointCreateCommand.java | 21 ++-- .../TerminationPointDeleteCommand.java | 11 ++- .../TerminationPointUpdateCommand.java | 12 ++- .../transact/TransactCommandAggregator.java | 15 ++- .../ovsdb/transact/TransactUtils.java | 11 +-- .../BridgeConfigReconciliationTask.java | 2 +- ...minationPointConfigReconciliationTask.java | 6 +- .../OvsdbConnectionInstanceTest.java | 4 +- .../OvsdbConnectionManagerTest.java | 14 ++- .../OvsdbDataTreeChangeListenerTest.java | 6 +- .../southbound/SouthboundProviderTest.java | 7 +- .../ovsdb/southbound/SouthboundUtilTest.java | 11 +-- .../OpenVSwitchBridgeAddCommandTest.java | 7 +- .../transact/OvsdbNodeUpdateCommandTest.java | 14 +-- .../TerminationPointCreateCommandTest.java | 10 +- .../TerminationPointUpdateCommandTest.java | 9 +- .../TransactCommandAggregatorTest.java | 3 +- .../ovsdb/transact/TransactUtilsTest.java | 21 ++-- 72 files changed, 519 insertions(+), 417 deletions(-) create mode 100644 library/impl/src/main/java/org/opendaylight/ovsdb/lib/operations/DefaultOperations.java create mode 100644 southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AbstractTransactCommand.java diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml index 725a05c8d..91bc02c14 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml @@ -114,15 +114,9 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.apache.maven.plugins maven-surefire-plugin + 1 false - - - - @{argLine} - --add-opens java.base/java.lang=ALL-UNNAMED - --add-opens java.base/java.lang.reflect=ALL-UNNAMED - diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionInstance.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionInstance.java index c685e817f..ba694437e 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionInstance.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionInstance.java @@ -45,6 +45,7 @@ import org.opendaylight.ovsdb.lib.message.TableUpdates; import org.opendaylight.ovsdb.lib.notation.Row; import org.opendaylight.ovsdb.lib.operations.Operation; import org.opendaylight.ovsdb.lib.operations.OperationResult; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.DatabaseSchema; import org.opendaylight.ovsdb.lib.schema.GenericTableSchema; @@ -77,6 +78,7 @@ public class HwvtepConnectionInstance { private HwvtepGlobalAugmentation initialCreatedData = null; private final HwvtepDeviceInfo deviceInfo; private final DataBroker dataBroker; + private final Operations ops; private final HwvtepConnectionManager hwvtepConnectionManager; private static final ScheduledExecutorService SCHEDULED_EXECUTOR_SERVICE = Executors .newSingleThreadScheduledExecutor(new ThreadFactoryBuilder() @@ -90,7 +92,7 @@ public class HwvtepConnectionInstance { HwvtepConnectionInstance(final HwvtepConnectionManager hwvtepConnectionManager, final ConnectionInfo key, final OvsdbClient client, final InstanceIdentifier iid, final TransactionInvoker txInvoker, - final DataBroker dataBroker) { + final DataBroker dataBroker, final Operations ops) { this.hwvtepConnectionManager = hwvtepConnectionManager; this.connectionInfo = key; this.client = client; @@ -98,6 +100,7 @@ public class HwvtepConnectionInstance { this.txInvoker = txInvoker; this.deviceInfo = new HwvtepDeviceInfo(hwvtepConnectionManager.dependencyExecutor(), this); this.dataBroker = dataBroker; + this.ops = ops; this.hwvtepTableReader = new HwvtepTableReader(this); } @@ -410,4 +413,8 @@ public class HwvtepConnectionInstance { public TransactionInvoker getTxInvoker() { return txInvoker; } + + public Operations ops() { + return ops; + } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionManager.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionManager.java index a9b7d641f..010850052 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionManager.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepConnectionManager.java @@ -8,7 +8,6 @@ package org.opendaylight.ovsdb.hwvtepsouthbound; import static java.util.Objects.requireNonNull; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; @@ -54,6 +53,7 @@ import org.opendaylight.ovsdb.lib.OvsdbConnection; import org.opendaylight.ovsdb.lib.OvsdbConnectionListener; import org.opendaylight.ovsdb.lib.operations.Operation; import org.opendaylight.ovsdb.lib.operations.OperationResult; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.Select; import org.opendaylight.ovsdb.lib.schema.GenericTableSchema; import org.opendaylight.ovsdb.lib.schema.typed.TypedDatabaseSchema; @@ -84,6 +84,7 @@ public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoClo private final DataBroker db; private final TransactionInvoker txInvoker; + private final Operations ops; private final Map> instanceIdentifiers = new ConcurrentHashMap<>(); private final Map entityConnectionMap = new ConcurrentHashMap<>(); private final EntityOwnershipService entityOwnershipService; @@ -98,10 +99,11 @@ public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoClo private final Map alreadyProcessedClients = new ConcurrentHashMap<>(); private final ScheduledExecutorService dependencyExecutor; - public HwvtepConnectionManager(final DataBroker db, final TransactionInvoker txInvoker, + public HwvtepConnectionManager(final DataBroker db, final TransactionInvoker txInvoker, final Operations ops, final EntityOwnershipService entityOwnershipService, final OvsdbConnection ovsdbConnectionService) { this.db = db; this.txInvoker = txInvoker; + this.ops = ops; this.entityOwnershipService = entityOwnershipService; this.ovsdbConnectionService = ovsdbConnectionService; dependencyExecutor = Executors.newSingleThreadScheduledExecutor(DEPENDENCY_THREAD_FACTORY); @@ -277,7 +279,7 @@ public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoClo } hwvtepConnectionInstance = new HwvtepConnectionInstance(this, key, - externalClient, getInstanceIdentifier(key), txInvoker, db); + externalClient, getInstanceIdentifier(key), txInvoker, db, ops); hwvtepConnectionInstance.createTransactInvokers(); return hwvtepConnectionInstance; } @@ -465,6 +467,7 @@ public class HwvtepConnectionManager implements OvsdbConnectionListener, AutoClo } GenericTableSchema hwvtepSchema = dbSchema.getTableSchema(Global.class); + final var op = connectionInstance.ops(); Select selectOperation = op.select(hwvtepSchema); selectOperation.setColumns(hwvtepSchema.getColumnList()); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java index 14497292e..1ce0fcc08 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java @@ -32,6 +32,7 @@ import org.opendaylight.mdsal.eos.common.api.EntityOwnershipStateChange; import org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.configuration.HwvtepReconciliationManager; import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.TransactionInvoker; import org.opendaylight.ovsdb.lib.OvsdbConnection; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.utils.mdsal.utils.Scheduler; import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionHistory; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; @@ -74,7 +75,7 @@ public final class HwvtepSouthboundProvider @Reference final EntityOwnershipService entityOwnership, @Reference final OvsdbConnection ovsdbConnection, @Reference final DOMSchemaService schemaService, @Reference final BindingNormalizedNodeSerializer serializer, - @Reference final TransactionInvoker txInvoker) { + @Reference final TransactionInvoker txInvoker, @Reference final Operations ops) { this.dataBroker = dataBroker; entityOwnershipService = entityOwnership; registration = null; @@ -82,7 +83,7 @@ public final class HwvtepSouthboundProvider // FIXME: eliminate this static wiring HwvtepSouthboundUtil.setInstanceIdentifierCodec(new InstanceIdentifierCodec(schemaService, serializer)); LOG.info("HwvtepSouthboundProvider ovsdbConnectionService: {}", ovsdbConnection); - cm = new HwvtepConnectionManager(dataBroker, txInvoker, entityOwnershipService, ovsdbConnection); + cm = new HwvtepConnectionManager(dataBroker, txInvoker, ops, entityOwnershipService, ovsdbConnection); hwvtepDTListener = new HwvtepDataChangeListener(dataBroker, cm); hwvtepReconciliationManager = new HwvtepReconciliationManager(dataBroker, cm); //Register listener for entityOnwership changes diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepTableReader.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepTableReader.java index 24ca4b90b..df7a650e3 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepTableReader.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepTableReader.java @@ -8,7 +8,6 @@ package org.opendaylight.ovsdb.hwvtepsouthbound; import static java.util.Objects.requireNonNull; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import com.google.common.collect.ImmutableClassToInstanceMap; import com.google.common.collect.ImmutableClassToInstanceMap.Builder; @@ -268,7 +267,7 @@ public class HwvtepTableReader { final Class> tableClass = TABLE_MAP.get(cls); final GenericTableSchema hwvtepSchema = dbSchema.getTableSchema(tableClass); - final Select selectOperation = op.select(hwvtepSchema); + final Select selectOperation = connectionInstance.ops().select(hwvtepSchema); selectOperation.setColumns(hwvtepSchema.getColumnList()); if (existingUUID == null) { @@ -329,7 +328,7 @@ public class HwvtepTableReader { final Class> tableClass = TABLE_MAP.get(cls); final GenericTableSchema hwvtepSchema = dbSchema.getTableSchema(tableClass); - final Select selectOperation = op.select(hwvtepSchema); + final Select selectOperation = connectionInstance.ops().select(hwvtepSchema); selectOperation.setColumns(hwvtepSchema.getColumnList()); final List results; @@ -364,7 +363,7 @@ public class HwvtepTableReader { TypedDatabaseSchema dbSchema = connectionInstance.getSchema(HwvtepSchemaConstants.HARDWARE_VTEP).get(); List operations = Arrays.stream(ALL_TABLES) .map(tableClass -> dbSchema.getTableSchema(tableClass)) - .map(HwvtepTableReader::buildSelectOperationFor) + .map(this::buildSelectOperationFor) .collect(Collectors.toList()); List results = connectionInstance.transact(dbSchema, operations).get(); @@ -409,8 +408,8 @@ public class HwvtepTableReader { } } - private static Select buildSelectOperationFor(final GenericTableSchema tableSchema) { - Select selectOperation = op.select(tableSchema); + private Select buildSelectOperationFor(final GenericTableSchema tableSchema) { + Select selectOperation = connectionInstance.ops().select(tableSchema); selectOperation.setColumns(tableSchema.getColumnList()); return selectOperation; } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java index 428cd351b..83aa920d6 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java @@ -30,6 +30,7 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo; import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil; import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepTableReader; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable; import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType; @@ -76,6 +77,10 @@ public abstract class AbstractTransactCommand & DataObject return changes; } + public Operations ops() { + return getOperationalState().getConnectionInstance().ops(); + } + void updateCurrentTxDeleteData(final Class cls, final InstanceIdentifier key, final T data) { hwvtepOperationalState.updateCurrentTxDeleteData(cls, key); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterRemoveCommand.java index abd99c9e3..18fb2af77 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterRemoveCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Collections; import java.util.List; @@ -75,6 +73,8 @@ public class LogicalRouterRemoveCommand private void removeLogicalRouter(final TransactionBuilder transaction, final InstanceIdentifier instanceIdentifier, final List routerList) { + final var op = ops(); + for (LogicalRouters lrouter: routerList) { LOG.debug("Removing logical router named: {}", lrouter.getHwvtepNodeName().getValue()); Optional operationalRouterOptional = diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java index 060f587b6..3240cebb8 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -57,6 +55,8 @@ public class LogicalRouterUpdateCommand private void updateLogicalRouter(final TransactionBuilder transaction, final InstanceIdentifier instanceIdentifier, final List routerList) { + final var op = ops(); + for (LogicalRouters lrouter: routerList) { final InstanceIdentifier routerKey = instanceIdentifier .augmentation(HwvtepGlobalAugmentation.class).child(LogicalRouters.class, lrouter.key()); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUcastsRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUcastsRemoveCommand.java index 63cb5ad8f..fdaa0fb48 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUcastsRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUcastsRemoveCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -70,7 +68,9 @@ public final class LogicalSwitchUcastsRemoveCommand InstanceIdentifier lsKey = nodeIid.augmentation(HwvtepGlobalAugmentation.class) .child(LogicalSwitches.class, logicalSwitches.key()); HwvtepDeviceInfo.DeviceData deviceData = super.fetchDeviceData(LogicalSwitches.class, lsKey); + if (deviceData != null && deviceData.getUuid() != null) { + final var op = ops(); UUID logicalSwitchUuid = deviceData.getUuid(); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java index 2538c0716..d5c50db61 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java @@ -8,7 +8,6 @@ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; import static org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil.schemaMismatchLog; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import java.util.Collection; import java.util.HashSet; @@ -84,6 +83,8 @@ public class LogicalSwitchUpdateCommand setDescription(logicalSwitch, lswitch); setTunnelKey(logicalSwitch, lswitch); setReplicationMode(logicalSwitch, lswitch); + final var op = ops(); + if (operationalSwitchOptional == null) { setName(logicalSwitch, lswitch); LOG.trace("execute: creating LogicalSwitch entry: {}", logicalSwitch); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalRemoveCommand.java index 5e65c7754..30abe59ee 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalRemoveCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.List; import java.util.Map; @@ -49,6 +47,8 @@ public class McastMacsLocalRemoveCommand private void removeMcastMacLocal(final TransactionBuilder transaction, final InstanceIdentifier instanceIdentifier, final List macList) { + final var op = ops(); + for (LocalMcastMacs mac: macList) { LOG.debug("Removing localMcastMacs, mac address: {}", mac.getMacEntryKey().getValue()); Optional operationalMacOptional = diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalUpdateCommand.java index 862fce0c2..c6a80d43d 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalUpdateCommand.java @@ -5,11 +5,8 @@ * 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.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.List; import java.util.Map; @@ -53,6 +50,8 @@ public class McastMacsLocalUpdateCommand private void updateMcastMacsLocal(final TransactionBuilder transaction, final InstanceIdentifier instanceIdentifier, final List localMcastMacs) { + final var op = ops(); + for (LocalMcastMacs localMcastMac: localMcastMacs) { LOG.debug("Creating localMcastMac, mac address: {}", localMcastMac.getMacEntryKey().getValue()); final Optional operationalMacOptional = diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteRemoveCommand.java index 12db813a3..6cb08faf8 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteRemoveCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -104,7 +102,7 @@ public class McastMacsRemoteRemoveCommand && ((McastMacsRemote)deviceData.getData()).getLogicalSwitchColumn() != null) { UUID logicalSwitchUid = ((McastMacsRemote)deviceData.getData()).getLogicalSwitchColumn().getData(); if (logicalSwitchUid != null) { - transaction.add(op.delete(mcastMacsRemote.getSchema()) + transaction.add(ops().delete(mcastMacsRemote.getSchema()) .where(mcastMacsRemote.getLogicalSwitchColumn().getSchema().opEqual(logicalSwitchUid)).build()); deleted = true; updateCurrentTxDeleteData(RemoteMcastMacs.class, macIid, mac); @@ -120,7 +118,7 @@ public class McastMacsRemoteRemoveCommand if (macEntryUUID != null) { mcastMacsRemote.getUuidColumn().setData(macEntryUUID); updateCurrentTxDeleteData(RemoteMcastMacs.class, macIid, mac); - transaction.add(op.delete(mcastMacsRemote.getSchema()) + transaction.add(ops().delete(mcastMacsRemote.getSchema()) .where(mcastMacsRemote.getUuidColumn().getSchema().opEqual(macEntryUUID)).build()); updateControllerTxHistory(TransactionType.DELETE, new StringBuilder(mcastMacsRemote.toString()) .append(": Mac : ").append(macEntryUUID)); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteUpdateCommand.java index bc8a5f966..0ce24d612 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteUpdateCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; import com.google.common.collect.Sets; @@ -107,7 +105,7 @@ public class McastMacsRemoteUpdateCommand HwvtepDeviceInfo.DeviceData deviceData = super.fetchDeviceData(RemoteMcastMacs.class, macIid); if (deviceData == null) { setLocatorSet(transaction, mcastMacsRemote, mac); - transaction.add(op.insert(mcastMacsRemote)); + transaction.add(ops().insert(mcastMacsRemote)); updateCurrentTxData(RemoteMcastMacs.class, macIid, new UUID("uuid"), mac); updateControllerTxHistory(TransactionType.ADD, mcastMacsRemote); LOG.info("CONTROLLER - {} {}", TransactionType.ADD, mcastMacsRemote); @@ -116,7 +114,7 @@ public class McastMacsRemoteUpdateCommand UUID macEntryUUID = deviceData.getUuid(); McastMacsRemote extraMac = transaction.getTypedRowSchema(McastMacsRemote.class); extraMac.getUuidColumn().setData(macEntryUUID); - transaction.add(op.update(mcastMacsRemote) + transaction.add(ops().update(mcastMacsRemote) .where(extraMac.getUuidColumn().getSchema().opEqual(macEntryUUID)) .build()); updateControllerTxHistory(TransactionType.UPDATE, mcastMacsRemote); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortRemoveCommand.java index af31c6011..8037c085a 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortRemoveCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -52,6 +50,8 @@ public class PhysicalPortRemoveCommand extends AbstractTransactCommand { private void updatePhysicalPort(final TransactionBuilder transaction, final InstanceIdentifier psNodeiid, final List listPort) { + final var op = ops(); + for (HwvtepPhysicalPortAugmentation port : listPort) { LOG.debug("Updating a physical port named: {}", port.getHwvtepNodeName().getValue()); Optional operationalPhysicalPortOptional = diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortUpdateCommand.java index 733695420..b903917c0 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortUpdateCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -148,6 +146,8 @@ public class PhysicalPortUpdateCommand TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), PhysicalPort.class); extraPhyscialPort.setName(""); LOG.trace("execute: updating physical port: {} {}", nodeId, physicalPort); + final var op = ops(); + transaction.add(op.update(physicalPort) .where(extraPhyscialPort.getNameColumn().getSchema().opEqual(existingPhysicalPortName)) .build()); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchRemoveCommand.java index 45ddde080..8c84fb231 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchRemoveCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -59,6 +57,8 @@ public class PhysicalSwitchRemoveCommand extends AbstractTransactCommand { UUID physicalSwitchUuid = new UUID(operationalPhysicalSwitchOptional.orElseThrow() .getPhysicalSwitchUuid().getValue()); Global global = transaction.getTypedRowSchema(Global.class); + final var op = ops(); + transaction.add(op.delete(physicalSwitch.getSchema()) .where(physicalSwitch.getUuidColumn().getSchema().opEqual(physicalSwitchUuid)).build()); transaction.add(op.comment("Physical Switch: Deleting " diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchUpdateCommand.java index 2b22dd078..74887ae8f 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchUpdateCommand.java @@ -5,11 +5,9 @@ * 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.ovsdb.hwvtepsouthbound.transact; import static org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil.schemaMismatchLog; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import com.google.common.collect.ImmutableMap; import java.util.Collection; @@ -96,6 +94,8 @@ public final class PhysicalSwitchUpdateCommand extends AbstractTransactCommand { schemaMismatchLog("tunnels", "Physical_Switch", e); } if (!operationalPhysicalSwitchOptional.isPresent()) { + final var op = ops(); + //create a physical switch setName(physicalSwitch, physicalSwitchAugmentation, operationalPhysicalSwitchOptional); String pswitchUuid = "PhysicalSwitch_" + HwvtepSouthboundMapper.getRandomUUID(); @@ -128,6 +128,8 @@ public final class PhysicalSwitchUpdateCommand extends AbstractTransactCommand { PhysicalSwitch extraPhysicalSwitch = transaction.getTypedRowWrapper(PhysicalSwitch.class); extraPhysicalSwitch.setName(""); LOG.trace("execute: updating physical switch: {}", physicalSwitch); + final var op = ops(); + transaction.add(op.update(physicalSwitch) .where(extraPhysicalSwitch.getNameColumn().getSchema().opEqual(existingPhysicalSwitchName)) .build()); @@ -181,6 +183,8 @@ public final class PhysicalSwitchUpdateCommand extends AbstractTransactCommand { private void setTunnels(final TransactionBuilder transaction, final InstanceIdentifier iid, final PhysicalSwitch physicalSwitch, final PhysicalSwitchAugmentation physicalSwitchAugmentation, final boolean switchExists) { + final var op = ops(); + //TODO: revisit this code for optimizations //TODO: needs more testing for (Tunnels tunnel : physicalSwitchAugmentation.nonnullTunnels().values()) { diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PlainLogicalSwitchRemoveCmd.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PlainLogicalSwitchRemoveCmd.java index bd4a180da..10c32a5b3 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PlainLogicalSwitchRemoveCmd.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PlainLogicalSwitchRemoveCmd.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Map; import java.util.Objects; @@ -50,7 +48,7 @@ public final class PlainLogicalSwitchRemoveCmd public void execute(final TransactionBuilder transaction) { LogicalSwitch logicalSwitch = TyperUtils.getTypedRowWrapper( transaction.getDatabaseSchema(), LogicalSwitch.class, null); - transaction.add(op.delete(logicalSwitch.getSchema()) + transaction.add(ops().delete(logicalSwitch.getSchema()) .where(logicalSwitch.getNameColumn().getSchema().opEqual( logicalSwitches.getHwvtepNodeName().getValue())).build()); } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java index 02e76b5e7..bc6550afe 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -141,7 +139,8 @@ public final class TransactUtils { PhysicalLocatorSet physicalLocatorSet = transaction.getTypedRowWrapper(PhysicalLocatorSet.class); physicalLocatorSet.setLocators(locators); String locatorSetUuid = "PhysicalLocatorSet_" + HwvtepSouthboundMapper.getRandomUUID(); - transaction.add(op.insert(physicalLocatorSet).withId(locatorSetUuid)); + transaction.add(hwvtepOperationalState.getConnectionInstance().ops() + .insert(physicalLocatorSet).withId(locatorSetUuid)); hwvtepOperationalState.getDeviceInfo().addToControllerTx(TransactionType.ADD, new StringBuilder(physicalLocatorSet.toString()).append(" Uuid ").append(locatorSetUuid) .append(" ").append(locatorsInfo.toString())); @@ -183,7 +182,8 @@ public final class TransactUtils { setEncapsulationType(physicalLocator, inputLocator); setDstIp(physicalLocator, inputLocator); String locatorUuid = "PhysicalLocator_" + HwvtepSouthboundMapper.getRandomUUID(); - transaction.add(op.insert(physicalLocator).withId(locatorUuid)); + transaction.add(hwvtepOperationalState.getConnectionInstance().ops() + .insert(physicalLocator).withId(locatorUuid)); hwvtepOperationalState.getDeviceInfo().addToControllerTx(TransactionType.ADD, new StringBuilder(physicalLocator.toString()).append(" Uuid ").append(locatorUuid)); LOG.info("CONTROLLER - {} {}", TransactionType.ADD, diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalRemoveCommand.java index b5b69ea12..30bae44c2 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalRemoveCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.List; import java.util.Map; @@ -49,6 +47,8 @@ public class UcastMacsLocalRemoveCommand private void removeUcastMacLocal(final TransactionBuilder transaction, final InstanceIdentifier instanceIdentifier, final List macList) { + final var op = ops(); + for (LocalUcastMacs mac: macList) { LOG.debug("Removing remoteUcastMacs, mac address: {}", mac.getMacEntryKey().getValue()); Optional operationalMacOptional = diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalUpdateCommand.java index b3417df7b..967c1af15 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalUpdateCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.List; import java.util.Map; @@ -55,6 +53,8 @@ public class UcastMacsLocalUpdateCommand private void updateUcastMacsLocal(final TransactionBuilder transaction, final InstanceIdentifier instanceIdentifier, final List localUcastMacs) { + final var op = ops(); + for (LocalUcastMacs localUcastMac: localUcastMacs) { LOG.debug("Creating localUcastMacs, mac address: {}", localUcastMac.getMacEntryKey().getValue()); final Optional operationalMacOptional = diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java index 8be5952fe..b5ac30713 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import com.google.common.collect.Lists; import java.util.Collection; import java.util.List; @@ -85,6 +83,8 @@ public class UcastMacsRemoteRemoveCommand final InstanceIdentifier instanceIdentifier, final List macList) { String nodeId = instanceIdentifier.firstKeyOf(Node.class).getNodeId().getValue(); + final var op = ops(); + for (RemoteUcastMacs mac: macList) { final InstanceIdentifier macIid = instanceIdentifier.augmentation(HwvtepGlobalAugmentation.class) diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java index be27d9909..1973807f8 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import com.google.common.collect.Lists; import java.util.Collection; import java.util.Collections; @@ -99,7 +97,7 @@ public class UcastMacsRemoteUpdateCommand setMac(ucastMacsRemote, remoteUcastMac); LOG.trace("DoDeviceTransaction: creating RemotUcastMac entry: {} txId: {}", macKey, getOperationalState().getTransactionId()); - transaction.add(op.insert(ucastMacsRemote)); + transaction.add(ops().insert(ucastMacsRemote)); updateCurrentTxData(RemoteUcastMacs.class, macKey, new UUID("uuid"), remoteUcastMac); LOG.info("CONTROLLER - {} {}", TransactionType.ADD, ucastMacsRemote); return; @@ -121,7 +119,7 @@ public class UcastMacsRemoteUpdateCommand extraMac.getUuidColumn().setData(macEntryUUID); LOG.trace("doDeviceTransaction: updating RemotUcastMac entry: {} txId: {}", macKey, getOperationalState().getTransactionId()); - transaction.add(op.update(ucastMacsRemote) + transaction.add(ops().update(ucastMacsRemote) .where(extraMac.getUuidColumn().getSchema().opEqual(macEntryUUID)) .build()); LOG.info("CONTROLLER - {} {}", TransactionType.UPDATE, ucastMacsRemote); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java index d4baf518f..7472fdfd0 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java @@ -11,6 +11,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.reset; import static org.mockito.Mockito.spy; import com.fasterxml.jackson.databind.JsonNode; @@ -18,14 +19,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.util.concurrent.ListenableFuture; import java.io.IOException; import java.io.InputStream; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.net.InetAddress; import java.util.List; import java.util.concurrent.ExecutionException; -import org.apache.commons.lang3.reflect.FieldUtils; import org.junit.After; import org.junit.Before; import org.mockito.ArgumentCaptor; @@ -78,18 +74,6 @@ import org.slf4j.LoggerFactory; public class DataChangeListenerTestBase extends AbstractDataBrokerTest { private static final Logger LOG = LoggerFactory.getLogger(DataChangeListenerTestBase.class); - // Hack to hack into Field.class for now - private static final VarHandle MODIFIERS; - - static { - try { - var lookup = MethodHandles.privateLookupIn(Field.class, MethodHandles.lookup()); - MODIFIERS = lookup.findVarHandle(Field.class, "modifiers", int.class); - } catch (IllegalAccessException | NoSuchFieldException e) { - throw new ExceptionInInitializerError(e); - } - } - EntityOwnershipService entityOwnershipService; OvsdbClient ovsdbClient; TypedDatabaseSchema dbSchema; @@ -109,6 +93,8 @@ public class DataChangeListenerTestBase extends AbstractDataBrokerTest { InstanceIdentifier ls0Iid; InstanceIdentifier ls1Iid; + Operations mockOp; + @Before public void setupTest() throws Exception { entityOwnershipService = mock(EntityOwnershipService.class); @@ -120,8 +106,9 @@ public class DataChangeListenerTestBase extends AbstractDataBrokerTest { new LogicalSwitchesKey(new HwvtepNodeName("ls1"))); loadSchema(); + mockOp = mock(Operations.class); transactionInvoker = new TransactionInvokerImpl(getDataBroker()); - hwvtepConnectionManager = spy(new HwvtepConnectionManager(getDataBroker(), transactionInvoker, + hwvtepConnectionManager = spy(new HwvtepConnectionManager(getDataBroker(), transactionInvoker, mockOp, entityOwnershipService, mock(OvsdbConnection.class))); connectionInfo = mock(OvsdbConnectionInfo.class); @@ -133,7 +120,7 @@ public class DataChangeListenerTestBase extends AbstractDataBrokerTest { doReturn(listenableDbSchema).when(ovsdbClient).getSchema(anyString()); connectionInstance = new HwvtepConnectionInstance(hwvtepConnectionManager, null, ovsdbClient, nodeIid, - transactionInvoker, getDataBroker()); + transactionInvoker, getDataBroker(), mockOp); connectionInstance.reconciliationFt.set(Boolean.TRUE); connectionInstance.firstUpdateTriggered.set(true); connectionInstance.setControllerTxHistory(new TransactionHistory(10000, 7500)); @@ -161,24 +148,6 @@ public class DataChangeListenerTestBase extends AbstractDataBrokerTest { deleteNode(LogicalDatastoreType.CONFIGURATION); } - protected static final void setFinalStatic(final Class cls, final String fieldName, final Object newValue) - throws SecurityException, ReflectiveOperationException { - Field[] fields = FieldUtils.getAllFields(cls); - for (Field field : fields) { - if (fieldName.equals(field.getName())) { - field.setAccessible(true); - - final int mods = field.getModifiers(); - if (Modifier.isFinal(mods)) { - MODIFIERS.set(field, mods & ~Modifier.FINAL); - } - - field.set(null, newValue); - break; - } - } - } - void loadSchema() { try (InputStream resourceAsStream = DataChangeListenerTestBase.class.getResourceAsStream( "hwvtep_schema.json")) { @@ -201,13 +170,15 @@ public class DataChangeListenerTestBase extends AbstractDataBrokerTest { * Resets the captures so that we can validate the captors of the immediate next execution. */ void resetOperations() { + reset(mockOp); + insertOpCapture = ArgumentCaptor.forClass(TypedBaseTable.class); Delete delete = mock(Delete.class); Where where = mock(Where.class); doReturn(where).when(delete).where(any()); Insert insert = mock(Insert.class); doReturn(insert).when(insert).withId(any(String.class)); - Operations mockOp = mock(Operations.class); + doReturn(insert).when(mockOp).insert(insertOpCapture.capture()); Update update = mock(Update.class); doReturn(update).when(mockOp).update(insertOpCapture.capture()); @@ -216,14 +187,6 @@ public class DataChangeListenerTestBase extends AbstractDataBrokerTest { doReturn(where).when(update).where(any()); doReturn(delete).when(mockOp).delete(any()); - - - try { - setFinalStatic(Operations.class, "op", mockOp); - } catch (SecurityException | ReflectiveOperationException e) { - throw new AssertionError("Set of Operations.op field failed", e); - } - ListenableFuture> ft = mock(ListenableFuture.class); transactCaptor = ArgumentCaptor.forClass(List.class); doReturn(ft).when(ovsdbClient).transact(any(DatabaseSchema.class), transactCaptor.capture()); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java index 219f0b1d7..e65280111 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java @@ -24,7 +24,6 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable; import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalSwitch; import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsRemote; @@ -109,7 +108,7 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { addData(LogicalDatastoreType.OPERATIONAL, LogicalSwitches.class, logicalSwitches); resetOperations(); deleteData(LogicalDatastoreType.CONFIGURATION, LogicalSwitches.class, logicalSwitches); - verify(Operations.op, times(10)).delete(any()); + verify(mockOp, times(10)).delete(any()); } @Test @@ -120,7 +119,7 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { addData(LogicalDatastoreType.CONFIGURATION, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.CONFIGURATION, RemoteUcastMacs.class, ucastMacs); //4 ucast macs + 2 termination points - verify(Operations.op, times(4)).insert(any(UcastMacsRemote.class)); + verify(mockOp, times(4)).insert(any(UcastMacsRemote.class)); //TODO add finer grained validation } @@ -131,7 +130,7 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteUcastMacs.class, ucastMacs); //4 ucast macs + 2 termination points - verify(Operations.op, times(4)).insert(any(UcastMacsRemote.class)); + verify(mockOp, times(4)).insert(any(UcastMacsRemote.class)); //TODO add finer grained validation } @@ -146,7 +145,7 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { resetOperations(); deleteData(LogicalDatastoreType.CONFIGURATION, RemoteUcastMacs.class, ucastMacs); - verify(Operations.op, times(4)).delete(any()); + verify(mockOp, times(4)).delete(any()); //TODO add finer grained validation } @@ -158,7 +157,7 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { addData(LogicalDatastoreType.CONFIGURATION, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMacs); //2 mcast macs + 2 locator sets + 3 termination points - verify(Operations.op, times(7)).insert(ArgumentMatchers.any()); + verify(mockOp, times(7)).insert(ArgumentMatchers.any()); } @Test @@ -168,7 +167,7 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMacs); //2 mcast macs + 2 locator sets + 3 termination points - verify(Operations.op, times(7)).insert(ArgumentMatchers.any()); + verify(mockOp, times(7)).insert(ArgumentMatchers.any()); } @Test @@ -182,7 +181,7 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { resetOperations(); deleteData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMacs); - verify(Operations.op, times(2)).delete(ArgumentMatchers.any()); + verify(mockOp, times(2)).delete(ArgumentMatchers.any()); } @Test @@ -192,14 +191,14 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.CONFIGURATION, RemoteUcastMacs.class, ucastMacs); - verify(Operations.op, times(4)).insert(any(UcastMacsRemote.class)); + verify(mockOp, times(4)).insert(any(UcastMacsRemote.class)); addData(LogicalDatastoreType.OPERATIONAL, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.OPERATIONAL, RemoteUcastMacs.class, ucastMacs); resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMacs); //2 mcast mac + 2 locator sets ( termination point already added ) - verify(Operations.op, times(4)).insert(ArgumentMatchers.any()); + verify(mockOp, times(4)).insert(ArgumentMatchers.any()); } @Test @@ -209,20 +208,20 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.CONFIGURATION, RemoteUcastMacs.class, ucastMacs); - verify(Operations.op, times(4)).insert(any(UcastMacsRemote.class)); + verify(mockOp, times(4)).insert(any(UcastMacsRemote.class)); addData(LogicalDatastoreType.OPERATIONAL, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.OPERATIONAL, RemoteUcastMacs.class, ucastMacs); resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMacs); - verify(Operations.op, times(4)).insert(ArgumentMatchers.any()); + verify(mockOp, times(4)).insert(ArgumentMatchers.any()); addData(LogicalDatastoreType.OPERATIONAL, RemoteMcastMacs.class, mcastMacs); resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMac2); - verify(Operations.op, times(2)).insert(ArgumentMatchers.any()); - verify(Operations.op, times(2)).update(ArgumentMatchers.any()); - verify(Operations.op, times(0)).delete(ArgumentMatchers.any()); + verify(mockOp, times(2)).insert(ArgumentMatchers.any()); + verify(mockOp, times(2)).update(ArgumentMatchers.any()); + verify(mockOp, times(0)).delete(ArgumentMatchers.any()); } @Test @@ -232,13 +231,13 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.CONFIGURATION, RemoteUcastMacs.class, ucastMacs); - verify(Operations.op, times(4)).insert(any(UcastMacsRemote.class)); + verify(mockOp, times(4)).insert(any(UcastMacsRemote.class)); addData(LogicalDatastoreType.OPERATIONAL, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.OPERATIONAL, RemoteUcastMacs.class, ucastMacs); resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMacs); - verify(Operations.op, times(4)).insert(ArgumentMatchers.any()); + verify(mockOp, times(4)).insert(ArgumentMatchers.any()); addData(LogicalDatastoreType.OPERATIONAL, RemoteMcastMacs.class, mcastMacs); resetOperations(); @@ -252,7 +251,7 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { augIid.child(RemoteMcastMacs.class, new RemoteMcastMacsKey(TestBuilders.buildLogicalSwitchesRef(nodeIid, "ls1"), macAddr)) .child(LocatorSet.class)); - verify(Operations.op, times(2)).delete(ArgumentMatchers.any()); + verify(mockOp, times(2)).delete(ArgumentMatchers.any()); } @Test @@ -262,32 +261,32 @@ public class HwvtepDataChangeListenerTest extends DataChangeListenerTestBase { resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.CONFIGURATION, RemoteUcastMacs.class, ucastMacs); - verify(Operations.op, times(4)).insert(any(UcastMacsRemote.class)); + verify(mockOp, times(4)).insert(any(UcastMacsRemote.class)); resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMacs); //2 mcast mac + 2 locator sets ( termination point already added ) - verify(Operations.op, times(0)).insert(ArgumentMatchers.any()); + verify(mockOp, times(0)).insert(ArgumentMatchers.any()); resetOperations(); addData(LogicalDatastoreType.OPERATIONAL, TerminationPoint.class, terminationPoints); addData(LogicalDatastoreType.OPERATIONAL, RemoteUcastMacs.class, ucastMacs); connectionInstance.getDeviceInfo().onOperDataAvailable(); //2 mcast mac + 2 locator sets ( termination point already added ) - verify(Operations.op, timeout(2000).times(4)).insert(ArgumentMatchers.any()); + verify(mockOp, timeout(2000).times(4)).insert(ArgumentMatchers.any()); resetOperations(); addData(LogicalDatastoreType.CONFIGURATION, RemoteMcastMacs.class, mcastMac2); - verify(Operations.op, times(0)).insert(ArgumentMatchers.any()); + verify(mockOp, times(0)).insert(ArgumentMatchers.any()); addData(LogicalDatastoreType.OPERATIONAL, RemoteMcastMacs.class, mcastMacs); connectionInstance.getDeviceInfo().onOperDataAvailable(); - verify(Operations.op, timeout(2000).times(2)).insert(ArgumentMatchers.any()); - verify(Operations.op, times(2)).update(ArgumentMatchers.any()); + verify(mockOp, timeout(2000).times(2)).insert(ArgumentMatchers.any()); + verify(mockOp, times(2)).update(ArgumentMatchers.any()); } private void verifyThatLogicalSwitchCreated() { //The transactions could be firing in two different mdsal updates intermittently //verify(ovsdbClient, times(1)).transact(any(DatabaseSchema.class), any(List.class)); - verify(Operations.op, times(2)).insert(any(LogicalSwitch.class)); + verify(mockOp, times(2)).insert(any(LogicalSwitch.class)); assertNotNull(insertOpCapture.getAllValues()); assertTrue(insertOpCapture.getAllValues().size() == 2); diff --git a/library/impl/src/main/java/org/opendaylight/ovsdb/lib/operations/DefaultOperations.java b/library/impl/src/main/java/org/opendaylight/ovsdb/lib/operations/DefaultOperations.java new file mode 100644 index 000000000..aeee02e07 --- /dev/null +++ b/library/impl/src/main/java/org/opendaylight/ovsdb/lib/operations/DefaultOperations.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 PANTHEON.tech, s.r.o. 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.ovsdb.lib.operations; + +import javax.inject.Inject; +import javax.inject.Singleton; +import org.opendaylight.ovsdb.lib.notation.Row; +import org.opendaylight.ovsdb.lib.schema.TableSchema; +import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; + +/** + * Default implementation of {@link Operations}. + */ +@Singleton +@Component +public final class DefaultOperations implements Operations { + @Inject + @Activate + public DefaultOperations() { + // Nothing else + } + + @Override + public > Insert insert(final TableSchema schema) { + return new Insert<>(schema); + } + + @Override + public > Insert insert(final TypedBaseTable typedTable) { + return new Insert<>(typedTable); + } + + @Override + public > Insert insert(final TableSchema schema, final Row row) { + return new Insert<>(schema, row); + } + + @Override + public > Update update(final TableSchema schema) { + return new Update<>(schema); + } + + @Override + public > Update update(final TypedBaseTable typedTable) { + return new Update<>(typedTable); + } + + @Override + public > Update update(final TableSchema schema, final Row row) { + return new Update<>(schema, row); + } + + @Override + public > Delete delete(final TableSchema schema) { + return new Delete<>(schema); + } + + @Override + public > Mutate mutate(final TableSchema schema) { + return new Mutate<>(schema); + } + + @Override + public > Mutate mutate(final TypedBaseTable typedTable) { + return new Mutate<>(typedTable.getSchema()); + } + + @Override + public Commit commit(final Boolean durable) { + return new Commit(durable); + } + + @Override + public Abort abort() { + return new Abort(); + } + + @Override + public > Select select(final TableSchema schema) { + return new Select<>(schema); + } + + @Override + public Comment comment(final String comment) { + return new Comment(comment); + } + + @Override + public Assert assertion(final String lock) { + return new Assert(lock); + } +} diff --git a/library/impl/src/main/java/org/opendaylight/ovsdb/lib/operations/Operations.java b/library/impl/src/main/java/org/opendaylight/ovsdb/lib/operations/Operations.java index 99056cb62..685db4c43 100644 --- a/library/impl/src/main/java/org/opendaylight/ovsdb/lib/operations/Operations.java +++ b/library/impl/src/main/java/org/opendaylight/ovsdb/lib/operations/Operations.java @@ -5,74 +5,42 @@ * 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.ovsdb.lib.operations; import org.opendaylight.ovsdb.lib.notation.Row; import org.opendaylight.ovsdb.lib.schema.TableSchema; import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable; -public class Operations { - @SuppressWarnings("checkstyle:ConstantName") - public static final Operations op = new Operations(); +public interface Operations { - public > Insert insert(TableSchema schema) { - return new Insert<>(schema); - } + > Insert insert(TableSchema schema); - public > Insert insert(TypedBaseTable typedTable) { - return new Insert<>(typedTable); - } + > Insert insert(TypedBaseTable typedTable); - public > Insert insert(TableSchema schema, Row row) { - return new Insert<>(schema, row); - } + > Insert insert(TableSchema schema, Row row); - public > Update update(TableSchema schema) { - return new Update<>(schema); - } + > Update update(TableSchema schema); - public > Update update(TypedBaseTable typedTable) { - return new Update<>(typedTable); - } + > Update update(TypedBaseTable typedTable); - public > Update update(TableSchema schema, Row row) { - return new Update<>(schema, row); - } + > Update update(TableSchema schema, Row row); - public > Delete delete(TableSchema schema) { - return new Delete<>(schema); - } + > Delete delete(TableSchema schema); - public > Mutate mutate(TableSchema schema) { - return new Mutate<>(schema); - } + > Mutate mutate(TableSchema schema); - public > Mutate mutate(TypedBaseTable typedTable) { - return new Mutate<>(typedTable.getSchema()); - } + > Mutate mutate(TypedBaseTable typedTable); - public Commit commit(Boolean durable) { - return new Commit(durable); - } + Commit commit(Boolean durable); - public Abort abort() { - return new Abort(); - } + Abort abort(); - public > Select select(TableSchema schema) { - return new Select<>(schema); - } + > Select select(TableSchema schema); - public Comment comment(String comment) { - return new Comment(comment); - } + Comment comment(String comment); /* - * Could not use Java keyword "assert" which clashes with the ovsdb json-rpc method. - * using assertion instead. + * Could not use Java keyword "assert" which clashes with the ovsdb json-rpc method. using assertion instead. */ - public Assert assertion(String lock) { - return new Assert(lock); - } + Assert assertion(String lock); } diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/OvsdbClientTestIT.java b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/OvsdbClientTestIT.java index c3627bdb7..ac84e4d89 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/OvsdbClientTestIT.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/OvsdbClientTestIT.java @@ -13,7 +13,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/OvsdbClientTestTypedIT.java b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/OvsdbClientTestTypedIT.java index af1cdc01f..350443b9a 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/OvsdbClientTestTypedIT.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/ovsdbclient/OvsdbClientTestTypedIT.java @@ -11,7 +11,6 @@ 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 static org.opendaylight.ovsdb.lib.operations.Operations.op; import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.ListenableFuture; diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/HardwareVTEPIT.java b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/HardwareVTEPIT.java index 8e96c2948..4c7f3fe2e 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/HardwareVTEPIT.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/HardwareVTEPIT.java @@ -10,7 +10,6 @@ package org.opendaylight.ovsdb.integrationtest.schema; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assume.assumeTrue; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import java.util.Collections; import java.util.List; diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/OpenVSwitchIT.java b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/OpenVSwitchIT.java index da1c237b8..5846073eb 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/OpenVSwitchIT.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/integrationtest/schema/OpenVSwitchIT.java @@ -15,7 +15,6 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/lib/it/LibraryIT.java b/library/it/src/test/java/org/opendaylight/ovsdb/lib/it/LibraryIT.java index 41022ff5b..8919c98e2 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/lib/it/LibraryIT.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/lib/it/LibraryIT.java @@ -11,7 +11,6 @@ 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 static org.opendaylight.ovsdb.lib.operations.Operations.op; import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.ListenableFuture; diff --git a/library/it/src/test/java/org/opendaylight/ovsdb/lib/it/LibraryIntegrationTestBase.java b/library/it/src/test/java/org/opendaylight/ovsdb/lib/it/LibraryIntegrationTestBase.java index e72fee3da..99ee19662 100644 --- a/library/it/src/test/java/org/opendaylight/ovsdb/lib/it/LibraryIntegrationTestBase.java +++ b/library/it/src/test/java/org/opendaylight/ovsdb/lib/it/LibraryIntegrationTestBase.java @@ -41,7 +41,9 @@ import org.opendaylight.ovsdb.lib.message.TableUpdates; import org.opendaylight.ovsdb.lib.notation.Row; import org.opendaylight.ovsdb.lib.notation.UUID; import org.opendaylight.ovsdb.lib.notation.Version; +import org.opendaylight.ovsdb.lib.operations.DefaultOperations; import org.opendaylight.ovsdb.lib.operations.OperationResult; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.DatabaseSchema; import org.opendaylight.ovsdb.lib.schema.GenericTableSchema; @@ -72,6 +74,8 @@ public abstract class LibraryIntegrationTestBase extends AbstractMdsalTestBase { private static boolean monitorReady = false; public String schema; + protected final Operations op = new DefaultOperations(); + protected static Map> getTableCache() { return tableCache; } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java index 3c36c9e89..46b5df2b2 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.ListenableFuture; @@ -41,6 +39,7 @@ import org.opendaylight.ovsdb.lib.notation.UUID; import org.opendaylight.ovsdb.lib.operations.Mutate; import org.opendaylight.ovsdb.lib.operations.Operation; import org.opendaylight.ovsdb.lib.operations.OperationResult; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.DatabaseSchema; import org.opendaylight.ovsdb.lib.schema.GenericTableSchema; @@ -83,6 +82,7 @@ public class OvsdbConnectionInstance { private final OvsdbClient client; private ConnectionInfo connectionInfo; + private final Operations ops; private final TransactionInvoker txInvoker; private Map transactInvokers = null; private MonitorCallBack callback = null; @@ -94,12 +94,12 @@ public class OvsdbConnectionInstance { private final Map> ports = new ConcurrentHashMap<>(); private final Map> portInterfaces = new ConcurrentHashMap<>(); - OvsdbConnectionInstance(final ConnectionInfo key, final OvsdbClient client, final TransactionInvoker txInvoker, - final InstanceIdentifier iid) { - connectionInfo = key; + OvsdbConnectionInstance(final ConnectionInfo connectionInfo, final OvsdbClient client, final Operations ops, + final TransactionInvoker txInvoker, final InstanceIdentifier iid) { + this.connectionInfo = connectionInfo; this.client = client; + this.ops = ops; this.txInvoker = txInvoker; - // this.key = key; instanceIdentifier = iid; } @@ -166,7 +166,7 @@ public class OvsdbConnectionInstance { public void registerCallbacks(final InstanceIdentifierCodec instanceIdentifierCodec) { if (callback == null) { if (initialCreateData != null) { - this.updateConnectionAttributes(instanceIdentifierCodec); + updateConnectionAttributes(instanceIdentifierCodec); } try { @@ -246,7 +246,7 @@ public class OvsdbConnectionInstance { ovs.setExternalIds( YangUtils.convertYangKeyValueListToMap(externalIds, OpenvswitchExternalIds::requireExternalIdKey, OpenvswitchExternalIds::requireExternalIdValue)); - Mutate mutate = op.mutate(ovs) + Mutate mutate = ops.mutate(ovs) .addMutation(ovs.getExternalIdsColumn().getSchema(), Mutator.INSERT, ovs.getExternalIdsColumn().getData()); transaction.add(mutate); @@ -256,7 +256,7 @@ public class OvsdbConnectionInstance { if (otherConfigs != null) { ovs.setOtherConfig(YangUtils.convertYangKeyValueListToMap(otherConfigs, OpenvswitchOtherConfigs::requireOtherConfigKey, OpenvswitchOtherConfigs::requireOtherConfigValue)); - transaction.add(op.mutate(ovs).addMutation(ovs.getOtherConfigColumn().getSchema(), + transaction.add(ops.mutate(ovs).addMutation(ovs.getOtherConfigColumn().getSchema(), Mutator.INSERT, ovs.getOtherConfigColumn().getData())); } @@ -264,12 +264,12 @@ public class OvsdbConnectionInstance { } } - private static void stampInstanceIdentifier(final TransactionBuilder transaction,final InstanceIdentifier iid, + private void stampInstanceIdentifier(final TransactionBuilder transaction,final InstanceIdentifier iid, final InstanceIdentifierCodec instanceIdentifierCodec) { OpenVSwitch ovs = transaction.getTypedRowWrapper(OpenVSwitch.class); ovs.setExternalIds(Collections.emptyMap()); - TransactUtils.stampInstanceIdentifier(transaction, iid, ovs.getSchema(), ovs.getExternalIdsColumn().getSchema(), - instanceIdentifierCodec); + TransactUtils.stampInstanceIdentifier(ops, transaction, iid, ovs.getSchema(), + ovs.getExternalIdsColumn().getSchema(), instanceIdentifierCodec); } private static void invoke(final TransactionBuilder txBuilder) { @@ -428,4 +428,7 @@ public class OvsdbConnectionInstance { return client; } + public Operations ops() { + return ops; + } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java index 7cbd5b2e7..266fdc865 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java @@ -8,7 +8,6 @@ package org.opendaylight.ovsdb.southbound; import static java.util.Objects.requireNonNull; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import com.google.common.annotations.VisibleForTesting; import com.google.common.util.concurrent.FluentFuture; @@ -41,6 +40,7 @@ import org.opendaylight.ovsdb.lib.OvsdbConnection; import org.opendaylight.ovsdb.lib.OvsdbConnectionListener; import org.opendaylight.ovsdb.lib.operations.Operation; import org.opendaylight.ovsdb.lib.operations.OperationResult; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.Select; import org.opendaylight.ovsdb.lib.schema.GenericTableSchema; import org.opendaylight.ovsdb.lib.schema.typed.TypedDatabaseSchema; @@ -76,6 +76,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos new ConcurrentHashMap<>(); private final ConcurrentMap entityConnectionMap = new ConcurrentHashMap<>(); private final DataBroker db; + private final Operations ops; private final TransactionInvoker txInvoker; private final EntityOwnershipService entityOwnershipService; private final OvsdbDeviceEntityOwnershipListener ovsdbDeviceEntityOwnershipListener; @@ -83,13 +84,14 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos private final ReconciliationManager reconciliationManager; private final InstanceIdentifierCodec instanceIdentifierCodec; - public OvsdbConnectionManager(final DataBroker db,final TransactionInvoker txInvoker, + public OvsdbConnectionManager(final DataBroker db, final Operations ops, final TransactionInvoker txInvoker, final EntityOwnershipService entityOwnershipService, final OvsdbConnection ovsdbConnection, final InstanceIdentifierCodec instanceIdentifierCodec, final List reconcileBridgeInclusionList, final List reconcileBridgeExclusionList) { this.db = db; + this.ops = ops; this.txInvoker = txInvoker; this.entityOwnershipService = entityOwnershipService; ovsdbDeviceEntityOwnershipListener = new OvsdbDeviceEntityOwnershipListener(this, entityOwnershipService); @@ -135,39 +137,37 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos + "Disconnecting from the device.", externalClient.getConnectionInfo().getRemoteAddress(), e); externalClient.disconnect(); } - } public OvsdbConnectionInstance connectedButCallBacksNotRegistered(final OvsdbClient externalClient) { LOG.info("OVSDB Connection from {}:{}",externalClient.getConnectionInfo().getRemoteAddress(), externalClient.getConnectionInfo().getRemotePort()); - ConnectionInfo key = SouthboundMapper.createConnectionInfo(externalClient); - OvsdbConnectionInstance ovsdbConnectionInstance = getConnectionInstance(key); + final var info = SouthboundMapper.createConnectionInfo(externalClient); // Check if existing ovsdbConnectionInstance for the OvsdbClient present. // In such cases, we will see if the ovsdbConnectionInstance has same externalClient. - if (ovsdbConnectionInstance != null) { - if (ovsdbConnectionInstance.hasOvsdbClient(externalClient)) { - LOG.warn("OVSDB Connection Instance {} already exists for client {}", key, externalClient); - return ovsdbConnectionInstance; + final var existing = getConnectionInstance(info); + if (existing != null) { + if (existing.hasOvsdbClient(externalClient)) { + LOG.warn("OVSDB Connection Instance {} already exists for client {}", info, externalClient); + return existing; } - LOG.warn("OVSDB Connection Instance {} being replaced with client {}", key, externalClient); + + LOG.warn("OVSDB Connection Instance {} being replaced with client {}", info, externalClient); // Unregister Cluster Ownership for ConnectionInfo // Because the ovsdbConnectionInstance is about to be completely replaced! - unregisterEntityForOwnership(ovsdbConnectionInstance); + unregisterEntityForOwnership(existing); - ovsdbConnectionInstance.disconnect(); - - removeConnectionInstance(key); - - stopBridgeConfigReconciliationIfActive(ovsdbConnectionInstance.getInstanceIdentifier()); + // Disconnect and clean up + existing.disconnect(); + removeConnectionInstance(info); + stopBridgeConfigReconciliationIfActive(existing.getInstanceIdentifier()); } - ovsdbConnectionInstance = new OvsdbConnectionInstance(key, externalClient, txInvoker, - getInstanceIdentifier(key)); - ovsdbConnectionInstance.createTransactInvokers(); - return ovsdbConnectionInstance; + final var ret = new OvsdbConnectionInstance(info, externalClient, ops, txInvoker, getInstanceIdentifier(info)); + ret.createTransactInvokers(); + return ret; } @Override @@ -520,7 +520,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos } - private static OpenVSwitch getOpenVswitchTableEntry(final OvsdbConnectionInstance connectionInstance) { + private OpenVSwitch getOpenVswitchTableEntry(final OvsdbConnectionInstance connectionInstance) { final TypedDatabaseSchema dbSchema; try { dbSchema = connectionInstance.getSchema(OvsdbSchemaContants.DATABASE_NAME).get(); @@ -531,12 +531,12 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos } final GenericTableSchema openVSwitchSchema = dbSchema.getTableSchema(OpenVSwitch.class); - final Select selectOperation = op.select(openVSwitchSchema); + final Select selectOperation = ops.select(openVSwitchSchema); selectOperation.setColumns(openVSwitchSchema.getColumnList()); List operations = new ArrayList<>(); operations.add(selectOperation); - operations.add(op.comment("Fetching Open_VSwitch table rows")); + operations.add(ops.comment("Fetching Open_VSwitch table rows")); final List results; try { results = connectionInstance.transact(dbSchema, operations).get(); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListener.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListener.java index d25e27e9f..b93fde241 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListener.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListener.java @@ -227,7 +227,7 @@ public final class OvsdbDataTreeChangeListener implements DataTreeChangeListener changesPerConnectionInstance(changes).entrySet()) { OvsdbConnectionInstance connectionInstance = connectionInstanceEntry.getKey(); Collection> clientChanges = connectionInstanceEntry.getValue(); - connectionInstance.transact(new TransactCommandAggregator(), + connectionInstance.transact(new TransactCommandAggregator(connectionInstance.ops()), new BridgeOperationalState(db, clientChanges), clientChanges, instanceIdentifierCodec); } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbOperGlobalListener.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbOperGlobalListener.java index ff767fd4e..f95eab7c7 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbOperGlobalListener.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbOperGlobalListener.java @@ -70,31 +70,29 @@ public final class OvsdbOperGlobalListener implements DataTreeChangeListener> changes) { changes.forEach(change -> { try { - InstanceIdentifier key = change.getRootPath().path(); - DataObjectModification mod = change.getRootNode(); - Node addNode = getCreated(mod); + final var key = change.getRootPath().path(); + final var mod = change.getRootNode(); + final var addNode = getCreated(mod); if (addNode != null) { OPER_NODE_CACHE.put(key, addNode); LOG.info("Node added to oper {}", SouthboundUtil.getOvsdbNodeId(key)); } - Node removedNode = getRemoved(mod); + final var removedNode = getRemoved(mod); if (removedNode != null) { OPER_NODE_CACHE.remove(key); LOG.info("Node deleted from oper {}", SouthboundUtil.getOvsdbNodeId(key)); - OvsdbConnectionInstance connectionInstance = ovsdbConnectionManager.getConnectionInstance(key); + final var connectionInstance = ovsdbConnectionManager.getConnectionInstance(key); if (connectionInstance != null && connectionInstance.isActive() && connectionInstance.getHasDeviceOwnership()) { - //Oops some one deleted the node held by me This should never happen. - //put the node back in oper - txInvoker.invoke(transaction -> { - transaction.put(LogicalDatastoreType.OPERATIONAL, key, removedNode); - }); - + // Oops some one deleted the node held by me. + // This should never happen. + // Put the node back in oper + txInvoker.invoke(tx -> tx.put(LogicalDatastoreType.OPERATIONAL, key, removedNode)); } } - Node modifiedNode = getUpdated(mod); + final var modifiedNode = getUpdated(mod); if (modifiedNode != null) { OPER_NODE_CACHE.put(key, modifiedNode); } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java index d62cde5dc..f0cb1a006 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java @@ -38,6 +38,7 @@ import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService; import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException; import org.opendaylight.mdsal.eos.common.api.EntityOwnershipStateChange; import org.opendaylight.ovsdb.lib.OvsdbConnection; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.southbound.transactions.md.TransactionInvoker; import org.opendaylight.ovsdb.southbound.transactions.md.TransactionInvokerImpl; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; @@ -97,9 +98,10 @@ public class SouthboundProvider implements DataTreeChangeListener, Aut final DOMSchemaService schemaService, final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer, final SystemReadyMonitor systemReadyMonitor, - final DiagStatusService diagStatusService) { + final DiagStatusService diagStatusService, + final Operations ops) { this(dataBroker, entityOwnershipServiceDependency, ovsdbConnection, schemaService, - bindingNormalizedNodeSerializer, systemReadyMonitor, diagStatusService, false, List.of(), List.of()); + bindingNormalizedNodeSerializer, systemReadyMonitor, diagStatusService, ops, false, List.of(), List.of()); } @Activate @@ -110,9 +112,10 @@ public class SouthboundProvider implements DataTreeChangeListener, Aut @Reference final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer, @Reference final SystemReadyMonitor systemReadyMonitor, @Reference final DiagStatusService diagStatusService, + @Reference final Operations ops, final Configuration configuration) { this(dataBroker, entityOwnershipServiceDependency, ovsdbConnection, schemaService, - bindingNormalizedNodeSerializer, systemReadyMonitor, diagStatusService, + bindingNormalizedNodeSerializer, systemReadyMonitor, diagStatusService, ops, configuration.skip$_$monitoring$_$manager$_$status(), getBridgesList(configuration.bridge$_$reconciliation$_$inclusion$_$list()), getBridgesList(configuration.bridge$_$reconciliation$_$exclusion$_$list())); @@ -127,6 +130,7 @@ public class SouthboundProvider implements DataTreeChangeListener, Aut final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer, final SystemReadyMonitor systemReadyMonitor, final DiagStatusService diagStatusService, + final Operations ops, final boolean skipMonitoringManagerStatus, final List bridgeReconciliationInclusionList, final List bridgeReconciliationExclusionList) { @@ -148,7 +152,7 @@ public class SouthboundProvider implements DataTreeChangeListener, Aut ovsdbStatusProvider.reportStatus(ServiceState.STARTING, "OVSDB initialization in progress"); txInvoker = new TransactionInvokerImpl(dataBroker); - cm = new OvsdbConnectionManager(dataBroker, txInvoker, entityOwnershipService, ovsdbConnection, + cm = new OvsdbConnectionManager(dataBroker, ops, txInvoker, entityOwnershipService, ovsdbConnection, instanceIdentifierCodec, bridgeReconciliationInclusionList, bridgeReconciliationExclusionList); ovsdbDataTreeChangeListener = new OvsdbDataTreeChangeListener(dataBroker, cm, instanceIdentifierCodec); ovsdbOperGlobalListener = new OvsdbOperGlobalListener(dataBroker, cm, txInvoker); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AbstractTransactCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AbstractTransactCommand.java new file mode 100644 index 000000000..fcabaec11 --- /dev/null +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AbstractTransactCommand.java @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2024 PANTHEON.tech, s.r.o. 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.ovsdb.southbound.ovsdb.transact; + +import static java.util.Objects.requireNonNull; + +import org.opendaylight.ovsdb.lib.operations.Operations; + +abstract class AbstractTransactCommand implements TransactCommand { + final Operations op; + + AbstractTransactCommand(final Operations op) { + this.op = requireNonNull(op); + } +} diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachRemovedCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachRemovedCommand.java index 8037fa63d..8c92101a5 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachRemovedCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachRemovedCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Collection; import java.util.Collections; @@ -20,6 +18,7 @@ import org.opendaylight.mdsal.binding.api.ReadTransaction; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.AutoAttach; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; @@ -38,9 +37,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressFBWarnings("UPM_UNCALLED_PRIVATE_METHOD") -public class AutoAttachRemovedCommand implements TransactCommand { +public class AutoAttachRemovedCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(AutoAttachRemovedCommand.class); + public AutoAttachRemovedCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Collection> modifications, @@ -56,9 +59,9 @@ public class AutoAttachRemovedCommand implements TransactCommand { TransactUtils.extractUpdated(events, OvsdbNodeAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, - final Map, OvsdbNodeAugmentation> original, - final Map, OvsdbNodeAugmentation> updated) { + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + final Map, OvsdbNodeAugmentation> original, + final Map, OvsdbNodeAugmentation> updated) { for (var originalEntry : original.entrySet()) { final InstanceIdentifier ovsdbNodeIid = originalEntry.getKey(); final OvsdbNodeAugmentation ovsdbNodeAugmentation = originalEntry.getValue(); @@ -89,9 +92,8 @@ public class AutoAttachRemovedCommand implements TransactCommand { } } - private static void deleteAutoAttach(final BridgeOperationalState state, final TransactionBuilder transaction, - final InstanceIdentifier ovsdbNodeIid, - final Uuid autoattachUuid) { + private void deleteAutoAttach(final BridgeOperationalState state, final TransactionBuilder transaction, + final InstanceIdentifier ovsdbNodeIid, final Uuid autoattachUuid) { LOG.debug("Received request to delete Autoattach entry {}", autoattachUuid); final OvsdbBridgeAugmentation bridgeAugmentation = getBridge(state, ovsdbNodeIid, autoattachUuid); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachUpdateCommand.java index 8c6833a87..cd57ae568 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachUpdateCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Collection; import java.util.HashMap; @@ -20,6 +18,7 @@ import org.opendaylight.mdsal.binding.api.ReadTransaction; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.AutoAttach; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; @@ -47,9 +46,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressFBWarnings("UPM_UNCALLED_PRIVATE_METHOD") -public class AutoAttachUpdateCommand implements TransactCommand { +public class AutoAttachUpdateCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(AutoAttachUpdateCommand.class); + public AutoAttachUpdateCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -60,19 +63,20 @@ public class AutoAttachUpdateCommand implements TransactCommand { public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Collection> modifications, final InstanceIdentifierCodec instanceIdentifierCodec) { - execute(transaction, state, TransactUtils.extractCreatedOrUpdated(modifications, OvsdbNodeAugmentation.class)); + execute(transaction, state, + TransactUtils.extractCreatedOrUpdated(modifications, OvsdbNodeAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, + final BridgeOperationalState state, final Map, OvsdbNodeAugmentation> createdOrUpdated) { for (var ovsdbNodeEntry : createdOrUpdated.entrySet()) { updateAutoAttach(transaction, state, ovsdbNodeEntry.getKey(), ovsdbNodeEntry.getValue()); } } - private static void updateAutoAttach(final TransactionBuilder transaction, final BridgeOperationalState state, - final InstanceIdentifier iid, - final OvsdbNodeAugmentation ovsdbNode) { + private void updateAutoAttach(final TransactionBuilder transaction, final BridgeOperationalState state, + final InstanceIdentifier iid, final OvsdbNodeAugmentation ovsdbNode) { if (!state.getBridgeNode(iid).isPresent()) { return; diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeRemovedCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeRemovedCommand.java index 77c215e61..415d94f82 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeRemovedCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeRemovedCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -17,6 +15,7 @@ import java.util.Set; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch; @@ -27,9 +26,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class BridgeRemovedCommand implements TransactCommand { +public class BridgeRemovedCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(BridgeRemovedCommand.class); + public BridgeRemovedCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -45,7 +48,7 @@ public class BridgeRemovedCommand implements TransactCommand { TransactUtils.extractOriginal(modifications, OvsdbBridgeAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Set> removed, final Map, OvsdbBridgeAugmentation> originals) { for (InstanceIdentifier ovsdbManagedNodeIid: removed) { @@ -71,7 +74,6 @@ public class BridgeRemovedCommand implements TransactCommand { LOG.warn("Unable to delete bridge {} because it was not found in the operational store, " + "and thus we cannot retrieve its UUID", ovsdbManagedNodeIid); } - } } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeUpdateCommand.java index 478c0e15b..4de708787 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeUpdateCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Collection; import java.util.Collections; @@ -22,6 +20,7 @@ import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.UUID; import org.opendaylight.ovsdb.lib.operations.Insert; import org.opendaylight.ovsdb.lib.operations.Mutate; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.GenericTableSchema; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; @@ -40,9 +39,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class BridgeUpdateCommand implements TransactCommand { +public class BridgeUpdateCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(BridgeUpdateCommand.class); + public BridgeUpdateCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -54,12 +57,11 @@ public class BridgeUpdateCommand implements TransactCommand { public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Collection> modifications, final InstanceIdentifierCodec instanceIdentifierCodec) { - execute(transaction, state, - TransactUtils.extractCreatedOrUpdated(modifications, OvsdbBridgeAugmentation.class), + execute(transaction, state, TransactUtils.extractCreatedOrUpdated(modifications, OvsdbBridgeAugmentation.class), instanceIdentifierCodec); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Map, OvsdbBridgeAugmentation> createdOrUpdated, final InstanceIdentifierCodec instanceIdentifierCodec) { for (Entry, OvsdbBridgeAugmentation> ovsdbManagedNodeEntry : @@ -69,7 +71,7 @@ public class BridgeUpdateCommand implements TransactCommand { } } - private static void updateBridge(final TransactionBuilder transaction, final BridgeOperationalState state, + private void updateBridge(final TransactionBuilder transaction, final BridgeOperationalState state, final InstanceIdentifier iid, final OvsdbBridgeAugmentation ovsdbManagedNode, final InstanceIdentifierCodec instanceIdentifierCodec) { LOG.debug("Received request to create ovsdb bridge name: {} uuid: {}", @@ -154,10 +156,10 @@ public class BridgeUpdateCommand implements TransactCommand { } } - private static void setPort(final TransactionBuilder transaction, final Bridge bridge, + private void setPort(final TransactionBuilder transaction, final Bridge bridge, final OvsdbBridgeAugmentation ovsdbManagedNode) { - Insert interfaceInsert = setInterface(transaction,ovsdbManagedNode); + Insert interfaceInsert = setInterface(transaction, ovsdbManagedNode); // Port part String portNamedUuid = "Port_" + SouthboundMapper.getRandomUuid(); Port port = transaction.getTypedRowWrapper(Port.class); @@ -167,7 +169,7 @@ public class BridgeUpdateCommand implements TransactCommand { bridge.setPorts(Set.of(new UUID(portNamedUuid))); } - private static Insert setInterface(final TransactionBuilder transaction, + private Insert setInterface(final TransactionBuilder transaction, final OvsdbBridgeAugmentation ovsdbManagedNode) { // Interface part String interfaceNamedUuid = "Interface_" + SouthboundMapper.getRandomUuid(); @@ -179,8 +181,7 @@ public class BridgeUpdateCommand implements TransactCommand { return result; } - private static void setFailMode(final Bridge bridge, - final OvsdbBridgeAugmentation ovsdbManagedNode) { + private static void setFailMode(final Bridge bridge, final OvsdbBridgeAugmentation ovsdbManagedNode) { if (ovsdbManagedNode.getFailMode() != null && SouthboundConstants.OVSDB_FAIL_MODE_MAP.get(ovsdbManagedNode.getFailMode()) != null) { bridge.setFailMode(Set.of( @@ -188,13 +189,13 @@ public class BridgeUpdateCommand implements TransactCommand { } } - private static void stampInstanceIdentifier(final TransactionBuilder transaction, + private void stampInstanceIdentifier(final TransactionBuilder transaction, final InstanceIdentifier iid, final String bridgeName, final InstanceIdentifierCodec instanceIdentifierCodec) { Bridge bridge = transaction.getTypedRowWrapper(Bridge.class); bridge.setName(bridgeName); bridge.setExternalIds(Collections.emptyMap()); - Mutate mutate = TransactUtils.stampInstanceIdentifierMutation(transaction, iid, bridge.getSchema(), + Mutate mutate = TransactUtils.stampInstanceIdentifierMutation(op, transaction, iid, bridge.getSchema(), bridge.getExternalIdsColumn().getSchema(), instanceIdentifierCodec); transaction.add(mutate .where(bridge.getNameColumn().getSchema().opEqual(bridgeName)) diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerRemovedCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerRemovedCommand.java index 8347f91c7..d01987435 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerRemovedCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerRemovedCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -17,6 +15,7 @@ import java.util.Set; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; @@ -27,9 +26,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ControllerRemovedCommand implements TransactCommand { +public class ControllerRemovedCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(ControllerRemovedCommand.class); + public ControllerRemovedCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -45,10 +48,9 @@ public class ControllerRemovedCommand implements TransactCommand { TransactUtils.extractCreatedOrUpdatedOrRemoved(modifications, OvsdbBridgeAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, - final Set> removedControllers, - final Map, OvsdbBridgeAugmentation> - modifiedBridges) { + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + final Set> removedControllers, + final Map, OvsdbBridgeAugmentation> modifiedBridges) { for (InstanceIdentifier controllerIid : removedControllers) { LOG.debug("Removing Registered...ODL controller : {} ", controllerIid); InstanceIdentifier bridgeIid = diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerUpdateCommand.java index 98e62de3c..17bff0ccd 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerUpdateCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -17,6 +15,7 @@ import java.util.Optional; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; import org.opendaylight.ovsdb.schema.openvswitch.Controller; @@ -29,9 +28,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ControllerUpdateCommand implements TransactCommand { +public class ControllerUpdateCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(ControllerUpdateCommand.class); + public ControllerUpdateCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -47,7 +50,7 @@ public class ControllerUpdateCommand implements TransactCommand { TransactUtils.extractCreatedOrUpdated(modifications, OvsdbBridgeAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Map, ControllerEntry> controllers, final Map, OvsdbBridgeAugmentation> bridges) { LOG.info("Register ODL controllers : {} bridges detail : {}", @@ -94,6 +97,5 @@ public class ControllerUpdateCommand implements TransactCommand { } } LOG.trace("Executed transaction: {}", transaction.build()); - } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommand.java index 1c22c33d6..996b936d2 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommand.java @@ -7,21 +7,23 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Collections; import java.util.List; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.operations.Insert; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -public class OpenVSwitchBridgeAddCommand implements TransactCommand { +public class OpenVSwitchBridgeAddCommand extends AbstractTransactCommand { + public OpenVSwitchBridgeAddCommand(final Operations op) { + super(op); + } @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, @@ -36,7 +38,7 @@ public class OpenVSwitchBridgeAddCommand implements TransactCommand { execute(transaction); } - private static void execute(final TransactionBuilder transaction) { + private void execute(final TransactionBuilder transaction) { Bridge bridge = transaction.getTypedRowWrapper(Bridge.class); List inserts = TransactUtils.extractInsert(transaction, bridge.getSchema()); for (Insert insert : inserts) { diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommand.java index e47c3e715..10985ce5a 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Collection; import java.util.Collections; @@ -17,6 +15,7 @@ import java.util.Map.Entry; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.operations.Mutate; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.GenericTableSchema; import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch; @@ -31,9 +30,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class OvsdbNodeUpdateCommand implements TransactCommand { +public class OvsdbNodeUpdateCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(OvsdbNodeUpdateCommand.class); + public OvsdbNodeUpdateCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -50,7 +53,7 @@ public class OvsdbNodeUpdateCommand implements TransactCommand { } @SuppressFBWarnings("DCN_NULLPOINTER_EXCEPTION") - private static void execute(final TransactionBuilder transaction, + private void execute(final TransactionBuilder transaction, final Map, OvsdbNodeAugmentation> updated, final InstanceIdentifierCodec instanceIdentifierCodec) { for (Entry, OvsdbNodeAugmentation> ovsdbNodeEntry: @@ -82,8 +85,6 @@ public class OvsdbNodeUpdateCommand implements TransactCommand { LOG.warn("Incomplete OVSDB Node external IDs", e); } - - Map otherConfigs = ovsdbNode.getOpenvswitchOtherConfigs(); if (otherConfigs != null) { @@ -100,11 +101,11 @@ public class OvsdbNodeUpdateCommand implements TransactCommand { } } - private static void stampInstanceIdentifier(final TransactionBuilder transaction, - final InstanceIdentifier iid, final InstanceIdentifierCodec instanceIdentifierCodec) { + private void stampInstanceIdentifier(final TransactionBuilder transaction, final InstanceIdentifier iid, + final InstanceIdentifierCodec instanceIdentifierCodec) { OpenVSwitch ovs = transaction.getTypedRowWrapper(OpenVSwitch.class); ovs.setExternalIds(Collections.emptyMap()); - TransactUtils.stampInstanceIdentifier(transaction, iid, ovs.getSchema(), + TransactUtils.stampInstanceIdentifier(op, transaction, iid, ovs.getSchema(), ovs.getExternalIdsColumn().getSchema(), instanceIdentifierCodec); } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolRemovedCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolRemovedCommand.java index 946af1b45..90c6c56d0 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolRemovedCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolRemovedCommand.java @@ -7,7 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog; import java.util.Collection; @@ -18,6 +17,7 @@ import java.util.Set; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException; import org.opendaylight.ovsdb.lib.notation.Mutator; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; @@ -29,10 +29,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ProtocolRemovedCommand implements TransactCommand { - +public class ProtocolRemovedCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(ProtocolRemovedCommand.class); + public ProtocolRemovedCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -48,8 +51,8 @@ public class ProtocolRemovedCommand implements TransactCommand { TransactUtils.extractCreatedOrUpdatedOrRemoved(modifications, OvsdbBridgeAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, - final Set> removed, + private void execute(final TransactionBuilder transaction, + final BridgeOperationalState state, final Set> removed, final Map, OvsdbBridgeAugmentation> updatedBridges) { for (InstanceIdentifier protocolIid : removed) { InstanceIdentifier bridgeIid = @@ -76,7 +79,5 @@ public class ProtocolRemovedCommand implements TransactCommand { } } } - } - } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolUpdateCommand.java index 16451e954..b0bf511d7 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolUpdateCommand.java @@ -5,10 +5,8 @@ * 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.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog; import java.util.Collection; @@ -19,6 +17,7 @@ import java.util.Optional; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException; import org.opendaylight.ovsdb.lib.notation.Mutator; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; @@ -30,10 +29,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ProtocolUpdateCommand implements TransactCommand { - +public class ProtocolUpdateCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(ProtocolUpdateCommand.class); + public ProtocolUpdateCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -49,7 +51,7 @@ public class ProtocolUpdateCommand implements TransactCommand { TransactUtils.extractCreatedOrUpdated(modifications, OvsdbBridgeAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Map, ProtocolEntry> protocols, final Map, OvsdbBridgeAugmentation> bridges) { for (Entry, ProtocolEntry> entry: protocols.entrySet()) { diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosRemovedCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosRemovedCommand.java index 1191ee90b..3c9c02d3a 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosRemovedCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosRemovedCommand.java @@ -7,13 +7,12 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Map; import java.util.NoSuchElementException; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Qos; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; @@ -26,9 +25,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class QosRemovedCommand implements TransactCommand { +public class QosRemovedCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(QosRemovedCommand.class); + public QosRemovedCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -46,11 +49,10 @@ public class QosRemovedCommand implements TransactCommand { TransactUtils.extractUpdated(modifications, OvsdbNodeAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Map, OvsdbNodeAugmentation> originals, final Map, OvsdbNodeAugmentation> updated) { - for (Map.Entry, OvsdbNodeAugmentation> originalEntry : originals - .entrySet()) { + for (var originalEntry : originals.entrySet()) { InstanceIdentifier ovsdbNodeIid = originalEntry.getKey(); OvsdbNodeAugmentation original = originalEntry.getValue(); OvsdbNodeAugmentation update = updated.get(ovsdbNodeIid); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java index bd4ffadbf..a9b4bda13 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java @@ -8,7 +8,6 @@ package org.opendaylight.ovsdb.southbound.ovsdb.transact; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Collection; @@ -17,6 +16,7 @@ import java.util.Map; import java.util.Map.Entry; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Qos; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; @@ -39,9 +39,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class QosUpdateCommand implements TransactCommand { +public class QosUpdateCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(QosUpdateCommand.class); + public QosUpdateCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -58,7 +62,7 @@ public class QosUpdateCommand implements TransactCommand { } @SuppressFBWarnings("DCN_NULLPOINTER_EXCEPTION") - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Map, QosEntries> createdOrUpdated, final InstanceIdentifierCodec instanceIdentifierCodec) { for (Entry, QosEntries> qosMapEntry: createdOrUpdated.entrySet()) { diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueRemovedCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueRemovedCommand.java index 2cee3c1d2..c80ae6702 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueRemovedCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueRemovedCommand.java @@ -7,12 +7,11 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Map; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Queue; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; @@ -25,9 +24,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class QueueRemovedCommand implements TransactCommand { +public class QueueRemovedCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(QueueRemovedCommand.class); + public QueueRemovedCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -43,9 +46,9 @@ public class QueueRemovedCommand implements TransactCommand { TransactUtils.extractUpdated(modifications, OvsdbNodeAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, - final Map, OvsdbNodeAugmentation> originals, - final Map, OvsdbNodeAugmentation> updated) { + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + final Map, OvsdbNodeAugmentation> originals, + final Map, OvsdbNodeAugmentation> updated) { for (Map.Entry, OvsdbNodeAugmentation> originalEntry : originals .entrySet()) { InstanceIdentifier ovsdbNodeIid = originalEntry.getKey(); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueUpdateCommand.java index 5f7218fb1..bb06206e9 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueUpdateCommand.java @@ -8,7 +8,6 @@ package org.opendaylight.ovsdb.southbound.ovsdb.transact; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Collection; @@ -19,6 +18,7 @@ import java.util.Map.Entry; import java.util.Set; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Queue; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; @@ -36,9 +36,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class QueueUpdateCommand implements TransactCommand { +public class QueueUpdateCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(QueueUpdateCommand.class); + public QueueUpdateCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -55,7 +59,7 @@ public class QueueUpdateCommand implements TransactCommand { } @SuppressFBWarnings("DCN_NULLPOINTER_EXCEPTION") - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Map, Queues> createdOrUpdated, final InstanceIdentifierCodec instanceIdentifierCodec) { for (Entry, Queues> queueMapEntry : createdOrUpdated.entrySet()) { diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommand.java index 66d43b76c..061573e96 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommand.java @@ -7,7 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -17,7 +16,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Optional; import java.util.Set; import org.opendaylight.mdsal.binding.api.DataTreeModification; @@ -25,6 +23,7 @@ import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.notation.UUID; import org.opendaylight.ovsdb.lib.operations.Mutate; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; import org.opendaylight.ovsdb.schema.openvswitch.Interface; @@ -59,9 +58,13 @@ import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class TerminationPointCreateCommand implements TransactCommand { +public class TerminationPointCreateCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(TerminationPointCreateCommand.class); + public TerminationPointCreateCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -78,12 +81,11 @@ public class TerminationPointCreateCommand implements TransactCommand { TransactUtils.extractCreatedOrUpdated(modifications, Node.class), instanceIdentifierCodec); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Map, OvsdbTerminationPointAugmentation> createdTerminationPoints, final Map, Node> nodes, final InstanceIdentifierCodec instanceIdentifierCodec) { - for (Entry, OvsdbTerminationPointAugmentation> entry : - createdTerminationPoints.entrySet()) { + for (var entry : createdTerminationPoints.entrySet()) { OvsdbTerminationPointAugmentation terminationPoint = entry.getValue(); LOG.debug("Received request to create termination point {}", terminationPoint.getName()); @@ -97,7 +99,8 @@ public class TerminationPointCreateCommand implements TransactCommand { createInterface(terminationPoint, ovsInterface); transaction.add(op.insert(ovsInterface).withId(interfaceUuid)); - stampInstanceIdentifier(transaction, entry.getKey(), ovsInterface.getName(), instanceIdentifierCodec); + stampInstanceIdentifier(op, transaction, entry.getKey(), ovsInterface.getName(), + instanceIdentifierCodec); // Configure port with the above interface details String portUuid = "Port_" + SouthboundMapper.getRandomUuid(); @@ -365,13 +368,13 @@ public class TerminationPointCreateCommand implements TransactCommand { } } - public static void stampInstanceIdentifier(final TransactionBuilder transaction, + public static void stampInstanceIdentifier(final Operations op, final TransactionBuilder transaction, final InstanceIdentifier iid, final String interfaceName, final InstanceIdentifierCodec instanceIdentifierCodec) { Port port = transaction.getTypedRowWrapper(Port.class); port.setName(interfaceName); port.setExternalIds(Collections.emptyMap()); - Mutate mutate = TransactUtils.stampInstanceIdentifierMutation(transaction, iid, port.getSchema(), + Mutate mutate = TransactUtils.stampInstanceIdentifierMutation(op, transaction, iid, port.getSchema(), port.getExternalIdsColumn().getSchema(), instanceIdentifierCodec); transaction.add(mutate .where(port.getNameColumn().getSchema().opEqual(interfaceName)) diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointDeleteCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointDeleteCommand.java index 71e84853b..3464e55c9 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointDeleteCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointDeleteCommand.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -17,6 +15,7 @@ import java.util.Set; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Bridge; import org.opendaylight.ovsdb.schema.openvswitch.Port; @@ -33,9 +32,13 @@ import org.slf4j.LoggerFactory; * * @author avishnoi@brocade.com (Anil Vishnoi) */ -public class TerminationPointDeleteCommand implements TransactCommand { +public class TerminationPointDeleteCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(TerminationPointDeleteCommand.class); + public TerminationPointDeleteCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -54,7 +57,7 @@ public class TerminationPointDeleteCommand implements TransactCommand { TransactUtils.extractRemoved(modifications, OvsdbTerminationPointAugmentation.class)); } - private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state, + private void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final Map, OvsdbTerminationPointAugmentation> originals, final Map, Node> originalNodes, diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java index a90c5cea6..1404ffcf0 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java @@ -8,9 +8,9 @@ package org.opendaylight.ovsdb.southbound.ovsdb.transact; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; import static org.opendaylight.ovsdb.southbound.SouthboundUtil.schemaMismatchLog; +import com.google.common.annotations.VisibleForTesting; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Collection; import java.util.Collections; @@ -25,6 +25,7 @@ import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.mdsal.binding.api.ReadTransaction; import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.schema.openvswitch.Interface; import org.opendaylight.ovsdb.schema.openvswitch.Port; @@ -60,9 +61,13 @@ import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class TerminationPointUpdateCommand implements TransactCommand { +public class TerminationPointUpdateCommand extends AbstractTransactCommand { private static final Logger LOG = LoggerFactory.getLogger(TerminationPointUpdateCommand.class); + public TerminationPointUpdateCommand(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { @@ -91,6 +96,7 @@ public class TerminationPointUpdateCommand implements TransactCommand { } } + @VisibleForTesting public void updateTerminationPoint(final TransactionBuilder transaction, final BridgeOperationalState state, final InstanceIdentifier iid, final OvsdbTerminationPointAugmentation terminationPoint, @@ -109,7 +115,7 @@ public class TerminationPointUpdateCommand implements TransactCommand { .where(extraInterface.getNameColumn().getSchema().opEqual(terminationPoint.getName())) .build()); - TerminationPointCreateCommand.stampInstanceIdentifier(transaction, + TerminationPointCreateCommand.stampInstanceIdentifier(op, transaction, iid.firstIdentifierOf(OvsdbTerminationPointAugmentation.class), terminationPoint.getName(), instanceIdentifierCodec); final String opendaylightIid = instanceIdentifierCodec.serialize(iid); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactCommandAggregator.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactCommandAggregator.java index 5334e3054..11e572ddd 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactCommandAggregator.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactCommandAggregator.java @@ -8,8 +8,9 @@ package org.opendaylight.ovsdb.southbound.ovsdb.transact; import java.util.Collection; -import java.util.function.Supplier; +import java.util.function.Function; import org.opendaylight.mdsal.binding.api.DataTreeModification; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; @@ -17,9 +18,9 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. /** * This transactional command aggregates all the Southbound commands. */ -public class TransactCommandAggregator implements TransactCommand { +public class TransactCommandAggregator extends AbstractTransactCommand { // Type capture to allow using an array - private interface CommandSupplier extends Supplier { + private interface CommandSupplier extends Function { } @@ -43,11 +44,15 @@ public class TransactCommandAggregator implements TransactCommand { TerminationPointUpdateCommand::new }; + public TransactCommandAggregator(final Operations op) { + super(op); + } + @Override public void execute(final TransactionBuilder transaction, final BridgeOperationalState state, final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) { for (CommandSupplier supplier : COMMAND_SUPPLIERS) { - supplier.get().execute(transaction, state, events, instanceIdentifierCodec); + supplier.apply(op).execute(transaction, state, events, instanceIdentifierCodec); } } @@ -56,7 +61,7 @@ public class TransactCommandAggregator implements TransactCommand { final Collection> modifications, final InstanceIdentifierCodec instanceIdentifierCodec) { for (CommandSupplier supplier : COMMAND_SUPPLIERS) { - supplier.get().execute(transaction, state, modifications, instanceIdentifierCodec); + supplier.apply(op).execute(transaction, state, modifications, instanceIdentifierCodec); } } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtils.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtils.java index adbb9b4db..bcae24f22 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtils.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtils.java @@ -7,8 +7,6 @@ */ package org.opendaylight.ovsdb.southbound.ovsdb.transact; -import static org.opendaylight.ovsdb.lib.operations.Operations.op; - import com.google.common.base.Predicates; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; @@ -33,6 +31,7 @@ import org.opendaylight.ovsdb.lib.notation.UUID; import org.opendaylight.ovsdb.lib.operations.Insert; import org.opendaylight.ovsdb.lib.operations.Mutate; import org.opendaylight.ovsdb.lib.operations.Operation; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.ColumnSchema; import org.opendaylight.ovsdb.lib.schema.GenericTableSchema; @@ -424,15 +423,15 @@ public class TransactUtils { return new UUID(uuidString); } - public static > void stampInstanceIdentifier(final TransactionBuilder transaction, - final InstanceIdentifier iid, final TableSchema tableSchema, + public static > void stampInstanceIdentifier(final Operations op, + final TransactionBuilder transaction, final InstanceIdentifier iid, final TableSchema tableSchema, final ColumnSchema> columnSchema, final InstanceIdentifierCodec instanceIdentifierCodec) { transaction.add( - stampInstanceIdentifierMutation(transaction, iid, tableSchema, columnSchema, instanceIdentifierCodec)); + stampInstanceIdentifierMutation(op, transaction, iid, tableSchema, columnSchema, instanceIdentifierCodec)); } - public static > Mutate stampInstanceIdentifierMutation( + public static > Mutate stampInstanceIdentifierMutation(final Operations op, final TransactionBuilder transaction, final InstanceIdentifier iid, final TableSchema tableSchema, final ColumnSchema> columnSchema, final InstanceIdentifierCodec instanceIdentifierCodec) { diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTask.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTask.java index 1499b2814..1fe801467 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTask.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTask.java @@ -266,7 +266,7 @@ public class BridgeConfigReconciliationTask extends ReconciliationTask { } }; - connectionInstance.transact(new TransactCommandAggregator(), + connectionInstance.transact(new TransactCommandAggregator(connectionInstance.ops()), new BridgeOperationalState(reconciliationManager.getDb(), changeEvents), new DataChangesManagedByOvsdbNodeEvent( reconciliationManager.getDb(), diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/TerminationPointConfigReconciliationTask.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/TerminationPointConfigReconciliationTask.java index 2fc3c8c82..6596065e6 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/TerminationPointConfigReconciliationTask.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/TerminationPointConfigReconciliationTask.java @@ -91,7 +91,7 @@ public class TerminationPointConfigReconciliationTask extends ReconciliationTask } }; - connectionInstance.transact(new TerminationPointCreateCommand(), + connectionInstance.transact(new TerminationPointCreateCommand(connectionInstance.ops()), new BridgeOperationalState(reconciliationManager.getDb(), changeEvents), changeEvents, instanceIdentifierCodec); @@ -158,7 +158,7 @@ public class TerminationPointConfigReconciliationTask extends ReconciliationTask } }; - connectionInstance.transact(new TerminationPointDeleteCommand(), + connectionInstance.transact(new TerminationPointDeleteCommand(connectionInstance.ops()), new BridgeOperationalState(reconciliationManager.getDb(), deleteChangeEvents), deleteChangeEvents, instanceIdentifierCodec); @@ -166,7 +166,7 @@ public class TerminationPointConfigReconciliationTask extends ReconciliationTask } @Override - public void doRetry(boolean wasPreviousAttemptSuccessful) { + public void doRetry(final boolean wasPreviousAttemptSuccessful) { } @Override diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstanceTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstanceTest.java index 4f6efe141..964c60d16 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstanceTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstanceTest.java @@ -40,6 +40,7 @@ import org.opendaylight.ovsdb.lib.MonitorHandle; import org.opendaylight.ovsdb.lib.OvsdbClient; import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo; import org.opendaylight.ovsdb.lib.message.TableUpdates; +import org.opendaylight.ovsdb.lib.operations.DefaultOperations; import org.opendaylight.ovsdb.lib.operations.OperationResult; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.DatabaseSchema; @@ -77,7 +78,8 @@ public class OvsdbConnectionInstanceTest { @Before public void setUp() throws Exception { - ovsdbConnectionInstance = spy(new OvsdbConnectionInstance(key, client, txInvoker, instanceIdentifier)); + ovsdbConnectionInstance = spy(new OvsdbConnectionInstance(key, client, new DefaultOperations(), txInvoker, + instanceIdentifier)); } @Test diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManagerTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManagerTest.java index 13b419401..a9f06e8b9 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManagerTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManagerTest.java @@ -41,6 +41,8 @@ import org.opendaylight.ovsdb.lib.OvsdbClient; import org.opendaylight.ovsdb.lib.OvsdbConnection; import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo; import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService; +import org.opendaylight.ovsdb.lib.operations.DefaultOperations; +import org.opendaylight.ovsdb.lib.operations.Operations; import org.opendaylight.ovsdb.southbound.reconciliation.ReconciliationManager; import org.opendaylight.ovsdb.southbound.transactions.md.TransactionCommand; import org.opendaylight.ovsdb.southbound.transactions.md.TransactionInvoker; @@ -95,12 +97,13 @@ public class OvsdbConnectionManagerTest { field(OvsdbConnectionManager.class, "reconciliationManager").set(ovsdbConnManager, reconciliationManager); field(OvsdbConnectionManager.class, "ovsdbConnection").set(ovsdbConnManager, ovsdbConnection); field(OvsdbConnectionManager.class, "alreadyProcessedClients").set(ovsdbConnManager, new ConcurrentHashMap<>()); + field(OvsdbConnectionManager.class, "ops").set(ovsdbConnManager, new DefaultOperations()); entityConnectionMap = new ConcurrentHashMap<>(); OvsdbConnectionInfo info = mock(OvsdbConnectionInfo.class); - doReturn(mock(InetAddress.class)).when(info).getRemoteAddress(); + doReturn(InetAddress.getByAddress(new byte[] { 1, 2, 3, 4})).when(info).getRemoteAddress(); doReturn(8080).when(info).getRemotePort(); - doReturn(mock(InetAddress.class)).when(info).getLocalAddress(); + doReturn(InetAddress.getByAddress(new byte[] { 5, 6, 7, 8})).when(info).getLocalAddress(); doReturn(8080).when(info).getLocalPort(); externalClient = mock(OvsdbClient.class, Mockito.RETURNS_DEEP_STUBS); @@ -162,7 +165,7 @@ public class OvsdbConnectionManagerTest { OvsdbConnectionInstance.class)); doNothing().when(client).createTransactInvokers(); PowerMockito.whenNew(OvsdbConnectionInstance.class).withArguments(any(ConnectionInfo.class), - any(OvsdbClient.class), any(TransactionInvoker.class), any(InstanceIdentifier.class)) + any(OvsdbClient.class), any(Operations.class), any(TransactionInvoker.class), any(InstanceIdentifier.class)) .thenReturn(client); assertEquals("Error, did not receive correct OvsdbConnectionInstance object", client, @@ -350,7 +353,7 @@ public class OvsdbConnectionManagerTest { when(connectionInfo.getRemoteIp()).thenReturn(ipAddr); PowerMockito.mockStatic(SouthboundMapper.class); - InetAddress ip = mock(InetAddress.class); + InetAddress ip = InetAddress.getByAddress(new byte[] { 1, 2, 3, 4 }); when(SouthboundMapper.createInetAddress(any(IpAddress.class))).thenReturn(ip); PowerMockito.mockStatic(OvsdbConnectionService.class); @@ -394,7 +397,8 @@ public class OvsdbConnectionManagerTest { Entity entity = new Entity("entityType", "entityName"); ConnectionInfo key = mock(ConnectionInfo.class); - OvsdbConnectionInstance ovsdbConnInstance = new OvsdbConnectionInstance(key, externalClient, txInvoker, iid); + OvsdbConnectionInstance ovsdbConnInstance = new OvsdbConnectionInstance(key, externalClient, + new DefaultOperations(), txInvoker, iid); entityConnectionMap.put(entity, ovsdbConnInstance); field(OvsdbConnectionManager.class, "entityConnectionMap").set(ovsdbConnManager, entityConnectionMap); diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListenerTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListenerTest.java index 4b9827679..4671edc43 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListenerTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListenerTest.java @@ -22,6 +22,7 @@ import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBro import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService; import org.opendaylight.ovsdb.lib.OvsdbConnection; +import org.opendaylight.ovsdb.lib.operations.DefaultOperations; import org.opendaylight.ovsdb.southbound.transactions.md.TransactionInvokerImpl; import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; @@ -51,8 +52,9 @@ public class OvsdbDataTreeChangeListenerTest extends AbstractConcurrentDataBroke EntityOwnershipService entityOwnershipService = mock(EntityOwnershipService.class); InstanceIdentifierCodec instanceIdentifierCodec = mock(InstanceIdentifierCodec.class); listener = new OvsdbDataTreeChangeListener(dataBroker, - new OvsdbConnectionManager(dataBroker, new TransactionInvokerImpl(dataBroker), entityOwnershipService, - ovsdbConnection, instanceIdentifierCodec, List.of(), List.of()), instanceIdentifierCodec); + new OvsdbConnectionManager(dataBroker, new DefaultOperations(), new TransactionInvokerImpl(dataBroker), + entityOwnershipService, ovsdbConnection, instanceIdentifierCodec, List.of(), List.of()), + instanceIdentifierCodec); } @Test diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java index db73da98b..5ec9ba117 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java @@ -39,6 +39,7 @@ import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException import org.opendaylight.mdsal.eos.common.api.EntityOwnershipState; import org.opendaylight.mdsal.eos.common.api.EntityOwnershipStateChange; import org.opendaylight.ovsdb.lib.OvsdbConnection; +import org.opendaylight.ovsdb.lib.operations.DefaultOperations; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; @@ -78,7 +79,7 @@ public class SouthboundProviderTest extends AbstractConcurrentDataBrokerTest { Mockito.mock(DOMSchemaService.class), Mockito.mock(BindingNormalizedNodeSerializer.class), new TestSystemReadyMonitor(IMMEDIATE), - diagStatusService)) { + diagStatusService, new DefaultOperations())) { // Verify that at least one listener was registered verify(entityOwnershipService, atLeastOnce()).registerListener( @@ -102,7 +103,7 @@ public class SouthboundProviderTest extends AbstractConcurrentDataBrokerTest { Mockito.mock(DOMSchemaService.class), Mockito.mock(BindingNormalizedNodeSerializer.class), new TestSystemReadyMonitor(IMMEDIATE), - diagStatusService)) { + diagStatusService, new DefaultOperations())) { // Verify that at least one listener was registered verify(entityOwnershipService, atLeastOnce()).registerListener( @@ -132,7 +133,7 @@ public class SouthboundProviderTest extends AbstractConcurrentDataBrokerTest { Mockito.mock(DOMSchemaService.class), Mockito.mock(BindingNormalizedNodeSerializer.class), new TestSystemReadyMonitor(IMMEDIATE), - diagStatusService)) { + diagStatusService, new DefaultOperations())) { // At this point the OVSDB topology must not be present in either tree assertFalse(getDataBroker().newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java index cdafe6df9..3ab933726 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java @@ -5,8 +5,8 @@ * 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.ovsdb.southbound; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; @@ -118,19 +118,14 @@ public class SouthboundUtilTest { when(NetworkInterface.getNetworkInterfaces()).thenReturn(null); assertNull(SouthboundUtil.getLocalControllerHostIpAddress()); - InetAddress inetAddr = mock(InetAddress.class); - when(inetAddr.isLoopbackAddress()).thenReturn(false); - when(inetAddr.isSiteLocalAddress()).thenReturn(true); - when(inetAddr.getHostAddress()).thenReturn("HostAddress"); - NetworkInterface iface = PowerMockito.mock(NetworkInterface.class); when(iface.getInetAddresses()).thenReturn(Iterators.asEnumeration( - Iterators.singletonIterator(inetAddr))); + Iterators.singletonIterator(InetAddress.getByAddress("HostAddress", new byte[] { 10, 0, 0, 1 })))); when(NetworkInterface.getNetworkInterfaces()).thenReturn(Iterators.asEnumeration( Iterators.singletonIterator(iface))); - assertEquals("HostAddress", SouthboundUtil.getLocalControllerHostIpAddress()); + assertEquals("10.0.0.1", SouthboundUtil.getLocalControllerHostIpAddress()); } @Test diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommandTest.java index f4691b670..df02bf986 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommandTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommandTest.java @@ -11,6 +11,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -21,7 +22,6 @@ import java.util.Set; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Mockito; import org.opendaylight.ovsdb.lib.notation.Column; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.notation.UUID; @@ -43,10 +43,12 @@ import org.powermock.modules.junit4.PowerMockRunner; @PrepareForTest({TransactUtils.class, Operations.class}) public class OpenVSwitchBridgeAddCommandTest { private OpenVSwitchBridgeAddCommand ovsBridgeAddCommand; + private Operations op; @Before public void setUp() { - ovsBridgeAddCommand = mock(OpenVSwitchBridgeAddCommand.class, Mockito.CALLS_REAL_METHODS); + op = mock(Operations.class); + ovsBridgeAddCommand = spy(new OpenVSwitchBridgeAddCommand(op)); } @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -74,7 +76,6 @@ public class OpenVSwitchBridgeAddCommandTest { doNothing().when(ovs).setBridges(any(Set.class)); Mutate mutate = mock(Mutate.class); - Operations op = OvsdbNodeUpdateCommandTest.setOpField(); when(op.mutate(any(OpenVSwitch.class))).thenReturn(mutate); Column> column = mock(Column.class); when(ovs.getBridgesColumn()).thenReturn(column); diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommandTest.java index e6989f10f..66309e316 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommandTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommandTest.java @@ -11,19 +11,18 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableMap; -import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.Mockito; import org.opendaylight.ovsdb.lib.notation.Column; import org.opendaylight.ovsdb.lib.operations.Mutate; import org.opendaylight.ovsdb.lib.operations.Operation; @@ -63,11 +62,12 @@ public class OvsdbNodeUpdateCommandTest { private static final String OTHER_CONFIG_VALUE = "other config value"; @Mock private DataChangeEvent changes; + @Mock private Operations op; private OvsdbNodeUpdateCommand ovsdbNodeUpdateCommand; @Before public void setUp() { - ovsdbNodeUpdateCommand = mock(OvsdbNodeUpdateCommand.class, Mockito.CALLS_REAL_METHODS); + ovsdbNodeUpdateCommand = spy(new OvsdbNodeUpdateCommand(op)); } @SuppressWarnings("unchecked") @@ -106,7 +106,6 @@ public class OvsdbNodeUpdateCommandTest { doNothing().when(ovs).setExternalIds(any(ImmutableMap.class)); Mutate mutate = mock(Mutate.class); - Operations op = setOpField(); Column> column = mock(Column.class); when(ovs.getExternalIdsColumn()).thenReturn(column); when(column.getSchema()).thenReturn(mock(ColumnSchema.class)); @@ -128,11 +127,4 @@ public class OvsdbNodeUpdateCommandTest { verify(ovs, times(2)).getExternalIdsColumn(); verify(transaction, times(2)).add(eq(null)); } - - static Operations setOpField() throws Exception { - Field opField = PowerMockito.field(Operations.class, "op"); - Operations mockOp = mock(Operations.class); - opField.set(Operations.class, mockOp); - return mockOp; - } } diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommandTest.java index aac1dc3f4..4d42d438e 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommandTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommandTest.java @@ -28,6 +28,7 @@ import org.mockito.Mockito; import org.opendaylight.ovsdb.lib.notation.Column; import org.opendaylight.ovsdb.lib.notation.Condition; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.DefaultOperations; import org.opendaylight.ovsdb.lib.operations.Insert; import org.opendaylight.ovsdb.lib.operations.Mutate; import org.opendaylight.ovsdb.lib.operations.Operation; @@ -132,10 +133,11 @@ public class TerminationPointCreateCommandTest { when(column.getSchema()).thenReturn(mock(ColumnSchema.class)); Mutate mutate = mock(Mutate.class); + // FIXME: rather than static mocking, insert a mock Operations PowerMockito.mockStatic(TransactUtils.class); - when(TransactUtils.stampInstanceIdentifierMutation(any(TransactionBuilder.class), any(InstanceIdentifier.class), - any(GenericTableSchema.class), any(ColumnSchema.class), any(InstanceIdentifierCodec.class))).thenReturn( - mutate); + when(TransactUtils.stampInstanceIdentifierMutation(any(Operations.class), any(TransactionBuilder.class), + any(InstanceIdentifier.class), any(GenericTableSchema.class), any(ColumnSchema.class), + any(InstanceIdentifierCodec.class))).thenReturn(mutate); Column nameColumn = mock(Column.class); when(port.getNameColumn()).thenReturn(nameColumn); @@ -153,7 +155,7 @@ public class TerminationPointCreateCommandTest { .child(Node.class, new NodeKey(new NodeId("testNode"))) .child(TerminationPoint.class, new TerminationPointKey(new TpId("testTp"))) .augmentation(OvsdbTerminationPointAugmentation.class); - TerminationPointCreateCommand.stampInstanceIdentifier(transaction, iid, interfaceName, + TerminationPointCreateCommand.stampInstanceIdentifier(new DefaultOperations(), transaction, iid, interfaceName, mock(InstanceIdentifierCodec.class)); verify(port).setName(anyString()); verify(port).getExternalIdsColumn(); diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommandTest.java index de0918e51..687759404 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommandTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommandTest.java @@ -12,6 +12,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -22,7 +23,6 @@ import java.util.Optional; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Mockito; import org.opendaylight.ovsdb.lib.notation.Column; import org.opendaylight.ovsdb.lib.notation.Condition; import org.opendaylight.ovsdb.lib.operations.Operation; @@ -61,13 +61,15 @@ import org.powermock.modules.junit4.PowerMockRunner; Operations.class }) public class TerminationPointUpdateCommandTest { - private static final String TERMINATION_POINT_NAME = "termination point name"; + + private Operations op; private TerminationPointUpdateCommand terminationPointUpdateCommand; @Before public void setUp() { - terminationPointUpdateCommand = mock(TerminationPointUpdateCommand.class, Mockito.CALLS_REAL_METHODS); + op = mock(Operations.class); + terminationPointUpdateCommand = spy(new TerminationPointUpdateCommand(op)); } @SuppressWarnings("unchecked") @@ -126,7 +128,6 @@ public class TerminationPointUpdateCommandTest { when(transaction.getTypedRowWrapper(eq(Interface.class))).thenReturn(extraInterface); doNothing().when(extraInterface).setName(anyString()); - Operations op = OvsdbNodeUpdateCommandTest.setOpField(); Update update = mock(Update.class); when(op.update(any(Interface.class))).thenReturn(update); diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactCommandAggregatorTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactCommandAggregatorTest.java index e6e1d37a2..6c3962b0a 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactCommandAggregatorTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactCommandAggregatorTest.java @@ -20,6 +20,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.opendaylight.ovsdb.lib.operations.DefaultOperations; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; @@ -33,7 +34,7 @@ public class TransactCommandAggregatorTest { @Before public void setUp() throws Exception { - transactCommandAggregator = new TransactCommandAggregator(); + transactCommandAggregator = new TransactCommandAggregator(new DefaultOperations()); //mock commands field commands.add(mock(BridgeUpdateCommand.class)); diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtilsTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtilsTest.java index 6e9778cec..ef9fe638e 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtilsTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtilsTest.java @@ -18,7 +18,6 @@ import static org.mockito.Mockito.when; import com.google.common.base.Predicates; import com.google.common.collect.Maps; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -33,6 +32,7 @@ import org.opendaylight.ovsdb.lib.notation.Mutation; import org.opendaylight.ovsdb.lib.notation.Mutator; import org.opendaylight.ovsdb.lib.notation.OvsdbSet; import org.opendaylight.ovsdb.lib.notation.UUID; +import org.opendaylight.ovsdb.lib.operations.DefaultOperations; import org.opendaylight.ovsdb.lib.operations.Insert; import org.opendaylight.ovsdb.lib.operations.Mutate; import org.opendaylight.ovsdb.lib.operations.Operation; @@ -209,13 +209,15 @@ public class TransactUtilsTest { TableSchema tableSchema = mock(TableSchema.class); ColumnSchema> columnSchema = mock(ColumnSchema.class); InstanceIdentifierCodec instanceIdentifierCodec = mock(InstanceIdentifierCodec.class); + Operations ops = new DefaultOperations(); PowerMockito.doReturn(mock(Mutate.class)).when(TransactUtils.class); - TransactUtils.stampInstanceIdentifierMutation(transaction, iid, tableSchema, columnSchema, + TransactUtils.stampInstanceIdentifierMutation(ops, transaction, iid, tableSchema, columnSchema, instanceIdentifierCodec); when(transaction.add(any(Operation.class))).thenReturn(transaction); - TransactUtils.stampInstanceIdentifier(transaction, iid, tableSchema, columnSchema, instanceIdentifierCodec); + TransactUtils.stampInstanceIdentifier(ops, transaction, iid, tableSchema, columnSchema, + instanceIdentifierCodec); verify(transaction).add(any(Operation.class)); } @@ -226,7 +228,7 @@ public class TransactUtilsTest { when(instanceIdentifierCodec.serialize(any(InstanceIdentifier.class))).thenReturn(IID_STRING); Mutate mutate = mock(Mutate.class); - Operations op = (Operations) setField("op"); + Operations op = mock(Operations.class); Mockito.>when(op.mutate(any(TableSchema.class))).thenReturn(mutate); when(mutate.addMutation(any(ColumnSchema.class), any(Mutator.class), any(Map.class))).thenReturn(mutate); @@ -244,14 +246,7 @@ public class TransactUtilsTest { InstanceIdentifier iid = InstanceIdentifier.create(NetworkTopology.class); TransactionBuilder transaction = mock(TransactionBuilder.class); TableSchema tableSchema = mock(TableSchema.class); - assertEquals(mutate, TransactUtils.stampInstanceIdentifierMutation(transaction, iid, tableSchema, columnSchema, - instanceIdentifierCodec)); - } - - private static Object setField(final String fieldName) throws Exception { - Field field = Operations.class.getDeclaredField(fieldName); - field.setAccessible(true); - field.set(field.get(Operations.class), mock(Operations.class)); - return field.get(Operations.class); + assertEquals(mutate, TransactUtils.stampInstanceIdentifierMutation(op, transaction, iid, tableSchema, + columnSchema, instanceIdentifierCodec)); } } -- 2.43.0 From a73602b6df02146d37529f241746f3c9b9d6732b Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 30 Jul 2024 19:09:01 +0200 Subject: [PATCH 4/5] WIP: Bump upstreams for 2024.09 Scandium Adopt: - odlparent-14.0.2 - infrautils-7.0.2 - yangtools-14.0.2 - mdsal-14.0.1 - controller-10.0.1 - aaa-0.20.0 - netconf-8.0.0-SNAPSHOT This also migrates use of KeyAware to EntryObject, as that is more precise intent. // FIXME: SouthboundMapperTest.testCreateInstanceIdentifier1 // FIXME: SouthboundMapperTest.testCreateInstanceIdentifier2 // FIXME: ProtocolRemovedCommandTest // FIXME: OvsdbBridgeRemovedCommandTest // FIXME: OvsdbBridgeUpdateCommandTest.testBuildConnectionNode // FIXME: OvsdbManagersUpdateCommandTest // FIXME: OvsdbPortUpdateCommandTest.testUpdateTerminationPoints Change-Id: If63249920574aebe41c9a3066a0b1100c8f4dc30 Signed-off-by: Robert Varga --- commons/binding-parent/pom.xml | 6 +- commons/it/pom.xml | 4 +- commons/pom.xml | 2 +- .../hwvtepsouthbound-artifacts/pom.xml | 2 +- .../features/pom.xml | 2 +- .../odl-ovsdb-hwvtepsouthbound-api/pom.xml | 4 +- .../src/main/feature/feature.xml | 4 +- .../odl-ovsdb-hwvtepsouthbound-rest/pom.xml | 4 +- .../src/main/feature/feature.xml | 2 +- .../odl-ovsdb-hwvtepsouthbound-test/pom.xml | 2 +- .../odl-ovsdb-hwvtepsouthbound-ui/pom.xml | 4 +- .../src/main/feature/feature.xml | 2 +- .../odl-ovsdb-hwvtepsouthbound/pom.xml | 2 +- .../hwvtepsouthbound-features/pom.xml | 2 +- .../hwvtepsouthbound-impl/pom.xml | 8 +- .../hwvtepsouthbound/HwvtepDeviceInfo.java | 75 +++++++++++-------- .../HwvtepSouthboundMapper.java | 4 +- .../HwvtepSouthboundProvider.java | 2 +- .../HwvtepSouthboundUtil.java | 34 ++++----- .../hwvtepsouthbound/HwvtepTableReader.java | 21 +++--- .../InstanceIdentifierCodec.java | 8 +- .../cli/HwvtepCacheDisplayCmd.java | 25 ++++--- .../reconciliation/ReconciliationTask.java | 2 +- .../DataObjectModificationImpl.java | 22 +++--- .../DataTreeModificationImpl.java | 16 ++-- .../GlobalConfigOperationalChangeGetter.java | 19 +++-- .../ConnectionReconciliationTask.java | 2 +- .../transact/AbstractTransactCommand.java | 71 ++++++++++-------- .../transact/DependentJob.java | 19 +++-- .../transact/EmptyDependencyGetter.java | 6 +- .../transact/HwvtepOperationalState.java | 45 +++++------ .../transact/LogicalRouterUpdateCommand.java | 5 +- .../transact/McastMacsLocalRemoveCommand.java | 3 +- .../transact/McastMacsLocalUpdateCommand.java | 3 +- .../McastMacsRemoteUpdateCommand.java | 9 ++- .../transact/MdsalUpdate.java | 4 +- .../transact/PhysicalPortUpdateCommand.java | 6 +- .../transact/PhysicalSwitchUpdateCommand.java | 5 +- .../transact/TransactCommand.java | 4 +- .../transact/TransactCommandAggregator.java | 45 ++++++----- .../transact/TransactUtils.java | 3 +- .../transact/UcastMacsLocalRemoveCommand.java | 3 +- .../transact/UcastMacsLocalUpdateCommand.java | 5 +- .../UcastMacsRemoteRemoveCommand.java | 3 +- .../UcastMacsRemoteUpdateCommand.java | 11 +-- .../transact/UnMetDependencyGetter.java | 34 ++++----- .../md/AbstractTransactionCommand.java | 14 ++-- .../md/HwvtepGlobalRemoveCommand.java | 5 +- .../md/HwvtepLogicalRouterUpdateCommand.java | 6 +- .../md/HwvtepLogicalSwitchUpdateCommand.java | 2 +- .../md/HwvtepMacEntriesRemoveCommand.java | 2 +- .../md/HwvtepManagerUpdateCommand.java | 2 +- .../md/HwvtepMcastMacsLocalUpdateCommand.java | 4 +- .../HwvtepMcastMacsRemoteUpdateCommand.java | 4 +- .../md/HwvtepPhysicalPortUpdateCommand.java | 14 ++-- .../md/HwvtepPhysicalSwitchRemoveCommand.java | 2 +- .../md/HwvtepPhysicalSwitchUpdateCommand.java | 10 ++- .../md/HwvtepTunnelUpdateCommand.java | 6 +- .../md/HwvtepUcastMacsLocalUpdateCommand.java | 6 +- .../HwvtepUcastMacsRemoteUpdateCommand.java | 6 +- .../DataChangeListenerTestBase.java | 2 +- .../HwvtepDataChangeListenerTest.java | 2 +- .../HwvtepOperationalDataChangeListener.java | 8 +- .../ovsdb/hwvtepsouthbound/TestBuilders.java | 6 +- .../transact/DependencyQueueTest.java | 4 +- .../transact/UnMetDependencyGetterTest.java | 4 +- .../it/HwvtepSouthboundIT.java | 2 +- .../hwvtepsouthbound-karaf/pom.xml | 2 +- hwvtepsouthbound/pom.xml | 2 +- library/artifacts/pom.xml | 2 +- library/features/features/pom.xml | 2 +- library/features/odl-ovsdb-library/pom.xml | 4 +- .../src/main/feature/feature.xml | 6 +- library/features/pom.xml | 2 +- library/karaf/pom.xml | 2 +- library/pom.xml | 2 +- pom.xml | 2 +- schemas/pom.xml | 2 +- southbound/pom.xml | 2 +- southbound/southbound-artifacts/pom.xml | 2 +- .../southbound-features/features/pom.xml | 2 +- .../odl-ovsdb-southbound-api/pom.xml | 4 +- .../src/main/feature/feature.xml | 4 +- .../odl-ovsdb-southbound-impl-rest/pom.xml | 4 +- .../src/main/feature/feature.xml | 2 +- .../odl-ovsdb-southbound-impl-ui/pom.xml | 4 +- .../src/main/feature/feature.xml | 2 +- .../odl-ovsdb-southbound-impl/pom.xml | 4 +- .../src/main/feature/feature.xml | 6 +- .../odl-ovsdb-southbound-test/pom.xml | 2 +- southbound/southbound-features/pom.xml | 2 +- southbound/southbound-impl/pom.xml | 8 +- .../southbound/InstanceIdentifierCodec.java | 8 +- .../southbound/OvsdbConnectionManager.java | 5 +- .../OvsdbDataTreeChangeListener.java | 4 +- .../ovsdb/southbound/SouthboundMapper.java | 2 +- .../ovsdb/southbound/SouthboundProvider.java | 2 +- .../ovsdb/southbound/SouthboundUtil.java | 7 +- .../transact/AutoAttachRemovedCommand.java | 13 +++- .../ovsdb/transact/DataChangeEvent.java | 2 +- .../DataChangesManagedByOvsdbNodeEvent.java | 18 +++-- .../ovsdb/transact/QosUpdateCommand.java | 9 ++- .../TerminationPointUpdateCommand.java | 13 +++- .../ovsdb/transact/TransactUtils.java | 12 +-- .../reconciliation/ReconciliationTask.java | 2 +- .../BridgeConfigReconciliationTask.java | 5 +- ...minationPointConfigReconciliationTask.java | 2 +- .../md/OpenVSwitchUpdateCommand.java | 2 +- .../md/OvsdbBridgeRemovedCommand.java | 6 +- .../md/OvsdbBridgeUpdateCommand.java | 10 +-- .../md/OvsdbControllerUpdateCommand.java | 6 +- .../md/OvsdbInitialPortUpdateCommand.java | 2 +- .../md/OvsdbNodeRemoveCommand.java | 5 +- .../md/OvsdbPortUpdateCommand.java | 17 +++-- .../md/OvsdbQosUpdateCommand.java | 4 +- .../md/OvsdbQueueUpdateCommand.java | 2 +- .../InstanceIdentifierCodecTest.java | 2 +- .../southbound/SouthboundMapperTest.java | 2 +- .../southbound/SouthboundProviderTest.java | 2 +- .../ovsdb/southbound/SouthboundUtilTest.java | 10 +-- ...ataChangesManagedByOvsdbNodeEventTest.java | 2 +- .../TerminationPointCreateCommandTest.java | 2 +- .../ovsdb/transact/TransactUtilsTest.java | 2 +- .../BridgeConfigReconciliationTaskTest.java | 6 +- .../md/OvsdbBridgeUpdateCommandTest.java | 11 ++- .../md/OvsdbControllerUpdateCommandTest.java | 8 +- .../md/OvsdbNodeRemoveCommandTest.java | 6 +- .../md/OvsdbPortUpdateCommandTest.java | 2 +- .../ovsdb/southbound/it/SouthboundIT.java | 42 ++++++----- southbound/southbound-karaf/pom.xml | 2 +- .../ovsdb/utils/mdsal/utils/MdsalObject.java | 3 +- .../ovsdb/utils/mdsal/utils/MdsalUtils.java | 2 +- .../utils/mdsal/utils/MdsalUtilsAsync.java | 5 +- .../utils/NotifyingDataChangeListener.java | 2 +- .../utils/mdsal/utils/TransactionHistory.java | 3 +- .../mdsal/utils/MdsalUtilsAsyncTest.java | 2 +- .../utils/mdsal/utils/MdsalUtilsTest.java | 2 +- utils/odl-ovsdb-utils/pom.xml | 4 +- .../src/main/feature/feature.xml | 2 +- utils/pom.xml | 2 +- .../southbound/utils/SouthboundUtils.java | 25 ++++--- utils/yang-utils/pom.xml | 6 +- .../ovsdb/utils/yang/YangUtils.java | 8 +- 143 files changed, 583 insertions(+), 491 deletions(-) diff --git a/commons/binding-parent/pom.xml b/commons/binding-parent/pom.xml index 81ad31b38..9d3c6ab22 100644 --- a/commons/binding-parent/pom.xml +++ b/commons/binding-parent/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.mdsal binding-parent - 13.0.1 + 14.0.1 @@ -25,14 +25,14 @@ org.opendaylight.aaa aaa-artifacts - 0.19.3 + 0.20.0 pom import org.opendaylight.infrautils infrautils-artifacts - 6.0.6 + 7.0.2 pom import diff --git a/commons/it/pom.xml b/commons/it/pom.xml index 5b88c51a3..206402570 100644 --- a/commons/it/pom.xml +++ b/commons/it/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.controller mdsal-it-parent - 9.0.2 + 10.0.1 @@ -70,7 +70,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.mdsal mdsal-artifacts - 13.0.1 + 14.0.1 pom import diff --git a/commons/pom.xml b/commons/pom.xml index cefc5d9d4..992a54fef 100644 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/hwvtepsouthbound/hwvtepsouthbound-artifacts/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-artifacts/pom.xml index bfa90c062..8705fff79 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-artifacts/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-artifacts/pom.xml @@ -13,7 +13,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/features/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/features/pom.xml index 6d6db3c71..09de4666a 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/features/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/features/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent feature-repo-parent - 13.0.11 + 14.0.2 diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/pom.xml index 548f0137c..3fc7ee5cd 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/pom.xml @@ -5,7 +5,7 @@ org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 @@ -22,7 +22,7 @@ org.opendaylight.mdsal mdsal-artifacts - 13.0.1 + 14.0.1 pom import diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/src/main/feature/feature.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/src/main/feature/feature.xml index 5e5f36ebb..ed7cf2026 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/src/main/feature/feature.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/src/main/feature/feature.xml @@ -8,7 +8,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal - odl-mdsal-model-odl-l2-types + odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal + odl-mdsal-model-odl-l2-types diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/pom.xml index f04bc08e8..f1397c740 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 @@ -30,7 +30,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.netconf netconf-artifacts - 7.0.4 + 8.0.0-SNAPSHOT import pom diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/src/main/feature/feature.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/src/main/feature/feature.xml index 21078f61b..035aa966d 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/src/main/feature/feature.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/src/main/feature/feature.xml @@ -8,6 +8,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - odl-restconf + odl-restconf diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-test/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-test/pom.xml index 65d1012e2..213f8b648 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-test/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-test/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-ui/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-ui/pom.xml index d8eed6a0d..aaa6ae6b2 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-ui/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-ui/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 @@ -30,7 +30,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.netconf netconf-artifacts - 7.0.4 + 8.0.0-SNAPSHOT import pom diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-ui/src/main/feature/feature.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-ui/src/main/feature/feature.xml index 12df0c9e8..899944eea 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-ui/src/main/feature/feature.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-ui/src/main/feature/feature.xml @@ -8,6 +8,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - odl-restconf-openapi + odl-restconf-openapi diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound/pom.xml index 9a6e65969..6d1ed8fe3 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/pom.xml index 2be2710bc..01ad5182d 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/pom.xml @@ -11,7 +11,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 org.opendaylight.ovsdb diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml index 91bc02c14..c94031386 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml @@ -24,6 +24,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html ODL :: ovsdb :: ${project.artifactId} + + org.opendaylight.yangtools + binding-data-codec-api + org.opendaylight.yangtools yang-data-util @@ -36,10 +40,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.mdsal mdsal-dom-api - - org.opendaylight.mdsal - mdsal-binding-dom-codec-api - org.opendaylight.mdsal mdsal-eos-binding-api diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDeviceInfo.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDeviceInfo.java index 8b4d691f8..06eb291bf 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDeviceInfo.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDeviceInfo.java @@ -29,8 +29,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.BindingInstanceIdentifier; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,20 +58,20 @@ public class HwvtepDeviceInfo { private static final Logger LOG = LoggerFactory.getLogger(HwvtepDeviceInfo.class); - private Map, Map> availableInOperDs = + private Map>, Map> availableInOperDs = new ConcurrentHashMap<>(); - public void markAvailableInOperDs(Class cls, InstanceIdentifier key) { + public void markAvailableInOperDs(Class> cls, InstanceIdentifier key) { availableInOperDs.putIfAbsent(cls, new ConcurrentHashMap<>()); availableInOperDs.get(cls).put(key, Boolean.TRUE); } - public Boolean isAvailableInOperDs(Class cls, InstanceIdentifier key) { + public Boolean isAvailableInOperDs(Class> cls, InstanceIdentifier key) { availableInOperDs.putIfAbsent(cls, new ConcurrentHashMap<>()); return availableInOperDs.get(cls).getOrDefault(key, Boolean.FALSE); } - public Boolean clearOperDsAvailability(Class cls, InstanceIdentifier key) { + public Boolean clearOperDsAvailability(Class> cls, InstanceIdentifier key) { availableInOperDs.putIfAbsent(cls, new ConcurrentHashMap<>()); return availableInOperDs.get(cls).remove(key); } @@ -139,14 +141,14 @@ public class HwvtepDeviceInfo { logicalSwitchVsMcasts = new ConcurrentHashMap<>(); private final Map physicalSwitches = new ConcurrentHashMap<>(); private final Map mapTunnelToPhysicalSwitch = new ConcurrentHashMap<>(); - private final Map, Map> opKeyVsData = + private final Map>, Map> opKeyVsData = new ConcurrentHashMap<>(); - private final Map, Map> uuidVsData = new ConcurrentHashMap<>(); + private final Map>, Map> uuidVsData = new ConcurrentHashMap<>(); private final HwvtepConnectionInstance connectionInstance; private final DependencyQueue dependencyQueue; private Map iidInQueueCount = new ConcurrentHashMap<>(); - private Map, Map> configKeyVsData = + private Map>, Map> configKeyVsData = new ConcurrentHashMap<>(); private TransactionHistory controllerTxHistory = null; private TransactionHistory deviceUpdateHistory = null; @@ -226,33 +228,33 @@ public class HwvtepDeviceInfo { return mapTunnelToPhysicalSwitch; } - public boolean isKeyInTransit(Class cls, InstanceIdentifier key) { + public boolean isKeyInTransit(Class> cls, InstanceIdentifier key) { DeviceData deviceData = HwvtepSouthboundUtil.getData(opKeyVsData, cls, key); return deviceData != null && DeviceDataStatus.IN_TRANSIT == deviceData.status; } - public boolean isConfigDataAvailable(Class cls, InstanceIdentifier key) { + public boolean isConfigDataAvailable(Class> cls, InstanceIdentifier key) { return HwvtepSouthboundUtil.getData(configKeyVsData, cls, key) != null; } - public void updateConfigData(Class cls, InstanceIdentifier key, Object data) { + public void updateConfigData(Class> cls, InstanceIdentifier key, Object data) { HwvtepSouthboundUtil.updateData(configKeyVsData, cls, key, new DeviceData(key, null, data, DeviceDataStatus.AVAILABLE)); } - public DeviceData getConfigData(Class cls, InstanceIdentifier key) { + public DeviceData getConfigData(Class> cls, InstanceIdentifier key) { return HwvtepSouthboundUtil.getData(configKeyVsData, cls, key); } - public Map, Map> getConfigData() { + public Map>, Map> getConfigData() { return Collections.unmodifiableMap(configKeyVsData); } - public void clearConfigData(Class cls, InstanceIdentifier key) { + public void clearConfigData(Class> cls, InstanceIdentifier key) { HwvtepSouthboundUtil.clearData(configKeyVsData, cls, key); } - public void markKeyAsInTransit(Class cls, InstanceIdentifier key) { + public void markKeyAsInTransit(Class> cls, InstanceIdentifier key) { LOG.debug("Marking device data as intransit {}", key); DeviceData deviceData = getDeviceOperData(cls, key); UUID uuid = null; @@ -266,7 +268,7 @@ public class HwvtepDeviceInfo { new DeviceData(key, uuid, data, DeviceDataStatus.IN_TRANSIT)); } - public void updateDeviceOperData(Class cls, InstanceIdentifier key, + public void updateDeviceOperData(Class> cls, InstanceIdentifier key, UUID uuid, Object data) { LOG.debug("Updating device data {}", key); DeviceData deviceData = new DeviceData(key, uuid, data, DeviceDataStatus.AVAILABLE); @@ -274,7 +276,7 @@ public class HwvtepDeviceInfo { HwvtepSouthboundUtil.updateData(uuidVsData, cls, uuid, deviceData); } - public void clearDeviceOperData(Class cls, InstanceIdentifier key) { + public void clearDeviceOperData(Class> cls, InstanceIdentifier key) { DeviceData deviceData = HwvtepSouthboundUtil.getData(opKeyVsData, cls, key); if (deviceData != null && deviceData.uuid != null) { HwvtepSouthboundUtil.clearData(uuidVsData, cls, deviceData.uuid); @@ -282,7 +284,7 @@ public class HwvtepDeviceInfo { HwvtepSouthboundUtil.clearData(opKeyVsData, cls, key); } - public void clearDeviceOperData(Class cls) { + public void clearDeviceOperData(Class> cls) { Map iids = opKeyVsData.get(cls); if (iids != null && !iids.isEmpty()) { Iterator> it = iids.entrySet().iterator(); @@ -296,7 +298,7 @@ public class HwvtepDeviceInfo { } } - public void clearDeviceOperUUID(Class cls, InstanceIdentifier key, UUID uuid) { + public void clearDeviceOperUUID(Class> cls, InstanceIdentifier key, UUID uuid) { LOG.debug("Clearing device data {}", key); if (uuidVsData.containsKey(cls) && uuidVsData.get(cls).containsKey(uuid)) { LOG.debug("Remove {} {} from device data.", connectionInstance.getNodeId().getValue(), cls.getSimpleName()); @@ -305,19 +307,19 @@ public class HwvtepDeviceInfo { HwvtepSouthboundUtil.clearData(opKeyVsData, cls, key); } - public DeviceData getDeviceOperData(Class cls, UUID uuid) { + public DeviceData getDeviceOperData(Class> cls, UUID uuid) { return HwvtepSouthboundUtil.getData(uuidVsData, cls, uuid); } - public DeviceData getDeviceOperData(Class cls, InstanceIdentifier key) { + public DeviceData getDeviceOperData(Class> cls, InstanceIdentifier key) { return HwvtepSouthboundUtil.getData(opKeyVsData, cls, key); } - public Map getDeviceOperData(Class cls) { + public Map getDeviceOperData(Class> cls) { return opKeyVsData.get(cls); } - public InstanceIdentifier getDeviceOperKey(final Class cls, final UUID uuid) { + public InstanceIdentifier getDeviceOperKey(final Class> cls, final UUID uuid) { DeviceData deviceData = HwvtepSouthboundUtil.getData(uuidVsData, cls, uuid); if (deviceData != null) { return deviceData.getKey(); @@ -325,7 +327,7 @@ public class HwvtepDeviceInfo { return null; } - public UUID getUUID(Class cls, InstanceIdentifier key) { + public UUID getUUID(Class> cls, InstanceIdentifier key) { DeviceData data = HwvtepSouthboundUtil.getData(opKeyVsData, cls, key); if (data != null) { return data.uuid; @@ -333,7 +335,7 @@ public class HwvtepDeviceInfo { return null; } - public void addJobToQueue(DependentJob job) { + public > void addJobToQueue(DependentJob job) { dependencyQueue.addToQueue(job); } @@ -349,7 +351,7 @@ public class HwvtepDeviceInfo { dependencyQueue.submit(() -> connectionInstance.transact(transactCommand)); } - public void clearInTransit(Class cls, InstanceIdentifier key) { + public void clearInTransit(Class> cls, InstanceIdentifier key) { DeviceData deviceData = getDeviceOperData(cls, key); if (deviceData != null && deviceData.isInTransitState()) { if (deviceData.getData() != null) { @@ -361,7 +363,13 @@ public class HwvtepDeviceInfo { } } - public void incRefCount(InstanceIdentifier reference, InstanceIdentifier tep) { + public void incRefCount(InstanceIdentifier reference, BindingInstanceIdentifier tep) { + if (tep instanceof DataObjectIdentifier doi) { + incRefCount(reference, doi.toLegacy()); + } + } + + public void incRefCount(InstanceIdentifier reference, InstanceIdentifier tep) { if (reference == null || tep == null) { return; } @@ -377,6 +385,12 @@ public class HwvtepDeviceInfo { return tepIdReferences.get(tep); } + public void decRefCount(InstanceIdentifier reference, BindingInstanceIdentifier tep) { + if (tep instanceof DataObjectIdentifier doi) { + decRefCount(reference, doi.toLegacy()); + } + } + public void decRefCount(InstanceIdentifier reference, InstanceIdentifier tep) { if (reference == null || tep == null || !tepIdReferences.containsKey(tep)) { return; @@ -449,7 +463,7 @@ public class HwvtepDeviceInfo { return connectionInstance; } - public void setConfigKeyVsData(Map, Map>, Map> configKeyVsData) { this.configKeyVsData = configKeyVsData; } @@ -470,11 +484,11 @@ public class HwvtepDeviceInfo { deviceUpdateHistory.addToHistory(transactionType, object); } - public Map, Map> getOperData() { + public Map>, Map> getOperData() { return Collections.unmodifiableMap(opKeyVsData); } - public Map, Map> getUuidData() { + public Map>, Map> getUuidData() { return Collections.unmodifiableMap(uuidVsData); } @@ -490,5 +504,4 @@ public class HwvtepDeviceInfo { public boolean isKeyInDependencyQueue(InstanceIdentifier iid) { return iidInQueueCount.containsKey(iid); } - } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundMapper.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundMapper.java index d5ee74860..10b8b99a0 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundMapper.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundMapper.java @@ -128,8 +128,8 @@ public final class HwvtepSouthboundMapper { final InstanceIdentifier localTpIid, final InstanceIdentifier remoteTpIid) { - TunnelsKey tunnelsKey = new TunnelsKey(new HwvtepPhysicalLocatorRef(localTpIid), - new HwvtepPhysicalLocatorRef(remoteTpIid)); + TunnelsKey tunnelsKey = new TunnelsKey(new HwvtepPhysicalLocatorRef(localTpIid.toIdentifier()), + new HwvtepPhysicalLocatorRef(remoteTpIid.toIdentifier())); InstanceIdentifier tunnelInstanceId = nodeIid.builder().augmentation(PhysicalSwitchAugmentation.class) .child(Tunnels.class, tunnelsKey).build(); return tunnelInstanceId; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java index 1ce0fcc08..57e80829e 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java @@ -21,7 +21,6 @@ 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.binding.api.ReadWriteTransaction; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.mdsal.eos.binding.api.Entity; @@ -40,6 +39,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.osgi.service.component.annotations.Activate; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundUtil.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundUtil.java index ee1fb11b8..9e8cd32b5 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundUtil.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundUtil.java @@ -33,9 +33,10 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -76,16 +77,15 @@ public final class HwvtepSouthboundUtil { // FIXME: this should be an instance method public static InstanceIdentifier deserializeInstanceIdentifier(String iidString) { - InstanceIdentifier result = null; try { - result = instanceIdentifierCodec.bindingDeserializer(iidString); + return instanceIdentifierCodec.bindingDeserializer(iidString); } catch (DeserializationException e) { LOG.warn("Unable to deserialize iidString", e); + return null; } - return result; } - public static Optional readNode( + public static Optional readNode( DataBroker db, LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier connectionIid) { if (logicalDatastoreType == LogicalDatastoreType.OPERATIONAL) { @@ -104,7 +104,7 @@ public final class HwvtepSouthboundUtil { } } - public static Optional readNode( + public static Optional readNode( ReadTransaction transaction, LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier connectionIid) { if (logicalDatastoreType == LogicalDatastoreType.OPERATIONAL) { @@ -123,7 +123,7 @@ public final class HwvtepSouthboundUtil { } } - public static Optional readNode( + public static Optional readNode( ReadWriteTransaction transaction, final InstanceIdentifier connectionIid) { return readNode(transaction, LogicalDatastoreType.OPERATIONAL, connectionIid); } @@ -169,7 +169,7 @@ public final class HwvtepSouthboundUtil { @SuppressWarnings("unchecked") // Note: erasure makes this safe in combination with the typecheck // below - InstanceIdentifier path = (InstanceIdentifier) ref.getValue(); + InstanceIdentifier path = ((DataObjectIdentifier) ref.getValue()).toLegacy(); Optional optional = new MdsalUtils(db).readOptional(LogicalDatastoreType.OPERATIONAL, path); if (optional != null && optional.isPresent()) { @@ -206,8 +206,8 @@ public final class HwvtepSouthboundUtil { LOG.debug(SCHEMA_VERSION_MISMATCH, column, table, "hw_vtep", ex.getMessage()); } - public static void updateData(Map, Map> map, - Class cls, K key, D data) { + public static void updateData(Map>, Map> map, + Class> cls, K key, D data) { LOG.debug("Updating data {} {} {}", cls, key, data); if (key == null) { return; @@ -218,8 +218,8 @@ public final class HwvtepSouthboundUtil { map.get(cls).put(key, data); } - public static D getData(Map, Map> map, - Class cls, K key) { + public static D getData(Map>, Map> map, + Class> cls, K key) { if (key == null) { return null; } @@ -229,8 +229,8 @@ public final class HwvtepSouthboundUtil { return null; } - public static boolean containsKey(Map, Map> map, - Class cls, K key) { + public static boolean containsKey(Map>, Map> map, + Class> cls, K key) { if (key == null) { return false; } @@ -240,8 +240,8 @@ public final class HwvtepSouthboundUtil { return false; } - public static void clearData(Map, Map> map, - Class cls, K key) { + public static void clearData(Map>, Map> map, + Class> cls, K key) { LOG.debug("Clearing data {} {}", cls, key); if (key == null) { return; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepTableReader.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepTableReader.java index df7a650e3..8cfe755a0 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepTableReader.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepTableReader.java @@ -62,9 +62,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindings; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -98,7 +99,7 @@ public class HwvtepTableReader { TerminationPoint.class, PhysicalLocator.class, VlanBindings.class, PhysicalPort.class); - private final ImmutableMap>, WhereClauseGetter> whereClauseGetters; + private final ImmutableMap>, WhereClauseGetter> whereClauseGetters; private final ImmutableClassToInstanceMap> tables; private final HwvtepConnectionInstance connectionInstance; @@ -113,7 +114,7 @@ public class HwvtepTableReader { } final Builder> tableBuilder = ImmutableClassToInstanceMap.>builder(); - final ImmutableMap.Builder>, WhereClauseGetter> whereBuilder = + final ImmutableMap.Builder>, WhereClauseGetter> whereBuilder = ImmutableMap.builderWithExpectedSize(4); if (dbSchema != null) { @@ -162,8 +163,8 @@ public class HwvtepTableReader { @Override public List apply(final InstanceIdentifier iid) { RemoteMcastMacsKey key = iid.firstKeyOf(RemoteMcastMacs.class); - InstanceIdentifier lsIid = (InstanceIdentifier) key.getLogicalSwitchRef() - .getValue(); + InstanceIdentifier lsIid = + ((DataObjectIdentifier) key.getLogicalSwitchRef().getValue()).toLegacy(); UUID lsUUID = getLsUuid(lsIid); if (lsUUID == null) { LOG.warn("Could not find uuid for ls key {}", getNodeKeyStr(lsIid)); @@ -206,8 +207,8 @@ public class HwvtepTableReader { @Override public List apply(final InstanceIdentifier iid) { RemoteUcastMacsKey key = iid.firstKeyOf(RemoteUcastMacs.class); - InstanceIdentifier lsIid = (InstanceIdentifier) key.getLogicalSwitchRef() - .getValue(); + InstanceIdentifier lsIid = + ((DataObjectIdentifier) key.getLogicalSwitchRef().getValue()).toLegacy(); UUID lsUUID = connectionInstance.getDeviceInfo().getUUID(LogicalSwitches.class, lsIid); if (lsUUID == null) { LOG.error("Could not find uuid for ls key {}", lsIid); @@ -252,7 +253,7 @@ public class HwvtepTableReader { } @SuppressWarnings("checkstyle:IllegalCatch") - public Optional getHwvtepTableEntryUUID(final Class cls, + public Optional getHwvtepTableEntryUUID(final Class> cls, final InstanceIdentifier iid, final UUID existingUUID) { final TypedDatabaseSchema dbSchema; @@ -316,7 +317,7 @@ public class HwvtepTableReader { } @SuppressWarnings("checkstyle:IllegalCatch") - public List getHwvtepTableEntries(final Class cls) { + public List getHwvtepTableEntries(final Class> cls) { final TypedDatabaseSchema dbSchema; try { dbSchema = connectionInstance.getSchema(HwvtepSchemaConstants.HARDWARE_VTEP).get(); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/InstanceIdentifierCodec.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/InstanceIdentifierCodec.java index 2a98135b7..4f1b52734 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/InstanceIdentifierCodec.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/InstanceIdentifierCodec.java @@ -8,8 +8,8 @@ package org.opendaylight.ovsdb.hwvtepsouthbound; import java.util.Optional; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.dom.api.DOMSchemaService; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.XMLNamespace; @@ -77,11 +77,11 @@ public final class InstanceIdentifierCodec extends AbstractStringInstanceIdentif } public InstanceIdentifier bindingDeserializer(final String iidString) throws DeserializationException { - YangInstanceIdentifier normalizedYangIid = deserialize(iidString); - return bindingNormalizedNodeSerializer.fromYangInstanceIdentifier(normalizedYangIid); + return bindingDeserializer(deserialize(iidString)); } public InstanceIdentifier bindingDeserializer(final YangInstanceIdentifier yangIID) { - return bindingNormalizedNodeSerializer.fromYangInstanceIdentifier(yangIID); + final var ref = bindingNormalizedNodeSerializer.fromYangInstanceIdentifier(yangIID); + return ref != null ? ref.toLegacy() : null; } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/cli/HwvtepCacheDisplayCmd.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/cli/HwvtepCacheDisplayCmd.java index 289c3905c..984fefc34 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/cli/HwvtepCacheDisplayCmd.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/cli/HwvtepCacheDisplayCmd.java @@ -19,6 +19,7 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundProviderInfo; import org.opendaylight.ovsdb.lib.notation.UUID; import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalPort; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs; @@ -30,8 +31,9 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; @Service @Command(scope = "hwvtep", name = "cache", description = "Disply hwvtep cache") @@ -112,9 +114,9 @@ public class HwvtepCacheDisplayCmd implements Action { } - private static void printEntry(PrintStream console, Map.Entry, + private static void printEntry(PrintStream console, Map.Entry>, Map> entry) { - Class cls = entry.getKey(); + Class> cls = entry.getKey(); Map map = entry.getValue(); String clsName = cls.getSimpleName(); console.println(clsName + " - "); @@ -156,8 +158,8 @@ public class HwvtepCacheDisplayCmd implements Action { private static void printRemoteMcasts(PrintStream console, HwvtepDeviceInfo.DeviceData deviceData) { InstanceIdentifier remoteMcastMacsIid = deviceData.getKey(); String macAddress = remoteMcastMacsIid.firstKeyOf(RemoteMcastMacs.class).getMacEntryKey().getValue(); - String logicalSwitchRef = remoteMcastMacsIid.firstKeyOf(RemoteMcastMacs.class).getLogicalSwitchRef().getValue() - .firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue(); + String logicalSwitchRef = + getLogicalSwitchRef(remoteMcastMacsIid.firstKeyOf(RemoteMcastMacs.class).getLogicalSwitchRef()); StringBuilder macEntryDetails = new StringBuilder(macAddress).append(" LogicalSwitchRef ") .append(logicalSwitchRef); console.print(macEntryDetails); @@ -166,13 +168,18 @@ public class HwvtepCacheDisplayCmd implements Action { private static void printRemoteUcasts(PrintStream console, HwvtepDeviceInfo.DeviceData deviceData) { InstanceIdentifier remoteUcastMacsIid = deviceData.getKey(); String macAddress = remoteUcastMacsIid.firstKeyOf(RemoteUcastMacs.class).getMacEntryKey().getValue(); - String logicalSwitchRef = remoteUcastMacsIid.firstKeyOf(RemoteUcastMacs.class).getLogicalSwitchRef().getValue() - .firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue(); + String logicalSwitchRef = + getLogicalSwitchRef(remoteUcastMacsIid.firstKeyOf(RemoteUcastMacs.class).getLogicalSwitchRef()); StringBuilder macEntryDetails = new StringBuilder(macAddress).append(" LogicalSwitchRef ") .append(logicalSwitchRef); console.print(macEntryDetails); } + private static String getLogicalSwitchRef(HwvtepLogicalSwitchRef hwvtepLogicalSwitchRef) { + return ((DataObjectIdentifier) hwvtepLogicalSwitchRef.getValue()) + .toLegacy().firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue(); + } + private static void printTerminationPoint(PrintStream console, HwvtepDeviceInfo.DeviceData deviceData) { InstanceIdentifier terminationPointIid = deviceData.getKey(); console.print(terminationPointIid.firstKeyOf(TerminationPoint.class).getTpId().getValue()); @@ -200,9 +207,9 @@ public class HwvtepCacheDisplayCmd implements Action { console.println(deviceData.getUuid()); } - private static void printEntryUUID(PrintStream console, Map.Entry, Map>, Map> entry) { - Class cls = entry.getKey(); + Class> cls = entry.getKey(); Map map = entry.getValue(); String clsName = cls.getSimpleName(); console.println(clsName + " - "); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/ReconciliationTask.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/ReconciliationTask.java index c4a6ff9b9..b366e775a 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/ReconciliationTask.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/ReconciliationTask.java @@ -11,7 +11,7 @@ import static java.util.Objects.requireNonNull; import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionManager; import org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.connection.ConnectionReconciliationTask; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/DataObjectModificationImpl.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/DataObjectModificationImpl.java index 4f5d35b2c..7570b1764 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/DataObjectModificationImpl.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/DataObjectModificationImpl.java @@ -10,16 +10,16 @@ package org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.configuration; import java.util.ArrayList; import java.util.Collection; import org.opendaylight.mdsal.binding.api.DataObjectModification; -import org.opendaylight.yangtools.yang.binding.Augmentation; -import org.opendaylight.yangtools.yang.binding.ChildOf; -import org.opendaylight.yangtools.yang.binding.ChoiceIn; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.ExactDataObjectStep; +import org.opendaylight.yangtools.binding.Augmentation; +import org.opendaylight.yangtools.binding.ChildOf; +import org.opendaylight.yangtools.binding.ChoiceIn; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.EntryObject; +import org.opendaylight.yangtools.binding.ExactDataObjectStep; +import org.opendaylight.yangtools.binding.Key; +import org.opendaylight.yangtools.binding.KeyStep; +import org.opendaylight.yangtools.binding.NodeStep; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.Key; -import org.opendaylight.yangtools.yang.binding.KeyAware; -import org.opendaylight.yangtools.yang.binding.KeyStep; -import org.opendaylight.yangtools.yang.binding.NodeStep; public class DataObjectModificationImpl implements DataObjectModification { private final Collection> childNodesCache = new ArrayList<>(); @@ -84,13 +84,13 @@ public class DataObjectModificationImpl implements DataObj @Override @SuppressWarnings("unchecked") - public & ChildOf, K extends Key> DataObjectModification + public & ChildOf, K extends Key> DataObjectModification getModifiedChildListItem(final Class listItem, final K listKey) { return (DataObjectModification) getModifiedChild(new KeyStep<>(listItem, listKey)); } @Override - public & DataObject, C extends KeyAware & ChildOf, + public & DataObject, C extends EntryObject & ChildOf, K extends Key> DataObjectModification getModifiedChildListItem(Class caseType, Class listItem, K listKey) { return null; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/DataTreeModificationImpl.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/DataTreeModificationImpl.java index d844abfb8..f3c51ca00 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/DataTreeModificationImpl.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/DataTreeModificationImpl.java @@ -8,14 +8,13 @@ package org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.configuration; import org.opendaylight.mdsal.binding.api.DataObjectModification; -import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -public class DataTreeModificationImpl implements DataTreeModification { - +public class DataTreeModificationImpl implements DataTreeModification { InstanceIdentifier nodeId; T newNode; T oldNode; @@ -27,8 +26,13 @@ public class DataTreeModificationImpl implements DataTreeM } @Override - public DataTreeIdentifier getRootPath() { - return DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, nodeId); + public LogicalDatastoreType datastore() { + return LogicalDatastoreType.CONFIGURATION; + } + + @Override + public DataObjectIdentifier path() { + return nodeId.toIdentifier(); } @Override diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/GlobalConfigOperationalChangeGetter.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/GlobalConfigOperationalChangeGetter.java index 339fe18c6..ff4a5473b 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/GlobalConfigOperationalChangeGetter.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/configuration/GlobalConfigOperationalChangeGetter.java @@ -14,6 +14,7 @@ import java.util.Set; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacsKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs; @@ -22,8 +23,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; public final class GlobalConfigOperationalChangeGetter { @@ -69,9 +71,7 @@ public final class GlobalConfigOperationalChangeGetter { return null; } return localUcastMacs.values().stream() - .filter(mac -> removedSwitchNames.contains( - mac.getLogicalSwitchRef().getValue().firstKeyOf( - LogicalSwitches.class).getHwvtepNodeName().getValue())) + .filter(mac -> removedSwitchNames.contains(extractHwvtepNodeName(mac.getLogicalSwitchRef()))) .collect(BindingMap.toOrderedMap()); } @@ -86,13 +86,16 @@ public final class GlobalConfigOperationalChangeGetter { return null; } return localMcastMacs.values().stream() - .filter(mac -> removedSwitchNames.contains( - mac.getLogicalSwitchRef().getValue().firstKeyOf( - LogicalSwitches.class).getHwvtepNodeName().getValue())) + .filter(mac -> removedSwitchNames.contains(extractHwvtepNodeName(mac.getLogicalSwitchRef()))) .collect(BindingMap.toOrderedMap()); } - static Set getLogicalSwitchesToBeRemoved(final Node configNode, final Node opNode) { + private static String extractHwvtepNodeName(HwvtepLogicalSwitchRef hwvtepLogicalSwitchRef) { + return ((DataObjectIdentifier) hwvtepLogicalSwitchRef.getValue()).toLegacy() + .firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue(); + } + + static Set getLogicalSwitchesToBeRemoved(final Node configNode, final Node opNode) { Map cfgLogicalSwitches = null; Map opLogicalSwitches = null; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/connection/ConnectionReconciliationTask.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/connection/ConnectionReconciliationTask.java index 1d4cb55d8..367c236e5 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/connection/ConnectionReconciliationTask.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/reconciliation/connection/ConnectionReconciliationTask.java @@ -16,7 +16,7 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.ReconciliationTask import org.opendaylight.ovsdb.lib.OvsdbClient; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java index 83aa920d6..36ed707a5 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/AbstractTransactCommand.java @@ -37,15 +37,17 @@ import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; -import org.opendaylight.yangtools.yang.binding.Augmentation; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.Augmentation; +import org.opendaylight.yangtools.binding.BindingInstanceIdentifier; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.EntryObject; +import org.opendaylight.yangtools.binding.Key; +import org.opendaylight.yangtools.binding.PropertyIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.Key; -import org.opendaylight.yangtools.yang.binding.KeyAware; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class AbstractTransactCommand & DataObject, I extends Key, +public abstract class AbstractTransactCommand, I extends Key, A extends Augmentation> implements TransactCommand { private static final Logger LOG = LoggerFactory.getLogger(AbstractTransactCommand.class); @@ -61,7 +63,7 @@ public abstract class AbstractTransactCommand & DataObject public AbstractTransactCommand(final HwvtepOperationalState state, final Collection> changes) { - this.hwvtepOperationalState = state; + hwvtepOperationalState = state; this.changes = changes; } @@ -81,15 +83,15 @@ public abstract class AbstractTransactCommand & DataObject return getOperationalState().getConnectionInstance().ops(); } - void updateCurrentTxDeleteData(final Class cls, final InstanceIdentifier key, + void updateCurrentTxDeleteData(final Class> cls, final InstanceIdentifier key, final T data) { hwvtepOperationalState.updateCurrentTxDeleteData(cls, key); markKeyAsInTransit(cls, key); addToUpdates(key, data); } - void updateCurrentTxData(final Class cls, final InstanceIdentifier key, final UUID uuid, - final T data) { + void updateCurrentTxData(final Class> cls, final InstanceIdentifier key, + final UUID uuid, final T data) { hwvtepOperationalState.updateCurrentTxData(cls, key, uuid); markKeyAsInTransit(cls, key); addToUpdates(key, data); @@ -99,8 +101,8 @@ public abstract class AbstractTransactCommand & DataObject T oldData = null; Type type = getClass().getGenericSuperclass(); Type classType = ((ParameterizedType) type).getActualTypeArguments()[0]; - if (getConfigData((Class) classType, key) != null) { - oldData = (T) getConfigData((Class) classType, key).getData(); + if (getConfigData((Class>) classType, key) != null) { + oldData = (T) getConfigData((Class>) classType, key).getData(); } updates.add(new MdsalUpdate<>(key, data, oldData)); } @@ -118,7 +120,7 @@ public abstract class AbstractTransactCommand & DataObject Map confingDependencies = Collections.emptyMap(); if (isDeleteCmd()) { - if (deviceInfo.isKeyInTransit((Class) classType, key)) { + if (deviceInfo.isKeyInTransit((Class>) classType, key)) { inTransitDependencies = new HashMap<>(); inTransitDependencies.put(classType, Lists.newArrayList(key)); } @@ -129,7 +131,7 @@ public abstract class AbstractTransactCommand & DataObject confingDependencies.remove(TerminationPoint.class); //If this key itself is in transit wait for the response of this key itself - if (deviceInfo.isKeyInTransit((Class) classType, key) + if (deviceInfo.isKeyInTransit((Class>) classType, key) || deviceInfo.isKeyInDependencyQueue(key)) { inTransitDependencies.put(classType, Lists.newArrayList(key)); } @@ -139,9 +141,9 @@ public abstract class AbstractTransactCommand & DataObject && HwvtepSouthboundUtil.isEmptyMap(inTransitDependencies)) { doDeviceTransaction(transaction, nodeIid, data, key, extraData); if (isDeleteCmd()) { - getDeviceInfo().clearConfigData((Class) classType, key); + getDeviceInfo().clearConfigData((Class>) classType, key); } else { - getDeviceInfo().updateConfigData((Class) classType, key, data); + getDeviceInfo().updateConfigData((Class>) classType, key, data); } } @@ -155,7 +157,7 @@ public abstract class AbstractTransactCommand & DataObject final TransactionBuilder transactionBuilder) { clone.hwvtepOperationalState = operationalState; HwvtepDeviceInfo.DeviceData deviceData = - getDeviceInfo().getConfigData((Class)getClassType(), key); + getDeviceInfo().getConfigData((Class>)getClassType(), key); T latest = data; if (deviceData != null && deviceData.getData() != null) { latest = (T) deviceData.getData(); @@ -192,7 +194,7 @@ public abstract class AbstractTransactCommand & DataObject final TransactionBuilder transactionBuilder) { clone.hwvtepOperationalState = operationalState; HwvtepDeviceInfo.DeviceData deviceData = getDeviceInfo() - .getConfigData((Class)getClassType(), key); + .getConfigData((Class>)getClassType(), key); T latest = data; if (deviceData != null && deviceData.getData() != null) { latest = (T) deviceData.getData(); @@ -267,7 +269,7 @@ public abstract class AbstractTransactCommand & DataObject if (!Objects.equals(hwvtepOperationalState.getConnectionInstance().getInstanceIdentifier(), key)) { continue; } - Class classType = (Class) getClassType(); + Class> classType = (Class>) getClassType(); List removed; if (getOperationalState().isInReconciliation()) { removed = getRemoved(change); @@ -291,7 +293,7 @@ public abstract class AbstractTransactCommand & DataObject if (!Objects.equals(hwvtepOperationalState.getConnectionInstance().getInstanceIdentifier(), key)) { continue; } - Class classType = (Class) getClassType(); + Class> classType = (Class>) getClassType(); List updated = null; if (getOperationalState().isInReconciliation()) { updated = getUpdated(change); @@ -366,8 +368,8 @@ public abstract class AbstractTransactCommand & DataObject return HwvtepSouthboundUtil.isEmpty(list1) ? Collections.emptyList() : list1; } - Map map1 = list1.stream().collect(Collectors.toMap(KeyAware::key, ele -> ele)); - Map map2 = list2.stream().collect(Collectors.toMap(KeyAware::key, ele -> ele)); + Map map1 = list1.stream().collect(Collectors.toMap(EntryObject::key, ele -> ele)); + Map map2 = list2.stream().collect(Collectors.toMap(EntryObject::key, ele -> ele)); map1.entrySet().forEach(entry1 -> { T val2 = map2.remove(entry1.getKey()); if (compareKeyOnly) { @@ -444,7 +446,7 @@ public abstract class AbstractTransactCommand & DataObject getOperationalState().getDeviceInfo().addToControllerTx(transactionType, element); } - public HwvtepDeviceInfo.DeviceData fetchDeviceData(final Class cls, + public HwvtepDeviceInfo.DeviceData fetchDeviceData(final Class> cls, final InstanceIdentifier key) { HwvtepDeviceInfo.DeviceData deviceData = getDeviceOpData(cls, key); if (deviceData == null) { @@ -462,30 +464,30 @@ public abstract class AbstractTransactCommand & DataObject return deviceData; } - public void addJobToQueue(final DependentJob job) { + public > void addJobToQueue(final DependentJob job) { hwvtepOperationalState.getDeviceInfo().putKeyInDependencyQueue(job.getKey()); hwvtepOperationalState.getDeviceInfo().addJobToQueue(job); } - public void markKeyAsInTransit(final Class cls, final InstanceIdentifier key) { + public void markKeyAsInTransit(final Class> cls, final InstanceIdentifier key) { hwvtepOperationalState.getDeviceInfo().markKeyAsInTransit(cls, key); } - public HwvtepDeviceInfo.DeviceData getDeviceOpData(final Class cls, + public HwvtepDeviceInfo.DeviceData getDeviceOpData(final Class> cls, final InstanceIdentifier key) { return getOperationalState().getDeviceInfo().getDeviceOperData(cls, key); } - public void clearConfigData(final Class cls, final InstanceIdentifier key) { + public void clearConfigData(final Class> cls, final InstanceIdentifier key) { hwvtepOperationalState.getDeviceInfo().clearConfigData(cls, key); } - public HwvtepDeviceInfo.DeviceData getConfigData(final Class cls, + public HwvtepDeviceInfo.DeviceData getConfigData(final Class> cls, final InstanceIdentifier key) { return hwvtepOperationalState.getDeviceInfo().getConfigData(cls, key); } - public void updateConfigData(final Class cls, final InstanceIdentifier key, + public void updateConfigData(final Class> cls, final InstanceIdentifier key, final Object data) { hwvtepOperationalState.getDeviceInfo().updateConfigData(cls, key, data); } @@ -522,8 +524,15 @@ public abstract class AbstractTransactCommand & DataObject return iid.toString(); } - protected String getLsKeyStr(final InstanceIdentifier iid) { - return ((InstanceIdentifier)iid).firstKeyOf(LogicalSwitches.class) - .getHwvtepNodeName().getValue(); + protected String getLsKeyStr(final InstanceIdentifier iid) { + return iid.toLegacy().firstKeyOf(LogicalSwitches.class).getHwvtepNodeName() .getValue(); + } + + protected String getLsKeyStr(final BindingInstanceIdentifier iid) { + final var doi = switch (iid) { + case DataObjectIdentifier oi -> oi; + case PropertyIdentifier pi -> pi.container(); + }; + return getLsKeyStr(doi.toLegacy()); } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependentJob.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependentJob.java index c541a743c..b18070314 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependentJob.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependentJob.java @@ -17,21 +17,20 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo; import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundConstants; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class DependentJob { - +public abstract class DependentJob> { private static final Logger LOG = LoggerFactory.getLogger(DependentJob.class); - private static final Predicate DATA_INTRANSIT - = (controllerData) -> controllerData != null && controllerData.isInTransitState(); + private static final Predicate DATA_INTRANSIT = + controllerData -> controllerData != null && controllerData.isInTransitState(); - private static final Predicate DATA_INTRANSIT_EXPIRED - = (controllerData) -> controllerData != null && controllerData.isInTransitState() + private static final Predicate DATA_INTRANSIT_EXPIRED = + controllerData -> controllerData != null && controllerData.isInTransitState() && controllerData.isIntransitTimeExpired(); //expecting the device to create the data @@ -132,7 +131,7 @@ public abstract class DependentJob { public void onSuccess() { } - public abstract static class ConfigWaitingJob extends DependentJob { + public abstract static class ConfigWaitingJob> extends DependentJob { public ConfigWaitingJob(InstanceIdentifier key, T data, Map, List> dependencies) { @@ -149,7 +148,7 @@ public abstract class DependentJob { } } - public abstract static class OpWaitingJob extends DependentJob { + public abstract static class OpWaitingJob> extends DependentJob { public OpWaitingJob(InstanceIdentifier key, T data, Map, List> dependencies, diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/EmptyDependencyGetter.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/EmptyDependencyGetter.java index 84884eb0a..b09c476e3 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/EmptyDependencyGetter.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/EmptyDependencyGetter.java @@ -9,8 +9,8 @@ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; import java.util.Collections; import java.util.List; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; public final class EmptyDependencyGetter extends UnMetDependencyGetter { @@ -20,12 +20,12 @@ public final class EmptyDependencyGetter extends UnMetDependencyGetter { } @Override - public List> getLogicalSwitchDependencies(KeyAware data) { + public List> getLogicalSwitchDependencies(EntryObject data) { return Collections.emptyList(); } @Override - public List> getTerminationPointDependencies(KeyAware data) { + public List> getTerminationPointDependencies(EntryObject data) { return Collections.emptyList(); } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/HwvtepOperationalState.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/HwvtepOperationalState.java index aa7401b1c..22a2cd15b 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/HwvtepOperationalState.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/HwvtepOperationalState.java @@ -54,8 +54,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -69,9 +70,9 @@ public class HwvtepOperationalState { HashMap, UUID> inflightLocators = new HashMap<>(); private final HwvtepDeviceInfo deviceInfo; private final HwvtepConnectionInstance connectionInstance; - private final Map, Map> currentTxUUIDs = + private final Map>, Map> currentTxUUIDs = new ConcurrentHashMap<>(); - private final Map, Map> currentTxDeletedKeys = + private final Map>, Map> currentTxDeletedKeys = new ConcurrentHashMap<>(); /* stores the modified and deleted data for each child type of each node id @@ -80,8 +81,8 @@ public class HwvtepOperationalState { child type is the child of hwvtep Global augmentation */ private Map, - Pair, List>, - Map, List>>> modifiedData = new HashMap<>(); + Pair>, List>>, + Map>, List>>>> modifiedData = new HashMap<>(); private boolean inReconciliation = false; private final DataBroker db; private final Collection> changes; @@ -119,8 +120,8 @@ public class HwvtepOperationalState { HwvtepGlobalAugmentation globalAugmentation = globalOperNode.augmentation(HwvtepGlobalAugmentation.class); if (globalAugmentation != null) { if (!HwvtepSouthboundUtil.isEmptyMap(globalAugmentation.getSwitches())) { - operationalNodes.put((InstanceIdentifier) - globalAugmentation.getSwitches().values().iterator().next().getSwitchRef().getValue(), psNode); + operationalNodes.put(((DataObjectIdentifier) globalAugmentation.getSwitches().values().iterator() + .next().getSwitchRef().getValue()).toLegacy(), psNode); } } } @@ -153,7 +154,7 @@ public class HwvtepOperationalState { for (Switches pswitch : hgAugmentation.nonnullSwitches().values()) { @SuppressWarnings("unchecked") InstanceIdentifier psNodeIid = - (InstanceIdentifier) pswitch.getSwitchRef().getValue(); + ((DataObjectIdentifier) pswitch.getSwitchRef().getValue()).toLegacy(); Optional psNode = new MdsalUtils(db).readOptional(LogicalDatastoreType.OPERATIONAL, psNodeIid); if (psNode.isPresent()) { @@ -164,7 +165,7 @@ public class HwvtepOperationalState { if (psAugmentation != null) { @SuppressWarnings("unchecked") InstanceIdentifier hgNodeIid = - (InstanceIdentifier) psAugmentation.getManagedBy().getValue(); + ((DataObjectIdentifier) psAugmentation.getManagedBy().getValue()).toLegacy(); Optional hgNode = new MdsalUtils(db).readOptional( LogicalDatastoreType.OPERATIONAL, hgNodeIid); if (hgNode.isPresent()) { @@ -307,33 +308,33 @@ public class HwvtepOperationalState { return deviceInfo; } - public void updateCurrentTxData(final Class cls, final InstanceIdentifier key, + public void updateCurrentTxData(final Class> cls, final InstanceIdentifier key, final UUID uuid) { HwvtepSouthboundUtil.updateData(currentTxUUIDs, cls, key, uuid); } - public void updateCurrentTxDeleteData(final Class cls, final InstanceIdentifier key) { + public void updateCurrentTxDeleteData(final Class> cls, final InstanceIdentifier key) { HwvtepSouthboundUtil.updateData(currentTxDeletedKeys, cls, key, Boolean.TRUE); } - public UUID getUUIDFromCurrentTx(final Class cls, final InstanceIdentifier key) { + public UUID getUUIDFromCurrentTx(final Class> cls, final InstanceIdentifier key) { return HwvtepSouthboundUtil.getData(currentTxUUIDs, cls, key); } - public boolean isKeyPartOfCurrentTx(final Class cls, final InstanceIdentifier key) { + public boolean isKeyPartOfCurrentTx(final Class> cls, final InstanceIdentifier key) { return HwvtepSouthboundUtil.containsKey(currentTxUUIDs, cls, key); } - public Set getDeletedKeysInCurrentTx(final Class cls) { + public Set getDeletedKeysInCurrentTx(final Class> cls) { if (currentTxDeletedKeys.containsKey(cls)) { return currentTxDeletedKeys.get(cls).keySet(); } return Collections.emptySet(); } - public List getUpdatedData(final InstanceIdentifier key, - final Class cls) { - List result = null; + public List> getUpdatedData(final InstanceIdentifier key, + final Class> cls) { + List> result = null; if (modifiedData.get(key) != null && modifiedData.get(key).getLeft() != null) { result = modifiedData.get(key).getLeft().get(cls); } @@ -343,9 +344,9 @@ public class HwvtepOperationalState { return result; } - public List getDeletedData(final InstanceIdentifier key, - final Class cls) { - List result = null; + public List> getDeletedData(final InstanceIdentifier key, + final Class> cls) { + List> result = null; if (modifiedData.get(key) != null && modifiedData.get(key).getRight() != null) { result = modifiedData.get(key).getRight().get(cls); } @@ -356,8 +357,8 @@ public class HwvtepOperationalState { } public void setModifiedData(final Map, - Pair, List>, - Map, List>>> modifiedData) { + Pair>, List>>, + Map>, List>>>> modifiedData) { this.modifiedData = modifiedData; } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java index 3240cebb8..bb6df6a9c 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java @@ -29,6 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.StaticRoutes; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.SwitchBindings; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -119,7 +120,7 @@ public class LogicalRouterUpdateCommand for (SwitchBindings switchBinding : switchBindings) { @SuppressWarnings("unchecked") InstanceIdentifier lswitchIid = - (InstanceIdentifier)switchBinding.getLogicalSwitchRef().getValue(); + ((DataObjectIdentifier) switchBinding.getLogicalSwitchRef().getValue()).toLegacy(); Optional operationalSwitchOptional = getOperationalState().getLogicalSwitches(lswitchIid); if (operationalSwitchOptional.isPresent()) { @@ -141,7 +142,7 @@ public class LogicalRouterUpdateCommand for (AclBindings aclBinding : aclBindings.values()) { @SuppressWarnings("unchecked") InstanceIdentifier aclIid = - (InstanceIdentifier)aclBinding.getAclRef().getValue(); + ((DataObjectIdentifier) aclBinding.getAclRef().getValue()).toLegacy(); Optional operationalAclOptional = getOperationalState().getAcls(aclIid); if (operationalAclOptional.isPresent()) { diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalRemoveCommand.java index 30abe59ee..713ee025e 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalRemoveCommand.java @@ -20,6 +20,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacsKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -104,7 +105,7 @@ public class McastMacsLocalRemoveCommand @Override public List> getLogicalSwitchDependencies(final LocalMcastMacs data) { - return List.of(data.getLogicalSwitchRef().getValue()); + return List.of(((DataObjectIdentifier) data.getLogicalSwitchRef().getValue()).toLegacy()); } @Override diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalUpdateCommand.java index c6a80d43d..522d3848b 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalUpdateCommand.java @@ -23,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacsKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -85,7 +86,7 @@ public class McastMacsLocalUpdateCommand if (inputMac.getLogicalSwitchRef() != null) { @SuppressWarnings("unchecked") InstanceIdentifier lswitchIid = - (InstanceIdentifier) inputMac.getLogicalSwitchRef().getValue(); + ((DataObjectIdentifier) inputMac.getLogicalSwitchRef().getValue()).toLegacy(); Optional operationalSwitchOptional = getOperationalState().getLogicalSwitches(lswitchIid); if (operationalSwitchOptional.isPresent()) { diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteUpdateCommand.java index 0ce24d612..d52b41c85 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteUpdateCommand.java @@ -33,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSet; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -132,7 +133,7 @@ public class McastMacsRemoteUpdateCommand if (inputMac.getLogicalSwitchRef() != null) { @SuppressWarnings("unchecked") InstanceIdentifier lswitchIid = - (InstanceIdentifier) inputMac.getLogicalSwitchRef().getValue(); + ((DataObjectIdentifier) inputMac.getLogicalSwitchRef().getValue()).toLegacy(); UUID logicalSwitchUUID = TransactUtils.getLogicalSwitchUUID(transaction, getOperationalState(), lswitchIid); if (logicalSwitchUUID != null) { mcastMacsRemote.setLogicalSwitch(logicalSwitchUUID); @@ -202,7 +203,7 @@ public class McastMacsRemoteUpdateCommand if (data == null) { return Collections.emptyList(); } - return Lists.newArrayList(data.getLogicalSwitchRef().getValue()); + return Lists.newArrayList(((DataObjectIdentifier) data.getLogicalSwitchRef().getValue()).toLegacy()); } @Override @@ -212,7 +213,7 @@ public class McastMacsRemoteUpdateCommand } List> locators = new ArrayList<>(); for (LocatorSet locator: data.getLocatorSet()) { - locators.add(locator.getLocatorRef().getValue()); + locators.add(((DataObjectIdentifier) locator.getLocatorRef().getValue()).toLegacy()); } return locators; } @@ -244,7 +245,7 @@ public class McastMacsRemoteUpdateCommand RemoteMcastMacs mac = (RemoteMcastMacs) mdsalUpdate.getNewData(); InstanceIdentifier macIid = mdsalUpdate.getKey(); getDeviceInfo().updateRemoteMcast( - (InstanceIdentifier) mac.getLogicalSwitchRef().getValue(), macIid, mac); + ((DataObjectIdentifier) mac.getLogicalSwitchRef().getValue()).toLegacy(), macIid, mac); } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/MdsalUpdate.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/MdsalUpdate.java index 19841eed8..25554b5b6 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/MdsalUpdate.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/MdsalUpdate.java @@ -7,10 +7,10 @@ */ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; -public class MdsalUpdate { +public class MdsalUpdate> { private InstanceIdentifier key; private T newData; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortUpdateCommand.java index b903917c0..11a4b3322 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortUpdateCommand.java @@ -31,6 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -185,7 +186,7 @@ public class PhysicalPortUpdateCommand for (VlanBindings vlanBinding : portAugmentation.nonnullVlanBindings().values()) { @SuppressWarnings("unchecked") InstanceIdentifier lswitchIid = - (InstanceIdentifier) vlanBinding.getLogicalSwitchRef().getValue(); + ((DataObjectIdentifier) vlanBinding.getLogicalSwitchRef().getValue()).toLegacy(); Map inTransitDependencies = DEPENDENCY_GETTER.getInTransitDependencies( getOperationalState(), vlanBinding); @@ -273,7 +274,8 @@ public class PhysicalPortUpdateCommand if (data == null) { return Collections.emptyList(); } - return Collections.singletonList(data.getLogicalSwitchRef().getValue()); + return Collections.singletonList( + ((DataObjectIdentifier) data.getLogicalSwitchRef().getValue()).toLegacy()); } @Override diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchUpdateCommand.java index 74887ae8f..d3f43d44c 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchUpdateCommand.java @@ -45,6 +45,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdRemoteConfigsKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -192,9 +193,9 @@ public final class PhysicalSwitchUpdateCommand extends AbstractTransactCommand { Tunnel newTunnel = transaction.getTypedRowWrapper(Tunnel.class); UUID localUUID = getLocatorUUID(transaction, - (InstanceIdentifier) tunnel.getLocalLocatorRef().getValue()); + ((DataObjectIdentifier) tunnel.getLocalLocatorRef().getValue()).toLegacy()); UUID remoteUUID = getLocatorUUID(transaction, - (InstanceIdentifier) tunnel.getRemoteLocatorRef().getValue()); + ((DataObjectIdentifier) tunnel.getRemoteLocatorRef().getValue()).toLegacy()); if (localUUID != null && remoteUUID != null) { // local and remote must exist newTunnel.setLocal(localUUID); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactCommand.java index d9358167e..fe4ab90f2 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactCommand.java @@ -9,10 +9,10 @@ package org.opendaylight.ovsdb.hwvtepsouthbound.transact; import org.opendaylight.ovsdb.lib.operations.TransactionBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; -public interface TransactCommand { +public interface TransactCommand> { void execute(TransactionBuilder transaction); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactCommandAggregator.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactCommandAggregator.java index 7191bba0b..ee8e01ed2 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactCommandAggregator.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactCommandAggregator.java @@ -23,9 +23,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,8 +41,8 @@ public class TransactCommandAggregator implements TransactCommand { child type is the child of hwvtep Global augmentation */ private final Map, - Pair, List>, - Map, List>>> modifiedData = new HashMap<>(); + Pair>, List>>, + Map>, List>>>> modifiedData = new HashMap<>(); public TransactCommandAggregator(HwvtepOperationalState state, Collection> changes) { @@ -76,13 +76,13 @@ public class TransactCommandAggregator implements TransactCommand { } @Override - public void onConfigUpdate(TransactionBuilder transaction, InstanceIdentifier nodeIid, KeyAware data, + public void onConfigUpdate(TransactionBuilder transaction, InstanceIdentifier nodeIid, EntryObject data, InstanceIdentifier key, Object... extraData) { } @Override - public void doDeviceTransaction(TransactionBuilder transaction, InstanceIdentifier nodeIid, KeyAware data, + public void doDeviceTransaction(TransactionBuilder transaction, InstanceIdentifier nodeIid, EntryObject data, InstanceIdentifier key, Object... extraData) { } @@ -92,8 +92,8 @@ public class TransactCommandAggregator implements TransactCommand { for (DataTreeModification change : changes) { final InstanceIdentifier key = change.getRootPath().getRootIdentifier(); final DataObjectModification mod = change.getRootNode(); - final Map, List> updatedData = new HashMap<>(); - final Map, List> deletedData = new HashMap<>(); + final Map>, List>> updatedData = new HashMap<>(); + final Map>, List>> deletedData = new HashMap<>(); extractDataChanged(key, mod, updatedData, deletedData); modifiedData.put(key, Pair.of(updatedData, deletedData)); operationalState.setModifiedData(modifiedData); @@ -106,16 +106,16 @@ public class TransactCommandAggregator implements TransactCommand { } } - private static boolean isMacOnlyUpdate(final Map, List> updatedData, - final Map, List> deletedData) { + private static boolean isMacOnlyUpdate( + final Map>, List>> updatedData, + final Map>, List>> deletedData) { return updatedData.containsKey(RemoteUcastMacs.class) && updatedData.size() == 1 || deletedData.containsKey(RemoteUcastMacs.class) && deletedData.size() == 1; } - private static void extractDataChanged(final InstanceIdentifier key, - final DataObjectModification mod, - final Map, List> updatedData, - final Map, List> deletedData) { + private static void extractDataChanged(final InstanceIdentifier key, final DataObjectModification mod, + final Map>, List>> updatedData, + final Map>, List>> deletedData) { extractDataChanged(mod.getModifiedChildren(), updatedData, deletedData); DataObjectModification aug = mod.getModifiedAugmentation( @@ -132,18 +132,18 @@ public class TransactCommandAggregator implements TransactCommand { private static void extractDataChanged( final Collection> children, - final Map, List> updatedData, - final Map, List> deletedData) { + final Map>, List>> updatedData, + final Map>, List>> deletedData) { if (children == null) { return; } for (DataObjectModification child : children) { - Class childClass = (Class) child.getDataType(); + Class> childClass = (Class>) child.getDataType(); switch (child.getModificationType()) { case WRITE: case SUBTREE_MODIFIED: DataObject dataAfter = child.getDataAfter(); - if (!(dataAfter instanceof KeyAware)) { + if (!(dataAfter instanceof EntryObject identifiable)) { continue; } DataObject before = child.getDataBefore(); @@ -155,15 +155,14 @@ public class TransactCommandAggregator implements TransactCommand { */ continue; } - KeyAware identifiable = (KeyAware) dataAfter; addToUpdatedData(updatedData, childClass, identifiable); break; case DELETE: DataObject dataBefore = child.getDataBefore(); - if (!(dataBefore instanceof KeyAware)) { + if (!(dataBefore instanceof EntryObject identifiable)) { continue; } - addToUpdatedData(deletedData, childClass, (KeyAware)dataBefore); + addToUpdatedData(deletedData, childClass, identifiable); break; default: break; @@ -171,8 +170,8 @@ public class TransactCommandAggregator implements TransactCommand { } } - private static void addToUpdatedData(Map, List> updatedData, - Class childClass, KeyAware identifiable) { + private static void addToUpdatedData(Map>, List>> updatedData, + Class> childClass, EntryObject identifiable) { updatedData.computeIfAbsent(childClass, (cls) -> new ArrayList<>()); updatedData.get(childClass).add(identifiable); } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java index bc6550afe..dde84c071 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java @@ -39,6 +39,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSet; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -129,7 +130,7 @@ public final class TransactUtils { for (LocatorSet locator: locatorList) { @SuppressWarnings("unchecked") InstanceIdentifier iid = - (InstanceIdentifier) locator.getLocatorRef().getValue(); + ((DataObjectIdentifier) locator.getLocatorRef().getValue()).toLegacy(); UUID locatorUuid = createPhysicalLocator(transaction, hwvtepOperationalState, iid); if (locatorUuid != null) { locators.add(locatorUuid); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalRemoveCommand.java index 30bae44c2..fd1557f2f 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalRemoveCommand.java @@ -20,6 +20,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacsKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -99,7 +100,7 @@ public class UcastMacsLocalRemoveCommand @Override public List> getLogicalSwitchDependencies(final LocalUcastMacs data) { - return List.of(data.getLogicalSwitchRef().getValue()); + return List.of(((DataObjectIdentifier) data.getLogicalSwitchRef().getValue()).toLegacy()); } @Override diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalUpdateCommand.java index 967c1af15..fb98ca57c 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalUpdateCommand.java @@ -26,6 +26,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,7 +89,7 @@ public class UcastMacsLocalUpdateCommand if (inputMac.getLogicalSwitchRef() != null) { @SuppressWarnings("unchecked") InstanceIdentifier lswitchIid = - (InstanceIdentifier) inputMac.getLogicalSwitchRef().getValue(); + ((DataObjectIdentifier) inputMac.getLogicalSwitchRef().getValue()).toLegacy(); Optional operationalSwitchOptional = getOperationalState().getLogicalSwitches(lswitchIid); if (operationalSwitchOptional.isPresent()) { @@ -110,7 +111,7 @@ public class UcastMacsLocalUpdateCommand UUID locatorUuid = null; @SuppressWarnings("unchecked") InstanceIdentifier iid = - (InstanceIdentifier) inputMac.getLocatorRef().getValue(); + ((DataObjectIdentifier) inputMac.getLocatorRef().getValue()).toLegacy(); //try to find locator in operational DS Optional operationalLocatorOptional = getOperationalState().getPhysicalLocatorAugmentation(iid); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java index b5ac30713..817d2626b 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java @@ -25,6 +25,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacsKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -144,7 +145,7 @@ public class UcastMacsRemoteRemoveCommand RemoteUcastMacs mac = (RemoteUcastMacs) mdsalUpdate.getNewData(); InstanceIdentifier macIid = mdsalUpdate.getKey(); getDeviceInfo().removeRemoteUcast( - (InstanceIdentifier) mac.getLogicalSwitchRef().getValue(), macIid); + ((DataObjectIdentifier) mac.getLogicalSwitchRef().getValue()).toLegacy(), macIid); } getDeviceInfo().onOperDataAvailable(); } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java index 1973807f8..f2713d094 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java @@ -27,6 +27,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacsKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -136,7 +137,7 @@ public class UcastMacsRemoteUpdateCommand if (inputMac.getLogicalSwitchRef() != null) { @SuppressWarnings("unchecked") InstanceIdentifier lswitchIid = - (InstanceIdentifier) inputMac.getLogicalSwitchRef().getValue(); + ((DataObjectIdentifier) inputMac.getLogicalSwitchRef().getValue()).toLegacy(); UUID logicalSwitchUUID = TransactUtils.getLogicalSwitchUUID(transaction, getOperationalState(), lswitchIid); if (logicalSwitchUUID != null) { ucastMacsRemote.setLogicalSwitch(TransactUtils.getLogicalSwitchUUID(transaction, getOperationalState(), @@ -151,7 +152,7 @@ public class UcastMacsRemoteUpdateCommand if (inputMac.getLocatorRef() != null) { @SuppressWarnings("unchecked") InstanceIdentifier iid = - (InstanceIdentifier) inputMac.getLocatorRef().getValue(); + ((DataObjectIdentifier) inputMac.getLocatorRef().getValue()).toLegacy(); UUID locatorUuid = TransactUtils.createPhysicalLocator(transaction, getOperationalState(), iid); ucastMacsRemote.setLocator(locatorUuid); return locatorUuid; @@ -183,7 +184,7 @@ public class UcastMacsRemoteUpdateCommand if (data == null) { return Collections.emptyList(); } - return Lists.newArrayList(data.getLogicalSwitchRef().getValue()); + return Lists.newArrayList(((DataObjectIdentifier) data.getLogicalSwitchRef().getValue()).toLegacy()); } @Override @@ -191,7 +192,7 @@ public class UcastMacsRemoteUpdateCommand if (data == null) { return Collections.emptyList(); } - return Lists.newArrayList(data.getLocatorRef().getValue()); + return Lists.newArrayList(((DataObjectIdentifier) data.getLocatorRef().getValue()).toLegacy()); } } @@ -207,7 +208,7 @@ public class UcastMacsRemoteUpdateCommand RemoteUcastMacs mac = (RemoteUcastMacs) mdsalUpdate.getNewData(); InstanceIdentifier macIid = mdsalUpdate.getKey(); getDeviceInfo().updateRemoteUcast( - (InstanceIdentifier) mac.getLogicalSwitchRef().getValue(), macIid, mac); + ((DataObjectIdentifier) mac.getLogicalSwitchRef().getValue()).toLegacy(), macIid, mac); } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UnMetDependencyGetter.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UnMetDependencyGetter.java index d6e5f8263..4c646b073 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UnMetDependencyGetter.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UnMetDependencyGetter.java @@ -19,14 +19,14 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo; import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; /** * Utility class to retrieve the unmet dependencies (config/operational) of the given object. */ -public abstract class UnMetDependencyGetter { +public abstract class UnMetDependencyGetter> { private final ConfigDependencyGetter configDependencyGetter = new ConfigDependencyGetter(); private final InTransitDependencyGetter inTransitDependencyGetter = new InTransitDependencyGetter(); @@ -39,7 +39,7 @@ public abstract class UnMetDependencyGetter { * @param data The data object * @return The depenencies */ - public Map, List> getInTransitDependencies( + public Map>, List> getInTransitDependencies( HwvtepOperationalState opState, T data) { return inTransitDependencyGetter.retrieveUnMetDependencies(opState, opState.getDeviceInfo(), data); } @@ -52,23 +52,23 @@ public abstract class UnMetDependencyGetter { * @param data The data object * @return the depenencies */ - public Map, List> getUnMetConfigDependencies( + public Map>, List> getUnMetConfigDependencies( HwvtepOperationalState opState, T data) { return configDependencyGetter.retrieveUnMetDependencies(opState, opState.getDeviceInfo(), data); } abstract class DependencyGetter { - Map, List> retrieveUnMetDependencies( + Map>, List> retrieveUnMetDependencies( HwvtepOperationalState opState, HwvtepDeviceInfo deviceInfo, T data) { - Map, List> result = new HashMap<>(); - Map, List>> allKeys = new HashMap<>(); + Map>, List> result = new HashMap<>(); + Map>, List>> allKeys = new HashMap<>(); allKeys.put(LogicalSwitches.class, getLogicalSwitchDependencies(data)); allKeys.put(TerminationPoint.class, getTerminationPointDependencies(data)); - for (Entry, List>> entry : allKeys.entrySet()) { - Class cls = entry.getKey(); + for (Entry>, List>> entry : allKeys.entrySet()) { + Class> cls = entry.getKey(); List> keysToCheck = entry.getValue(); for (InstanceIdentifier key : keysToCheck) { if (!isDependencyMet(opState, deviceInfo, cls, key)) { @@ -79,9 +79,9 @@ public abstract class UnMetDependencyGetter { return result; } - Map, List> addToResultMap( - Map, List> result, - Class cls, InstanceIdentifier key) { + Map>, List> addToResultMap( + Map>, List> result, + Class> cls, InstanceIdentifier key) { if (null == result) { result = new HashMap<>(); } @@ -93,18 +93,18 @@ public abstract class UnMetDependencyGetter { } abstract boolean isDependencyMet(HwvtepOperationalState opState, HwvtepDeviceInfo deviceInfo, - Class cls, InstanceIdentifier key); + Class> cls, InstanceIdentifier key); } class ConfigDependencyGetter extends DependencyGetter { @Override boolean isDependencyMet(HwvtepOperationalState opState, HwvtepDeviceInfo deviceInfo, - Class cls, InstanceIdentifier key) { + Class> cls, InstanceIdentifier key) { return deviceInfo.isConfigDataAvailable(cls, key) || isConfigDataAvailable(opState, cls, key); } boolean isConfigDataAvailable(HwvtepOperationalState opState, - Class cls, + Class> cls, InstanceIdentifier key) { DataBroker db = opState.getConnectionInstance().getDataBroker(); Optional data = HwvtepSouthboundUtil.readNode(db, LogicalDatastoreType.CONFIGURATION, key); @@ -119,7 +119,7 @@ public abstract class UnMetDependencyGetter { class InTransitDependencyGetter extends DependencyGetter { @Override boolean isDependencyMet(HwvtepOperationalState opState, HwvtepDeviceInfo deviceInfo, - Class cls, InstanceIdentifier key) { + Class> cls, InstanceIdentifier key) { return opState.isKeyPartOfCurrentTx(cls, key) || !deviceInfo.isKeyInTransit(cls, key); } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/AbstractTransactionCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/AbstractTransactionCommand.java index ef433a09b..0f46a9afd 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/AbstractTransactionCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/AbstractTransactionCommand.java @@ -19,9 +19,9 @@ import org.opendaylight.ovsdb.lib.notation.UUID; import org.opendaylight.ovsdb.lib.schema.DatabaseSchema; import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ConnectionInfo; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -31,8 +31,8 @@ public abstract class AbstractTransactionCommand implement private final TableUpdates updates; private final DatabaseSchema dbSchema; protected final HwvtepConnectionInstance key; - protected Set, InstanceIdentifier>> addedKeys = new HashSet<>(); - protected Set, InstanceIdentifier>> deletedKeys = new HashSet<>(); + protected Set>, InstanceIdentifier>> addedKeys = new HashSet<>(); + protected Set>, InstanceIdentifier>> deletedKeys = new HashSet<>(); protected HwvtepDeviceInfo deviceInfo; @@ -69,11 +69,11 @@ public abstract class AbstractTransactionCommand implement deviceInfo.addToDeviceUpdate(transactionType, element); } - public void clearDeviceOpUUID(Class cls, InstanceIdentifier iid, UUID uuid) { + public void clearDeviceOpUUID(Class> cls, InstanceIdentifier iid, UUID uuid) { deviceInfo.clearDeviceOperUUID(cls, iid, uuid); } - public void addToDeleteTx(ReadWriteTransaction tx, Class cls, InstanceIdentifier iid, + public void addToDeleteTx(ReadWriteTransaction tx, Class> cls, InstanceIdentifier iid, UUID uuid) { if (deviceInfo.isAvailableInOperDs(cls, iid)) { tx.delete(LogicalDatastoreType.OPERATIONAL, iid); @@ -82,7 +82,7 @@ public abstract class AbstractTransactionCommand implement clearDeviceOpUUID(cls, iid, uuid); } - public void addToUpdateTx(Class cls, InstanceIdentifier iid, UUID uuid, + public void addToUpdateTx(Class> cls, InstanceIdentifier iid, UUID uuid, Object southboundData) { addedKeys.add(Pair.of(cls, iid)); deviceInfo.updateDeviceOperData(cls, iid, uuid, southboundData); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepGlobalRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepGlobalRemoveCommand.java index 27d8e8a6b..6458ca5b4 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepGlobalRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepGlobalRemoveCommand.java @@ -23,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Switches; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.SwitchesKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,8 +59,8 @@ public class HwvtepGlobalRemoveCommand extends AbstractTransactionCommand { if (switches != null) { for (Switches hwSwitch : switches.values()) { LOG.debug("Deleting hwvtep switch {}", hwSwitch); - transaction.delete( - LogicalDatastoreType.OPERATIONAL, hwSwitch.getSwitchRef().getValue()); + transaction.delete(LogicalDatastoreType.OPERATIONAL, + (DataObjectIdentifier) hwSwitch.getSwitchRef().getValue()); } } else { LOG.debug("{} had no switches", hwvtepNode.getNodeId().getValue()); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterUpdateCommand.java index 2653419bd..7254ba50e 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterUpdateCommand.java @@ -49,8 +49,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.SwitchBindingsBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -139,7 +139,7 @@ public final class HwvtepLogicalRouterUpdateCommand extends AbstractTransactionC if (acl != null) { InstanceIdentifier aclIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), acl); - aclBindingBuiler.setAclRef(new HwvtepAclRef(aclIid)); + aclBindingBuiler.setAclRef(new HwvtepAclRef(aclIid.toIdentifier())); aclBindingBuiler.setRouterInterface(new IpPrefix(new Ipv4Prefix(entry.getKey()))); bindings.add(aclBindingBuiler.build()); } @@ -165,7 +165,7 @@ public final class HwvtepLogicalRouterUpdateCommand extends AbstractTransactionC switchBindingBuiler.setDestinationAddress(new IpPrefix(new Ipv4Prefix(entry.getKey()))); InstanceIdentifier switchIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), logicalSwitch); - switchBindingBuiler.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid)); + switchBindingBuiler.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid.toIdentifier())); bindings.add(switchBindingBuiler.build()); } } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalSwitchUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalSwitchUpdateCommand.java index b3a56ac36..3f0e8fee3 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalSwitchUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalSwitchUpdateCommand.java @@ -31,8 +31,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMacEntriesRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMacEntriesRemoveCommand.java index 65831b774..d4c465108 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMacEntriesRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMacEntriesRemoveCommand.java @@ -136,7 +136,7 @@ public class HwvtepMacEntriesRemoveCommand extends AbstractTransactionCommand { if (logicalSwitch != null) { InstanceIdentifier switchIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), logicalSwitch); - return new HwvtepLogicalSwitchRef(switchIid); + return new HwvtepLogicalSwitchRef(switchIid.toIdentifier()); } LOG.debug("Failed to get LogicalSwitch {}", switchUUID); LOG.trace("Available LogicalSwitches: {}", diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepManagerUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepManagerUpdateCommand.java index c91d2edac..ef8c52a95 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepManagerUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepManagerUpdateCommand.java @@ -30,8 +30,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.managers.ManagerOtherConfigsKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMcastMacsLocalUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMcastMacsLocalUpdateCommand.java index c9e99065e..29d0f2df3 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMcastMacsLocalUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMcastMacsLocalUpdateCommand.java @@ -103,7 +103,7 @@ public final class HwvtepMcastMacsLocalUpdateCommand extends AbstractTransaction if (logicalSwitch != null) { InstanceIdentifier switchIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), logicalSwitch); - macLocalBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid)); + macLocalBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid.toIdentifier())); } } } @@ -130,7 +130,7 @@ public final class HwvtepMcastMacsLocalUpdateCommand extends AbstractTransaction InstanceIdentifier tpIid = HwvtepSouthboundMapper.createInstanceIdentifier( getOvsdbConnectionInstance().getInstanceIdentifier(), locator); plsList.add(new LocatorSetBuilder() - .setLocatorRef(new HwvtepPhysicalLocatorRef(tpIid)).build()); + .setLocatorRef(new HwvtepPhysicalLocatorRef(tpIid.toIdentifier())).build()); } macLocalBuilder.setLocatorSet(plsList); } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMcastMacsRemoteUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMcastMacsRemoteUpdateCommand.java index f0508cc42..b96095178 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMcastMacsRemoteUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepMcastMacsRemoteUpdateCommand.java @@ -105,7 +105,7 @@ public final class HwvtepMcastMacsRemoteUpdateCommand extends AbstractTransactio if (logicalSwitch != null) { InstanceIdentifier switchIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), logicalSwitch); - macRemoteBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid)); + macRemoteBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid.toIdentifier())); } } } @@ -132,7 +132,7 @@ public final class HwvtepMcastMacsRemoteUpdateCommand extends AbstractTransactio InstanceIdentifier tpIid = HwvtepSouthboundMapper.createInstanceIdentifier( getOvsdbConnectionInstance().getInstanceIdentifier(), locator); plsList.add(new LocatorSetBuilder() - .setLocatorRef(new HwvtepPhysicalLocatorRef(tpIid)).build()); + .setLocatorRef(new HwvtepPhysicalLocatorRef(tpIid.toIdentifier())).build()); } macRemoteBuilder.setLocatorSet(plsList); } diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalPortUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalPortUpdateCommand.java index 0f359814c..0f302ee02 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalPortUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalPortUpdateCommand.java @@ -59,16 +59,17 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.Uint16; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class HwvtepPhysicalPortUpdateCommand extends AbstractTransactionCommand { - private static final Logger LOG = LoggerFactory.getLogger(HwvtepPhysicalPortUpdateCommand.class); + private final Map updatedPPRows; private final Map oldPPRows; private final Map switchUpdatedRows; @@ -276,7 +277,7 @@ public final class HwvtepPhysicalPortUpdateCommand extends AbstractTransactionCo if (logicalSwitch != null) { InstanceIdentifier switchIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), logicalSwitch); - return new HwvtepLogicalSwitchRef(switchIid); + return new HwvtepLogicalSwitchRef(switchIid.toIdentifier()); } LOG.debug("Failed to get LogicalSwitch {}", switchUUID); LOG.trace("Available LogicalSwitches: {}", @@ -302,11 +303,12 @@ public final class HwvtepPhysicalPortUpdateCommand extends AbstractTransactionCo for (Switches managedNodeEntry : switchNodes.values()) { @SuppressWarnings("unchecked") Node switchNode = HwvtepSouthboundUtil.readNode(transaction, - (InstanceIdentifier) managedNodeEntry.getSwitchRef().getValue()).orElseThrow(); + ((DataObjectIdentifier) managedNodeEntry.getSwitchRef().getValue()).toLegacy()).orElseThrow(); TerminationPointKey tpKey = new TerminationPointKey(new TpId(tpName)); TerminationPoint terminationPoint = switchNode.nonnullTerminationPoint().get(tpKey); if (terminationPoint != null) { - return Optional.of((InstanceIdentifier) managedNodeEntry.getSwitchRef().getValue()); + return Optional.of( + ((DataObjectIdentifier) managedNodeEntry.getSwitchRef().getValue()).toLegacy()); } } } else { diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalSwitchRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalSwitchRemoveCommand.java index ee616d1eb..b7365f31c 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalSwitchRemoveCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalSwitchRemoveCommand.java @@ -45,7 +45,7 @@ public class HwvtepPhysicalSwitchRemoveCommand extends AbstractTransactionComman getOvsdbConnectionInstance(), phySwitch); InstanceIdentifier switchIid = getOvsdbConnectionInstance().getInstanceIdentifier() .augmentation(HwvtepGlobalAugmentation.class) - .child(Switches.class, new SwitchesKey(new HwvtepPhysicalSwitchRef(nodeIid))); + .child(Switches.class, new SwitchesKey(new HwvtepPhysicalSwitchRef(nodeIid.toIdentifier()))); // TODO handle removal of reference to managed switch from model transaction.delete(LogicalDatastoreType.OPERATIONAL, nodeIid); transaction.delete(LogicalDatastoreType.OPERATIONAL, switchIid); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalSwitchUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalSwitchUpdateCommand.java index 0478beb68..c2d1c8be5 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalSwitchUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepPhysicalSwitchUpdateCommand.java @@ -52,9 +52,9 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -176,7 +176,7 @@ public final class HwvtepPhysicalSwitchUpdateCommand extends AbstractTransaction private void setManagedBy(PhysicalSwitchAugmentationBuilder psAugmentationBuilder) { InstanceIdentifier connectionNodePath = getOvsdbConnectionInstance().getInstanceIdentifier(); - psAugmentationBuilder.setManagedBy(new HwvtepGlobalRef(connectionNodePath)); + psAugmentationBuilder.setManagedBy(new HwvtepGlobalRef(connectionNodePath.toIdentifier())); } private static void setPhysicalSwitchId(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, @@ -209,7 +209,9 @@ public final class HwvtepPhysicalSwitchUpdateCommand extends AbstractTransaction InstanceIdentifier switchIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), phySwitch); - Switches physicalSwitch = new SwitchesBuilder().setSwitchRef(new HwvtepPhysicalSwitchRef(switchIid)).build(); + Switches physicalSwitch = new SwitchesBuilder() + .setSwitchRef(new HwvtepPhysicalSwitchRef(switchIid.toIdentifier())) + .build(); connectionNode.addAugmentation(new HwvtepGlobalAugmentationBuilder() .setSwitches(Map.of(physicalSwitch.key(), physicalSwitch)) diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepTunnelUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepTunnelUpdateCommand.java index 45bd770d2..ef27e3fbd 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepTunnelUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepTunnelUpdateCommand.java @@ -33,8 +33,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdStatusBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -85,9 +85,9 @@ public final class HwvtepTunnelUpdateCommand extends AbstractTransactionCommand if (connection.isPresent() && tunnelIid != null) { TunnelsBuilder builder = new TunnelsBuilder(); builder.setLocalLocatorRef(new HwvtepPhysicalLocatorRef(getPhysicalLocatorRefFromUUID( - getOvsdbConnectionInstance().getInstanceIdentifier(), localData))); + getOvsdbConnectionInstance().getInstanceIdentifier().toLegacy(), localData).toIdentifier())); builder.setRemoteLocatorRef(new HwvtepPhysicalLocatorRef(getPhysicalLocatorRefFromUUID( - getOvsdbConnectionInstance().getInstanceIdentifier(), remoteData))); + getOvsdbConnectionInstance().getInstanceIdentifier().toLegacy(), remoteData).toIdentifier())); builder.setTunnelUuid(new Uuid(tunnel.getUuid().toString())); setBfdLocalConfigs(builder, tunnel); setBfdRemoteConfigs(builder, tunnel); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepUcastMacsLocalUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepUcastMacsLocalUpdateCommand.java index f0c7478d1..be5adee02 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepUcastMacsLocalUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepUcastMacsLocalUpdateCommand.java @@ -34,8 +34,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -94,7 +94,7 @@ public final class HwvtepUcastMacsLocalUpdateCommand extends AbstractTransaction InstanceIdentifier nodeIid = getOvsdbConnectionInstance().getInstanceIdentifier(); InstanceIdentifier plIid = HwvtepSouthboundMapper.createInstanceIdentifier(nodeIid, physicalLocator); - ucmlBuilder.setLocatorRef(new HwvtepPhysicalLocatorRef(plIid)); + ucmlBuilder.setLocatorRef(new HwvtepPhysicalLocatorRef(plIid.toIdentifier())); } } if (ucml.getLogicalSwitchColumn() != null && ucml.getLogicalSwitchColumn().getData() != null) { @@ -103,7 +103,7 @@ public final class HwvtepUcastMacsLocalUpdateCommand extends AbstractTransaction if (logicalSwitch != null) { InstanceIdentifier switchIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), logicalSwitch); - ucmlBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid)); + ucmlBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid.toIdentifier())); } } LocalUcastMacs ucastMacsLocal = ucmlBuilder.build(); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepUcastMacsRemoteUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepUcastMacsRemoteUpdateCommand.java index c41afaa27..f5c656ffb 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepUcastMacsRemoteUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepUcastMacsRemoteUpdateCommand.java @@ -33,8 +33,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; public final class HwvtepUcastMacsRemoteUpdateCommand extends AbstractTransactionCommand { @@ -88,7 +88,7 @@ public final class HwvtepUcastMacsRemoteUpdateCommand extends AbstractTransactio InstanceIdentifier nodeIid = getOvsdbConnectionInstance().getInstanceIdentifier(); InstanceIdentifier plIid = HwvtepSouthboundMapper.createInstanceIdentifier(nodeIid, physicalLocator); - rumBuilder.setLocatorRef(new HwvtepPhysicalLocatorRef(plIid)); + rumBuilder.setLocatorRef(new HwvtepPhysicalLocatorRef(plIid.toIdentifier())); } } if (macRemote.getLogicalSwitchColumn() != null @@ -98,7 +98,7 @@ public final class HwvtepUcastMacsRemoteUpdateCommand extends AbstractTransactio if (logicalSwitch != null) { InstanceIdentifier switchIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), logicalSwitch); - rumBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid)); + rumBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(switchIid.toIdentifier())); } } RemoteUcastMacs remoteUcastMacs = rumBuilder.build(); diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java index 7472fdfd0..280fa320c 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/DataChangeListenerTestBase.java @@ -66,7 +66,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java index e65280111..048f1ba00 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepDataChangeListenerTest.java @@ -36,7 +36,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSet; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepOperationalDataChangeListener.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepOperationalDataChangeListener.java index 33e765cc0..4a2761dcc 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepOperationalDataChangeListener.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepOperationalDataChangeListener.java @@ -24,11 +24,11 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.ChildOf; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.concepts.Registration; -import org.opendaylight.yangtools.yang.binding.ChildOf; -import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; public class HwvtepOperationalDataChangeListener implements DataTreeChangeListener, AutoCloseable { private final Registration registration; @@ -71,7 +71,7 @@ public class HwvtepOperationalDataChangeListener implements DataTreeChangeListen } private void updateDeviceOpData(InstanceIdentifier key, DataObjectModification mod) { - Class childClass = (Class) mod.dataType(); + Class> childClass = (Class>) mod.dataType(); InstanceIdentifier instanceIdentifier = getKey(key, mod, mod.dataAfter()); switch (mod.modificationType()) { case WRITE: diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/TestBuilders.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/TestBuilders.java index 5886ef7f7..ff7f9135b 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/TestBuilders.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/TestBuilders.java @@ -36,8 +36,8 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; public final class TestBuilders { @@ -75,7 +75,7 @@ public final class TestBuilders { String logicalSwitchName) { InstanceIdentifier switchIid = nodeIid.augmentation(HwvtepGlobalAugmentation.class) .child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName(logicalSwitchName))); - return new HwvtepLogicalSwitchRef(switchIid); + return new HwvtepLogicalSwitchRef(switchIid.toIdentifier()); } public static RemoteUcastMacs buildRemoteUcastMacs(InstanceIdentifier nodeIid, String vmMac, @@ -138,7 +138,7 @@ public final class TestBuilders { public static HwvtepPhysicalLocatorRef buildLocatorRef(InstanceIdentifier nodeIid,String tepIp) { InstanceIdentifier tepId = buildTpId(nodeIid, tepIp); - return new HwvtepPhysicalLocatorRef(tepId); + return new HwvtepPhysicalLocatorRef(tepId.toIdentifier()); } public static Uuid getUUid(String key) { diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueueTest.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueueTest.java index 49602158e..806dac17d 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueueTest.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/DependencyQueueTest.java @@ -27,8 +27,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; @RunWith(MockitoJUnitRunner.Silent.class) public class DependencyQueueTest extends DataChangeListenerTestBase { @@ -43,7 +43,7 @@ public class DependencyQueueTest extends DataChangeListenerTestBase { RemoteMcastMacs mac; InstanceIdentifier macIid; InstanceIdentifier lsIid; - Map, List> unMetDependencies; + Map>, List> unMetDependencies; void setupForTest() throws Exception { mcastMacDataValidator = McastMacsRemoteUpdateCommand.MCAST_MAC_DATA_VALIDATOR; diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UnMetDependencyGetterTest.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UnMetDependencyGetterTest.java index b6b475e6e..0ea695f79 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UnMetDependencyGetterTest.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UnMetDependencyGetterTest.java @@ -24,8 +24,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; +import org.opendaylight.yangtools.binding.EntryObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.KeyAware; @RunWith(MockitoJUnitRunner.Silent.class) public class UnMetDependencyGetterTest extends DataChangeListenerTestBase { @@ -34,7 +34,7 @@ public class UnMetDependencyGetterTest extends DataChangeListenerTestBase { HwvtepOperationalState opState; RemoteMcastMacs mac; InstanceIdentifier lsIid; - Map, List> unMetDependencies; + Map>, List> unMetDependencies; void setupForTest() { mcastMacDataValidator = McastMacsRemoteUpdateCommand.MCAST_MAC_DATA_VALIDATOR; diff --git a/hwvtepsouthbound/hwvtepsouthbound-it/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/it/HwvtepSouthboundIT.java b/hwvtepsouthbound/hwvtepsouthbound-it/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/it/HwvtepSouthboundIT.java index 12de98e3e..a30964859 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-it/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/it/HwvtepSouthboundIT.java +++ b/hwvtepsouthbound/hwvtepsouthbound-it/src/test/java/org/opendaylight/ovsdb/hwvtepsouthbound/it/HwvtepSouthboundIT.java @@ -423,7 +423,7 @@ public class HwvtepSouthboundIT extends AbstractMdsalTestBase { } if (setManagedBy) { InstanceIdentifier nodePath = HwvtepSouthboundUtils.createInstanceIdentifier(connectionInfo); - psAugBuilder.setManagedBy(new HwvtepGlobalRef(nodePath)); + psAugBuilder.setManagedBy(new HwvtepGlobalRef(nodePath.toIdentifier())); } psAugBuilder.setManagementIps(managementIps); psAugBuilder.setTunnelIps(tunnelIps); diff --git a/hwvtepsouthbound/hwvtepsouthbound-karaf/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-karaf/pom.xml index 0b62ed060..c96a4595f 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-karaf/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-karaf/pom.xml @@ -9,7 +9,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL org.opendaylight.odlparent karaf4-parent - 13.0.11 + 14.0.2 4.0.0 diff --git a/hwvtepsouthbound/pom.xml b/hwvtepsouthbound/pom.xml index 1409433d3..12c19f4b5 100644 --- a/hwvtepsouthbound/pom.xml +++ b/hwvtepsouthbound/pom.xml @@ -11,7 +11,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/library/artifacts/pom.xml b/library/artifacts/pom.xml index 265a86277..c654e1158 100644 --- a/library/artifacts/pom.xml +++ b/library/artifacts/pom.xml @@ -13,7 +13,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/library/features/features/pom.xml b/library/features/features/pom.xml index af9a810a9..1dd804a54 100644 --- a/library/features/features/pom.xml +++ b/library/features/features/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent feature-repo-parent - 13.0.11 + 14.0.2 diff --git a/library/features/odl-ovsdb-library/pom.xml b/library/features/odl-ovsdb-library/pom.xml index fd145e786..a7534640b 100644 --- a/library/features/odl-ovsdb-library/pom.xml +++ b/library/features/odl-ovsdb-library/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 @@ -41,7 +41,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.aaa odl-aaa-cert - 0.19.3 + 0.20.0 xml features diff --git a/library/features/odl-ovsdb-library/src/main/feature/feature.xml b/library/features/odl-ovsdb-library/src/main/feature/feature.xml index a093b83e5..279cd23da 100644 --- a/library/features/odl-ovsdb-library/src/main/feature/feature.xml +++ b/library/features/odl-ovsdb-library/src/main/feature/feature.xml @@ -8,9 +8,9 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - odl-jackson-2 - odl-netty-4 - odl-aaa-cert + odl-jackson-2 + odl-netty-4 + odl-aaa-cert mvn:org.opendaylight.ovsdb/library/${project.version}/cfg/config diff --git a/library/features/pom.xml b/library/features/pom.xml index d3bd51b0c..9e0cd597b 100644 --- a/library/features/pom.xml +++ b/library/features/pom.xml @@ -11,7 +11,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 org.opendaylight.ovsdb diff --git a/library/karaf/pom.xml b/library/karaf/pom.xml index 773c79310..b56c88b0e 100644 --- a/library/karaf/pom.xml +++ b/library/karaf/pom.xml @@ -9,7 +9,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL org.opendaylight.odlparent karaf4-parent - 13.0.11 + 14.0.2 4.0.0 diff --git a/library/pom.xml b/library/pom.xml index 8a3b6533b..0ea825461 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -11,7 +11,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/pom.xml b/pom.xml index 792d64795..889a6c774 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/schemas/pom.xml b/schemas/pom.xml index 1ef50b9b3..41bfa899b 100644 --- a/schemas/pom.xml +++ b/schemas/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/southbound/pom.xml b/southbound/pom.xml index 89cb69d32..73b0e4560 100644 --- a/southbound/pom.xml +++ b/southbound/pom.xml @@ -10,7 +10,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/southbound/southbound-artifacts/pom.xml b/southbound/southbound-artifacts/pom.xml index c7c054129..67110daaa 100644 --- a/southbound/southbound-artifacts/pom.xml +++ b/southbound/southbound-artifacts/pom.xml @@ -13,7 +13,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/southbound/southbound-features/features/pom.xml b/southbound/southbound-features/features/pom.xml index 7af66361a..a495de2f4 100644 --- a/southbound/southbound-features/features/pom.xml +++ b/southbound/southbound-features/features/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent feature-repo-parent - 13.0.11 + 14.0.2 diff --git a/southbound/southbound-features/odl-ovsdb-southbound-api/pom.xml b/southbound/southbound-features/odl-ovsdb-southbound-api/pom.xml index 0ccfc5a9d..52258d22f 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-api/pom.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-api/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 @@ -29,7 +29,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.mdsal mdsal-artifacts - 13.0.1 + 14.0.1 pom import diff --git a/southbound/southbound-features/odl-ovsdb-southbound-api/src/main/feature/feature.xml b/southbound/southbound-features/odl-ovsdb-southbound-api/src/main/feature/feature.xml index ee246de31..d97782f19 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-api/src/main/feature/feature.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-api/src/main/feature/feature.xml @@ -8,7 +8,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal - odl-mdsal-model-odl-l2-types + odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal + odl-mdsal-model-odl-l2-types diff --git a/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/pom.xml b/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/pom.xml index 10c5f257e..d1ba82d83 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/pom.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 @@ -30,7 +30,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.netconf netconf-artifacts - 7.0.4 + 8.0.0-SNAPSHOT import pom diff --git a/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/src/main/feature/feature.xml b/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/src/main/feature/feature.xml index cacd6d2c4..6b85699da 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/src/main/feature/feature.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/src/main/feature/feature.xml @@ -8,6 +8,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - odl-restconf + odl-restconf diff --git a/southbound/southbound-features/odl-ovsdb-southbound-impl-ui/pom.xml b/southbound/southbound-features/odl-ovsdb-southbound-impl-ui/pom.xml index deb486bdf..86193332a 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-impl-ui/pom.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-impl-ui/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 @@ -30,7 +30,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.netconf netconf-artifacts - 7.0.4 + 8.0.0-SNAPSHOT import pom diff --git a/southbound/southbound-features/odl-ovsdb-southbound-impl-ui/src/main/feature/feature.xml b/southbound/southbound-features/odl-ovsdb-southbound-impl-ui/src/main/feature/feature.xml index c7aac8d3b..3cd248a4f 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-impl-ui/src/main/feature/feature.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-impl-ui/src/main/feature/feature.xml @@ -8,6 +8,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - odl-restconf-openapi + odl-restconf-openapi diff --git a/southbound/southbound-features/odl-ovsdb-southbound-impl/pom.xml b/southbound/southbound-features/odl-ovsdb-southbound-impl/pom.xml index 203b250b2..af5c5eee4 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-impl/pom.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-impl/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 @@ -30,7 +30,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.infrautils infrautils-artifacts - 6.0.6 + 7.0.2 pom import diff --git a/southbound/southbound-features/odl-ovsdb-southbound-impl/src/main/feature/feature.xml b/southbound/southbound-features/odl-ovsdb-southbound-impl/src/main/feature/feature.xml index 34df3df98..9c6171ce8 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-impl/src/main/feature/feature.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-impl/src/main/feature/feature.xml @@ -8,9 +8,9 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - odl-jackson-2 - odl-infrautils-diagstatus - odl-infrautils-ready + odl-jackson-2 + odl-infrautils-diagstatus + odl-infrautils-ready mvn:org.opendaylight.ovsdb/southbound-impl/${project.version}/cfg/config diff --git a/southbound/southbound-features/odl-ovsdb-southbound-test/pom.xml b/southbound/southbound-features/odl-ovsdb-southbound-test/pom.xml index 0a54019a7..04dbb1b39 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-test/pom.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-test/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 diff --git a/southbound/southbound-features/pom.xml b/southbound/southbound-features/pom.xml index 6fb369204..7950d3f75 100644 --- a/southbound/southbound-features/pom.xml +++ b/southbound/southbound-features/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/southbound/southbound-impl/pom.xml b/southbound/southbound-impl/pom.xml index 5a958d04b..494da27e3 100644 --- a/southbound/southbound-impl/pom.xml +++ b/southbound/southbound-impl/pom.xml @@ -29,6 +29,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html + + org.opendaylight.yangtools + binding-data-codec-api + org.opendaylight.yangtools yang-data-util @@ -45,10 +49,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.mdsal mdsal-dom-api - - org.opendaylight.mdsal - mdsal-binding-dom-codec-api - org.opendaylight.mdsal mdsal-eos-binding-api diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/InstanceIdentifierCodec.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/InstanceIdentifierCodec.java index 7398b7781..6d6b9d69d 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/InstanceIdentifierCodec.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/InstanceIdentifierCodec.java @@ -8,8 +8,8 @@ package org.opendaylight.ovsdb.southbound; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.dom.api.DOMSchemaService; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.XMLNamespace; @@ -75,12 +75,12 @@ public class InstanceIdentifierCodec extends AbstractStringInstanceIdentifierCod } public InstanceIdentifier bindingDeserializer(final String iidString) throws DeserializationException { - YangInstanceIdentifier normalizedYangIid = deserialize(iidString); - return bindingNormalizedNodeSerializer.fromYangInstanceIdentifier(normalizedYangIid); + return bindingDeserializer(deserialize(iidString)); } public InstanceIdentifier bindingDeserializer(final YangInstanceIdentifier yangIID) { - return bindingNormalizedNodeSerializer.fromYangInstanceIdentifier(yangIID); + final var ref = bindingNormalizedNodeSerializer.fromYangInstanceIdentifier(yangIID); + return ref != null ? ref.toLegacy() : null; } public InstanceIdentifier bindingDeserializerOrNull(final String iidString) { diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java index 266fdc865..323ca5eb0 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java @@ -58,6 +58,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagedNodeEntry; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagedNodeEntryKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; @@ -507,8 +508,8 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos Map entries = nodeAugmentation.getManagedNodeEntry(); if (entries != null) { for (ManagedNodeEntry managedNode : entries.values()) { - transaction.delete( - LogicalDatastoreType.OPERATIONAL, managedNode.getBridgeRef().getValue()); + transaction.delete(LogicalDatastoreType.OPERATIONAL, + (DataObjectIdentifier) managedNode.getBridgeRef().getValue()); } } else { LOG.debug("{} had no managed nodes", ovsdbNode.getNodeId().getValue()); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListener.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListener.java index b93fde241..a71faea4c 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListener.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListener.java @@ -33,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; @@ -252,7 +253,8 @@ public final class OvsdbDataTreeChangeListener implements DataTreeChangeListener if (bridgeAugmentation != null) { OvsdbNodeRef managedBy = bridgeAugmentation.getManagedBy(); if (managedBy != null) { - client = cm.getConnectionInstance((InstanceIdentifier) managedBy.getValue()); + client = cm.getConnectionInstance( + ((DataObjectIdentifier) managedBy.getValue()).toLegacy()); } } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundMapper.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundMapper.java index 0e2c978c1..0f5e2e03e 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundMapper.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundMapper.java @@ -94,7 +94,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java index f0cb1a006..f5a9b2a0c 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java @@ -29,7 +29,6 @@ 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.binding.api.ReadWriteTransaction; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.mdsal.eos.binding.api.Entity; @@ -45,6 +44,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.osgi.service.component.annotations.Activate; diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java index abf676207..730940efe 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java @@ -31,7 +31,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortExternalIds; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortExternalIdsBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,11 +55,11 @@ public final class SouthboundUtil { try { OvsdbNodeRef ref = mn.getManagedBy(); if (ref != null && ref.getValue() != null) { - FluentFuture> nf; + final FluentFuture> nf; try (ReadTransaction transaction = db.newReadOnlyTransaction()) { @SuppressWarnings("unchecked") // Note: erasure makes this safe in combination with the typecheck below - InstanceIdentifier path = (InstanceIdentifier) ref.getValue(); + final var path = ((DataObjectIdentifier) ref.getValue()); nf = transaction.read(LogicalDatastoreType.OPERATIONAL, path); } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachRemovedCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachRemovedCommand.java index 8c92101a5..d16cc636c 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachRemovedCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachRemovedCommand.java @@ -26,12 +26,13 @@ import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; import org.opendaylight.ovsdb.southbound.SouthboundUtil; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.Autoattach; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.AutoattachKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagedNodeEntry; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.PropertyIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -143,9 +144,13 @@ public class AutoAttachRemovedCommand extends AbstractTransactCommand { final var managedNodes = nodeOptional.orElseThrow() .augmentation(OvsdbNodeAugmentation.class).getManagedNodeEntry(); for (final ManagedNodeEntry managedNode : managedNodes.values()) { - final OvsdbBridgeRef ovsdbBridgeRef = managedNode.getBridgeRef(); - final InstanceIdentifier brIid = ovsdbBridgeRef.getValue() - .firstIdentifierOf(Node.class).augmentation(OvsdbBridgeAugmentation.class); + final var doi = switch (managedNode.getBridgeRef().getValue()) { + case DataObjectIdentifier oi -> oi; + case PropertyIdentifier pi -> pi.container(); + }; + + final var brIid = doi.toLegacy().firstIdentifierOf(Node.class) + .augmentation(OvsdbBridgeAugmentation.class); final Optional optionalBridge = transaction.read(LogicalDatastoreType.OPERATIONAL, brIid).get(); OvsdbBridgeAugmentation bridge = optionalBridge.orElseThrow(); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangeEvent.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangeEvent.java index 2faffc740..f8a0b2d6e 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangeEvent.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangeEvent.java @@ -9,7 +9,7 @@ package org.opendaylight.ovsdb.southbound.ovsdb.transact; import java.util.Map; import java.util.Set; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public interface DataChangeEvent { diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangesManagedByOvsdbNodeEvent.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangesManagedByOvsdbNodeEvent.java index fdb84acc4..8b5347201 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangesManagedByOvsdbNodeEvent.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangesManagedByOvsdbNodeEvent.java @@ -20,7 +20,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class DataChangesManagedByOvsdbNodeEvent implements DataChangeEvent { @@ -123,8 +124,11 @@ public class DataChangesManagedByOvsdbNodeEvent implements DataChangeEvent { Optional bridgeNode = SouthboundUtil.readNode(db.newReadWriteTransaction(),nodeEntryIid); if (bridgeNode.isPresent() && bridgeNode.orElseThrow() instanceof Node node) { OvsdbBridgeAugmentation bridge = node.augmentation(OvsdbBridgeAugmentation.class); - if (bridge != null && bridge.getManagedBy() != null) { - return bridge.getManagedBy().getValue(); + if (bridge != null) { + final var managedBy = bridge.getManagedBy(); + if (managedBy != null && managedBy.getValue() instanceof DataObjectIdentifier doi) { + return doi.toLegacy(); + } } } return null; @@ -144,8 +148,12 @@ public class DataChangesManagedByOvsdbNodeEvent implements DataChangeEvent { if (dataObject != null && dataObject instanceof Node) { Node node = (Node)dataObject; OvsdbBridgeAugmentation bridge = node.augmentation(OvsdbBridgeAugmentation.class); - if (bridge != null && bridge.getManagedBy() != null && bridge.getManagedBy().getValue().equals(this.iid)) { - return bridge.getManagedBy().getValue(); + if (bridge != null) { + final var managedBy = bridge.getManagedBy(); + if (managedBy != null && managedBy.getValue() instanceof DataObjectIdentifier doi + && iid.equals(doi.toLegacy())) { + return iid; + } } } return null; diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java index a9b4bda13..3eda53bf8 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java @@ -35,6 +35,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.qos.entries.QueueList; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.qos.entries.QueueListKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.PropertyIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -134,7 +136,12 @@ public class QosUpdateCommand extends AbstractTransactCommand { } private static String getQueueUuid(final OvsdbQueueRef queueRef, final OvsdbNodeAugmentation operNode) { - QueuesKey queueKey = queueRef.getValue().firstKeyOf(Queues.class); + final var doi = switch (queueRef.getValue()) { + case DataObjectIdentifier oi -> oi; + case PropertyIdentifier pi -> pi.container(); + }; + + QueuesKey queueKey = doi.toLegacy().firstKeyOf(Queues.class); Map queues = operNode.getQueues(); if (queues != null) { Queues queue = queues.get(queueKey); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java index 1404ffcf0..87043b0f7 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java @@ -37,7 +37,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbPortInterfaceAttributes.VlanMode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbQosRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.QosEntries; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.QosEntriesKey; @@ -55,6 +54,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortOtherConfigsKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Trunks; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.PropertyIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; @@ -172,8 +173,12 @@ public class TerminationPointUpdateCommand extends AbstractTransactCommand { // First check if QosEntry is present and use that final var tpQosEntry = terminationPoint.getQosEntry(); if (tpQosEntry != null && !tpQosEntry.isEmpty()) { - OvsdbQosRef qosRef = tpQosEntry.values().iterator().next().getQosRef(); - Uri qosId = qosRef.getValue().firstKeyOf(QosEntries.class).getQosId(); + final var doi = switch (tpQosEntry.values().iterator().next().getQosRef().getValue()) { + case DataObjectIdentifier oi -> oi; + case PropertyIdentifier pi -> pi.container(); + }; + + Uri qosId = doi.toLegacy().firstKeyOf(QosEntries.class).getQosId(); OvsdbNodeAugmentation operNode = getOperNode(state, operBridge); if (operNode != null) { Map entries = operNode.getQosEntries(); @@ -196,7 +201,7 @@ public class TerminationPointUpdateCommand extends AbstractTransactCommand { private static OvsdbNodeAugmentation getOperNode(final BridgeOperationalState state, final OvsdbBridgeAugmentation operBridge) { @SuppressWarnings("unchecked") - InstanceIdentifier iidNode = (InstanceIdentifier)operBridge.getManagedBy().getValue(); + final var iidNode = ((DataObjectIdentifier) operBridge.getManagedBy().getValue()).toLegacy(); OvsdbNodeAugmentation operNode = null; try (ReadTransaction transaction = state.dataBroker().newReadOnlyTransaction()) { Optional nodeOptional = SouthboundUtil.readNode(transaction, iidNode); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtils.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtils.java index bcae24f22..28e9dfc40 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtils.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtils.java @@ -40,12 +40,12 @@ import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; import org.opendaylight.ovsdb.southbound.SouthboundConstants; import org.opendaylight.ovsdb.southbound.SouthboundMapper; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yangtools.yang.binding.ChildOf; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.ChildOf; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.EntryObject; +import org.opendaylight.yangtools.binding.Key; +import org.opendaylight.yangtools.binding.KeyStep; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.Key; -import org.opendaylight.yangtools.yang.binding.KeyAware; -import org.opendaylight.yangtools.yang.binding.KeyStep; // This class needs to be mocked @SuppressWarnings("checkstyle:FinalClass") @@ -338,7 +338,7 @@ public class TransactUtils { * @param child The child modification to include. * @return The extended path. */ - private static & ChildOf, K extends Key, T extends DataObject> + private static & ChildOf, K extends Key, T extends DataObject> InstanceIdentifier extendPath( final InstanceIdentifier path, final DataObjectModification child) { diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/ReconciliationTask.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/ReconciliationTask.java index 4f8db8469..fc4e66e98 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/ReconciliationTask.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/ReconciliationTask.java @@ -11,7 +11,7 @@ import static java.util.Objects.requireNonNull; import org.opendaylight.ovsdb.southbound.OvsdbConnectionManager; import org.opendaylight.ovsdb.southbound.reconciliation.connection.ConnectionReconciliationTask; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTask.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTask.java index 1fe801467..26f8634ec 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTask.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTask.java @@ -41,7 +41,8 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; import org.slf4j.Logger; @@ -182,7 +183,7 @@ public class BridgeConfigReconciliationTask extends ReconciliationTask { InstanceIdentifier ndIid = (InstanceIdentifier) nodeIid; OvsdbBridgeAugmentation bridge = node.augmentation(OvsdbBridgeAugmentation.class); if (bridge != null && bridge.getManagedBy() != null - && bridge.getManagedBy().getValue().equals(ndIid)) { + && ((DataObjectIdentifier) bridge.getManagedBy().getValue()).toLegacy().equals(ndIid)) { brChanges.putAll(extractBridgeConfigurationChanges(node, bridge)); tpChanges.add(node); } else if (node.key().getNodeId().getValue().startsWith( diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/TerminationPointConfigReconciliationTask.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/TerminationPointConfigReconciliationTask.java index 6596065e6..6e6d575c8 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/TerminationPointConfigReconciliationTask.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/TerminationPointConfigReconciliationTask.java @@ -29,7 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortExternalIds; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortExternalIdsKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OpenVSwitchUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OpenVSwitchUpdateCommand.java index 6c1174a62..5aebfdac9 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OpenVSwitchUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OpenVSwitchUpdateCommand.java @@ -49,9 +49,9 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeRemovedCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeRemovedCommand.java index 33403619b..05bf5cb2b 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeRemovedCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeRemovedCommand.java @@ -25,7 +25,6 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class OvsdbBridgeRemovedCommand extends AbstractTransactionCommand { - private final InstanceIdentifierCodec instanceIdentifierCodec; public OvsdbBridgeRemovedCommand(InstanceIdentifierCodec instanceIdentifierCodec, OvsdbConnectionInstance key, @@ -43,12 +42,11 @@ public class OvsdbBridgeRemovedCommand extends AbstractTransactionCommand { SouthboundMapper.createInstanceIdentifier(instanceIdentifierCodec, getOvsdbConnectionInstance(), bridge); InstanceIdentifier mnIid = getOvsdbConnectionInstance().getInstanceIdentifier() - .augmentation(OvsdbNodeAugmentation.class) - .child(ManagedNodeEntry.class, new ManagedNodeEntryKey(new OvsdbBridgeRef(bridgeIid))); + .augmentation(OvsdbNodeAugmentation.class) + .child(ManagedNodeEntry.class, new ManagedNodeEntryKey(new OvsdbBridgeRef(bridgeIid.toIdentifier()))); // TODO handle removal of reference to managed node from model transaction.delete(LogicalDatastoreType.OPERATIONAL, bridgeIid); transaction.delete(LogicalDatastoreType.OPERATIONAL, mnIid); } } - } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommand.java index 5c6ef0d18..e4553a74c 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommand.java @@ -65,9 +65,9 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -218,7 +218,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand { SouthboundMapper.createInstanceIdentifier(instanceIdentifierCodec, getOvsdbConnectionInstance(), bridge); ManagedNodeEntry managedBridge = new ManagedNodeEntryBuilder().setBridgeRef( - new OvsdbBridgeRef(bridgeIid)).build(); + new OvsdbBridgeRef(bridgeIid.toIdentifier())).build(); ovsdbConnectionAugmentationBuilder.setManagedNodeEntry(BindingMap.of(managedBridge)); connectionNode.addAugmentation(ovsdbConnectionAugmentationBuilder.build()); @@ -269,7 +269,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand { private void setManagedBy(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder) { InstanceIdentifier connectionNodePath = getOvsdbConnectionInstance().getInstanceIdentifier(); - ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); + ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath.toIdentifier())); } private static void setDataPathType(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, Bridge bridge) { @@ -382,7 +382,7 @@ public class OvsdbBridgeUpdateCommand extends AbstractTransactionCommand { if (bridgeControllerIpAddress.getIpv4Address().getValue() .equals(networkInterfaceAddress.getHostAddress())) { ovsdbBridgeAugmentationBuilder.setBridgeOpenflowNodeRef( - getOvsdbConnectionInstance().getInstanceIdentifier()); + getOvsdbConnectionInstance().getInstanceIdentifier().toIdentifier()); break networkInterfacesLoop; } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbControllerUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbControllerUpdateCommand.java index dcc1f7575..b0e91133b 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbControllerUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbControllerUpdateCommand.java @@ -37,6 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -149,8 +150,9 @@ public class OvsdbControllerUpdateCommand extends AbstractTransactionCommand { final Map managedNodeEntries = ovsdbNodeAugmentation.getManagedNodeEntry(); for (ManagedNodeEntry managedNodeEntry : managedNodeEntries.values()) { - final InstanceIdentifier bridgeIid = - (InstanceIdentifier) managedNodeEntry.getBridgeRef().getValue(); + @SuppressWarnings("unchecked") + final var bridgeIid = ((DataObjectIdentifier) managedNodeEntry.getBridgeRef().getValue()) + .toLegacy(); final Optional bridgeNode = SouthboundUtil.readNode(transaction, bridgeIid); if (bridgeNode.isPresent()) { bridgeNodes.put(bridgeIid, bridgeNode.orElseThrow()); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbInitialPortUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbInitialPortUpdateCommand.java index 40512ec51..419dc5e6c 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbInitialPortUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbInitialPortUpdateCommand.java @@ -24,8 +24,8 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommand.java index 7d5362f05..d3d3f06eb 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommand.java @@ -24,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagerEntry; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagerEntryKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,8 +53,8 @@ public class OvsdbNodeRemoveCommand extends AbstractTransactionCommand { ovsdbNodeAugmentation.getManagedNodeEntry(); if (entries != null) { for (ManagedNodeEntry managedNode : entries.values()) { - transaction.delete( - LogicalDatastoreType.OPERATIONAL, managedNode.getBridgeRef().getValue()); + transaction.delete(LogicalDatastoreType.OPERATIONAL, + (DataObjectIdentifier) managedNode.getBridgeRef().getValue()); } } else { LOG.debug("{} had no managed nodes", ovsdbNode.getNodeId().getValue()); diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java index 4e2028a75..7f5e6c449 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java @@ -89,8 +89,9 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; @@ -276,15 +277,15 @@ public class OvsdbPortUpdateCommand extends AbstractTransactionCommand { TpId tpId = new TpId(tpName); for (ManagedNodeEntry managedNodeEntry : managedNodes.values()) { - Optional optManagedNode = SouthboundUtil.readNode(transaction, - (InstanceIdentifier)managedNodeEntry.getBridgeRef().getValue()); + final var bridgeIid = ((DataObjectIdentifier) managedNodeEntry.getBridgeRef().getValue()).toLegacy(); + + Optional optManagedNode = SouthboundUtil.readNode(transaction, bridgeIid); if (optManagedNode.isPresent()) { - Node managedNode = optManagedNode.orElseThrow(); - Map tpEntrys = managedNode.getTerminationPoint(); + final var tpEntrys = optManagedNode.orElseThrow().getTerminationPoint(); if (tpEntrys != null) { - TerminationPoint tpEntry = tpEntrys.get(new TerminationPointKey(tpId)); + final var tpEntry = tpEntrys.get(new TerminationPointKey(tpId)); if (tpEntry != null) { - return Optional.of((InstanceIdentifier) managedNodeEntry.getBridgeRef().getValue()); + return Optional.of(bridgeIid); } } } @@ -429,7 +430,7 @@ public class OvsdbPortUpdateCommand extends AbstractTransactionCommand { ovsdbTerminationPointBuilder.setQosEntry( Map.of(SouthboundConstants.PORT_QOS_LIST_KEY, new QosEntryBuilder() .withKey(SouthboundConstants.PORT_QOS_LIST_KEY) - .setQosRef(new OvsdbQosRef(qosIid)) + .setQosRef(new OvsdbQosRef(qosIid.toIdentifier())) .build())); } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQosUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQosUpdateCommand.java index 0cafa8e7a..ae7eed49c 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQosUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQosUpdateCommand.java @@ -46,9 +46,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.qos.entries.QueueListBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.qos.entries.QueueListKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -320,7 +320,7 @@ public class OvsdbQosUpdateCommand extends AbstractTransactionCommand { newQueueList.add( new QueueListBuilder() .setQueueNumber(Uint32.valueOf(queueEntry.getKey())) - .setQueueRef(new OvsdbQueueRef(queueIid)).build()); + .setQueueRef(new OvsdbQueueRef(queueIid.toIdentifier())).build()); } } diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQueueUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQueueUpdateCommand.java index 082bad34b..e64974104 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQueueUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbQueueUpdateCommand.java @@ -37,9 +37,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.queues.QueuesOtherConfigBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.queues.QueuesOtherConfigKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.Uint8; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/InstanceIdentifierCodecTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/InstanceIdentifierCodecTest.java index 6da28076d..5902838d9 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/InstanceIdentifierCodecTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/InstanceIdentifierCodecTest.java @@ -24,8 +24,8 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.dom.api.DOMSchemaService; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.QNameModule; import org.opendaylight.yangtools.yang.common.XMLNamespace; diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundMapperTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundMapperTest.java index 1d98f9ce6..9cdf3e217 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundMapperTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundMapperTest.java @@ -60,8 +60,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.Uint32; public class SouthboundMapperTest { diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java index 5ec9ba117..cd15ee720 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundProviderTest.java @@ -29,7 +29,6 @@ import org.opendaylight.infrautils.diagstatus.DiagStatusService; import org.opendaylight.infrautils.diagstatus.ServiceRegistration; import org.opendaylight.infrautils.ready.testutils.TestSystemReadyMonitor; import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest; -import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.mdsal.eos.binding.api.Entity; @@ -43,6 +42,7 @@ import org.opendaylight.ovsdb.lib.operations.DefaultOperations; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java index 3ab933726..1f72f54d2 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java @@ -25,7 +25,6 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.mockito.stubbing.Answer; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.ReadTransaction; import org.opendaylight.mdsal.binding.api.ReadWriteTransaction; @@ -42,6 +41,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.util.concurrent.FluentFutures; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.powermock.api.mockito.PowerMockito; @@ -66,12 +66,12 @@ public class SouthboundUtilTest { ReadTransaction transaction = mock(ReadTransaction.class); when(db.newReadOnlyTransaction()).thenReturn(transaction); when(mn.getManagedBy()).thenReturn(ref); - when(ref.getValue()).thenAnswer( - (Answer>) invocation -> InstanceIdentifier.create(NetworkTopology.class) + when(ref.getValue()).thenAnswer(invocation -> DataObjectIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)) - .child(Node.class, new NodeKey(new NodeId("testNode")))); + .child(Node.class, new NodeKey(new NodeId("testNode"))) + .build()); FluentFuture> nf = mock(FluentFuture.class); - when(transaction.read(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class))).thenReturn(nf); + when(transaction.read(eq(LogicalDatastoreType.OPERATIONAL), any(DataObjectIdentifier.class))).thenReturn(nf); doNothing().when(transaction).close(); //node, ovsdbNode not null diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangesManagedByOvsdbNodeEventTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangesManagedByOvsdbNodeEventTest.java index 28d488374..aa4f96529 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangesManagedByOvsdbNodeEventTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/DataChangesManagedByOvsdbNodeEventTest.java @@ -24,7 +24,7 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.powermock.reflect.Whitebox; diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommandTest.java index 4d42d438e..44766d410 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommandTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommandTest.java @@ -53,7 +53,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.powermock.api.mockito.PowerMockito; import org.powermock.api.support.membermodification.MemberMatcher; diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtilsTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtilsTest.java index ef9fe638e..e73785ee3 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtilsTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactUtilsTest.java @@ -45,7 +45,7 @@ import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec; import org.opendaylight.ovsdb.southbound.SouthboundMapper; import org.opendaylight.ovsdb.southbound.SouthboundUtil; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTaskTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTaskTest.java index baba20840..856c2b9e1 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTaskTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/reconciliation/configuration/BridgeConfigReconciliationTaskTest.java @@ -49,11 +49,11 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.util.concurrent.FluentFutures; -import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; @RunWith(MockitoJUnitRunner.class) public class BridgeConfigReconciliationTaskTest { @@ -104,7 +104,7 @@ public class BridgeConfigReconciliationTaskTest { return new NodeBuilder() .setNodeId(new NodeId(new Uri(bridgeName))) .addAugmentation(new OvsdbBridgeAugmentationBuilder() - .setManagedBy(new OvsdbNodeRef(iid)) + .setManagedBy(new OvsdbNodeRef(iid.toIdentifier())) .setProtocolEntry(BindingMap.of( new ProtocolEntryBuilder().setProtocol(OvsdbBridgeProtocolOpenflow10.VALUE).build())) .setControllerEntry(BindingMap.of( diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommandTest.java index 80e7adbf0..175e3e534 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommandTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbBridgeUpdateCommandTest.java @@ -74,6 +74,8 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; +import org.opendaylight.yangtools.binding.BindingInstanceIdentifier; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.powermock.api.mockito.PowerMockito; import org.powermock.api.support.membermodification.MemberMatcher; @@ -250,9 +252,10 @@ public class OvsdbBridgeUpdateCommandTest { .thenReturn(bridgeIid); ManagedNodeEntry managedBridge = new ManagedNodeEntryBuilder() - .setBridgeRef(new OvsdbBridgeRef(InstanceIdentifier.create(NetworkTopology.class) + .setBridgeRef(new OvsdbBridgeRef(DataObjectIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(new TopologyId("testTopo"))) - .child(Node.class, new NodeKey(new NodeId("testNode"))))) + .child(Node.class, new NodeKey(new NodeId("testNode"))) + .build())) .build(); ManagedNodeEntryBuilder managedNodeEntryBuilder = mock(ManagedNodeEntryBuilder.class); @@ -478,11 +481,11 @@ public class OvsdbBridgeUpdateCommandTest { .child(Node.class, new NodeKey(new NodeId("testNode")))); OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder = mock(OvsdbBridgeAugmentationBuilder.class); Bridge bridge = mock(Bridge.class); - when(ovsdbBridgeAugmentationBuilder.setBridgeOpenflowNodeRef(any(InstanceIdentifier.class))) + when(ovsdbBridgeAugmentationBuilder.setBridgeOpenflowNodeRef(any(BindingInstanceIdentifier.class))) .thenReturn(ovsdbBridgeAugmentationBuilder); Whitebox.invokeMethod(ovsdbBridgeUpdateCommand, "setOpenFlowNodeRef", ovsdbBridgeAugmentationBuilder, bridge); verify(controllerEntry, times(2)).getIsConnected(); - verify(ovsdbBridgeAugmentationBuilder).setBridgeOpenflowNodeRef(any(InstanceIdentifier.class)); + verify(ovsdbBridgeAugmentationBuilder).setBridgeOpenflowNodeRef(any(BindingInstanceIdentifier.class)); } } diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbControllerUpdateCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbControllerUpdateCommandTest.java index d18bb50a2..68a11d391 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbControllerUpdateCommandTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbControllerUpdateCommandTest.java @@ -181,7 +181,7 @@ public class OvsdbControllerUpdateCommandTest { .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)) .child(Node.class, new NodeKey(new NodeId("testBridge"))); ManagedNodeEntry managedNodeEntry = new ManagedNodeEntryBuilder() - .setBridgeRef(new OvsdbBridgeRef(bridgeIid)) + .setBridgeRef(new OvsdbBridgeRef(bridgeIid.toIdentifier())) .build(); when(ovsdbNodeAugmentation.getManagedNodeEntry()).thenReturn(Map.of(managedNodeEntry.key(), managedNodeEntry)); @@ -201,11 +201,9 @@ public class OvsdbControllerUpdateCommandTest { ControllerEntry controllerEntry = mock(ControllerEntry.class); OvsdbConnectionInstance client = mock(OvsdbConnectionInstance.class); when(ovsdbControllerUpdateCommand.getOvsdbConnectionInstance()).thenReturn(client); - NodeKey nodeKey = mock(NodeKey.class); + NodeId nodeId = new NodeId(NODE_ID); + NodeKey nodeKey = new NodeKey(nodeId); when(client.getNodeKey()).thenReturn(nodeKey); - NodeId nodeId = mock(NodeId.class); - when(nodeKey.getNodeId()).thenReturn(nodeId); - when(nodeId.getValue()).thenReturn(NODE_ID); PowerMockito.whenNew(Uri.class).withAnyArguments().thenReturn(mock(Uri.class)); PowerMockito.whenNew(NodeId.class).withAnyArguments().thenReturn(nodeId); PowerMockito.whenNew(NodeKey.class).withAnyArguments().thenReturn(nodeKey); diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommandTest.java index 056327525..1970523ca 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommandTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommandTest.java @@ -45,6 +45,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.Uint32; import org.powermock.reflect.Whitebox; @@ -95,9 +96,10 @@ public class OvsdbNodeRemoveCommandTest { doReturn(true).when(ovsdbNodeRemoveCommand).checkIfOnlyConnectedManager(any(OvsdbNodeAugmentation.class)); ManagedNodeEntry managedNode = new ManagedNodeEntryBuilder() - .setBridgeRef(new OvsdbBridgeRef(InstanceIdentifier.create(NetworkTopology.class) + .setBridgeRef(new OvsdbBridgeRef(DataObjectIdentifier.builder(NetworkTopology.class) .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID)) - .child(Node.class, new NodeKey(new NodeId("testBridge"))))) + .child(Node.class, new NodeKey(new NodeId("testBridge"))) + .build())) .build(); when(ovsdbNodeAugmentation.getManagedNodeEntry()).thenReturn(Map.of(managedNode.key(), managedNode)); diff --git a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommandTest.java b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommandTest.java index e8f06ceca..5b4d6b7e8 100644 --- a/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommandTest.java +++ b/southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommandTest.java @@ -340,7 +340,7 @@ public class OvsdbPortUpdateCommandTest { .child(Node.class, new NodeKey(new NodeId("testNode"))); ManagedNodeEntry managedNodeEntry = new ManagedNodeEntryBuilder() - .setBridgeRef(new OvsdbBridgeRef(iidNode)) + .setBridgeRef(new OvsdbBridgeRef(iidNode.toIdentifier())) .build(); when(ovsdbNode.nonnullManagedNodeEntry()).thenCallRealMethod(); when(ovsdbNode.getManagedNodeEntry()).thenReturn(Map.of(managedNodeEntry.key(), managedNodeEntry)); diff --git a/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java b/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java index 9dc4e7a9d..3fd72a3dd 100644 --- a/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java +++ b/southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java @@ -159,12 +159,13 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.EntryObject; +import org.opendaylight.yangtools.binding.Key; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.Key; -import org.opendaylight.yangtools.yang.binding.KeyAware; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; import org.opendaylight.yangtools.yang.common.Uint8; @@ -252,7 +253,8 @@ public class SouthboundIT extends AbstractMdsalTestBase { if (obj instanceof ManagedNodeEntry managedNodeEntry) { LOG.info("{} DataChanged: created managed {}", managedNodeEntry.getBridgeRef().getValue()); - createdIids.add(managedNodeEntry.getBridgeRef().getValue()); + createdIids.add(((DataObjectIdentifier) managedNodeEntry.getBridgeRef().getValue()) + .toLegacy()); } } else { LOG.info("{} DataTreeChanged: updated {}", type, identifier); @@ -782,7 +784,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { private static void setManagedBy(final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, final ConnectionInfo connectionInfo) { InstanceIdentifier connectionNodePath = SouthboundUtils.createInstanceIdentifier(connectionInfo); - ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); + ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath.toIdentifier())); } private static Map createMdsalProtocols() { @@ -1444,7 +1446,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private static , T extends KeyAware> void assertExpectedExist( + private static , T extends EntryObject> void assertExpectedExist( final Map expected, final Map test) { if (expected != null && test != null) { for (T exp : expected.values()) { @@ -1453,7 +1455,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private interface SouthboundTerminationPointHelper, T extends KeyAware> { + private interface SouthboundTerminationPointHelper, T extends EntryObject> { void writeValues(OvsdbTerminationPointAugmentationBuilder builder, Map values); Map readValues(OvsdbTerminationPointAugmentation augmentation); @@ -1464,7 +1466,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { * * @see SouthboundIT.generatePortExternalIdsTestCases() for specific test case information */ - private static , T extends KeyAware> void testCRUDTerminationPoint( + private static , T extends EntryObject> void testCRUDTerminationPoint( final KeyValueBuilder builder, final String prefix, final SouthboundTerminationPointHelper helper) throws InterruptedException { final int terminationPointTestIndex = 0; @@ -2015,13 +2017,13 @@ public class SouthboundIT extends AbstractMdsalTestBase { new BridgeOtherConfigsSouthboundHelper()); } - private interface SouthboundBridgeHelper, T extends KeyAware> { + private interface SouthboundBridgeHelper, T extends EntryObject> { void writeValues(OvsdbBridgeAugmentationBuilder builder, Map values); Map readValues(OvsdbBridgeAugmentation augmentation); } - private static , T extends KeyAware> void testCRUDBridge(final String prefix, + private static , T extends EntryObject> void testCRUDBridge(final String prefix, final KeyValueBuilder builder, final SouthboundBridgeHelper helper) throws InterruptedException { ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber); // updateFromTestCases represent the original test case value. updateToTestCases represent the new value after @@ -2171,7 +2173,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private interface SouthboundQueueHelper, T extends KeyAware> { + private interface SouthboundQueueHelper, T extends EntryObject> { void writeValues(QueuesBuilder builder, Map values); Map readValues(Queues queue); @@ -2212,7 +2214,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } } - private interface SouthboundQosHelper, T extends KeyAware> { + private interface SouthboundQosHelper, T extends EntryObject> { void writeValues(QosEntriesBuilder builder, Map values); Map readValues(QosEntries qos); @@ -2227,7 +2229,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { return null; } - private static , T extends KeyAware> void testCRUDQueue( + private static , T extends EntryObject> void testCRUDQueue( final KeyValueBuilder builder, final String prefix, final SouthboundQueueHelper helper) throws InterruptedException { @@ -2359,7 +2361,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { } - private static , T extends KeyAware> void testCRUDQos( + private static , T extends EntryObject> void testCRUDQos( final KeyValueBuilder builder, final String prefix, final SouthboundQosHelper helper) throws InterruptedException { @@ -2485,12 +2487,12 @@ public class SouthboundIT extends AbstractMdsalTestBase { assertNotNull(operQueue1); InstanceIdentifier queue1Iid = testQueue1.getInstanceIdentifier(); - OvsdbQueueRef queue1Ref = new OvsdbQueueRef(queue1Iid); + OvsdbQueueRef queue1Ref = new OvsdbQueueRef(queue1Iid.toIdentifier()); Queues operQueue2 = getQueue(new Uri("queue2"), ovsdbNodeAugmentation); assertNotNull(operQueue2); InstanceIdentifier queue2Iid = testQueue2.getInstanceIdentifier(); - OvsdbQueueRef queue2Ref = new OvsdbQueueRef(queue2Iid); + OvsdbQueueRef queue2Ref = new OvsdbQueueRef(queue2Iid.toIdentifier()); Map queueList = BindingMap.of( new QueueListBuilder().setQueueNumber(Uint32.ONE).setQueueRef(queue1Ref).build(), @@ -2579,7 +2581,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { * * @param The type of data used for the test case. */ - private static final class SouthboundTestCase, T extends KeyAware> { + private static final class SouthboundTestCase, T extends EntryObject> { private final String name; private final Map inputValues; private final Map expectedValues; @@ -2603,7 +2605,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { * * @param The type of data used for the test case. */ - private static final class SouthboundTestCaseBuilder, T extends KeyAware> { + private static final class SouthboundTestCaseBuilder, T extends EntryObject> { private String name; private List inputValues; private List expectedValues; @@ -2872,7 +2874,7 @@ public class SouthboundIT extends AbstractMdsalTestBase { * Generates the test cases involved in testing key-value-based data. See inline comments for descriptions of * the particular cases considered. */ - private static , T extends KeyAware> List> + private static , T extends EntryObject> List> generateKeyValueTestCases(final KeyValueBuilder builder, final String testName) { List> testCases = new ArrayList<>(); diff --git a/southbound/southbound-karaf/pom.xml b/southbound/southbound-karaf/pom.xml index 3e2b197bc..73bfaf331 100644 --- a/southbound/southbound-karaf/pom.xml +++ b/southbound/southbound-karaf/pom.xml @@ -9,7 +9,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL org.opendaylight.odlparent karaf4-parent - 13.0.11 + 14.0.2 4.0.0 diff --git a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalObject.java b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalObject.java index 3d1caff65..719bfae1f 100644 --- a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalObject.java +++ b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalObject.java @@ -5,10 +5,9 @@ * 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.ovsdb.utils.mdsal.utils; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class MdsalObject { diff --git a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtils.java b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtils.java index c512f61fa..4b21e50b4 100644 --- a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtils.java +++ b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtils.java @@ -15,7 +15,7 @@ import org.opendaylight.mdsal.binding.api.ReadTransaction; import org.opendaylight.mdsal.binding.api.WriteTransaction; import org.opendaylight.mdsal.common.api.CommitInfo; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsAsync.java b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsAsync.java index 91383f1c5..2afe27bff 100644 --- a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsAsync.java +++ b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsAsync.java @@ -5,7 +5,6 @@ * 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.ovsdb.utils.mdsal.utils; import com.google.common.util.concurrent.FluentFuture; @@ -17,14 +16,14 @@ import org.opendaylight.mdsal.binding.api.ReadTransaction; import org.opendaylight.mdsal.binding.api.WriteTransaction; import org.opendaylight.mdsal.common.api.CommitInfo; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MdsalUtilsAsync { - private static final Logger LOG = LoggerFactory.getLogger(MdsalUtilsAsync.class); + private final DataBroker databroker; /** diff --git a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/NotifyingDataChangeListener.java b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/NotifyingDataChangeListener.java index 97b8c0363..56d88e656 100644 --- a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/NotifyingDataChangeListener.java +++ b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/NotifyingDataChangeListener.java @@ -17,8 +17,8 @@ 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; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.concepts.Registration; -import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/TransactionHistory.java b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/TransactionHistory.java index 692e57ae8..6e1fab7eb 100644 --- a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/TransactionHistory.java +++ b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/TransactionHistory.java @@ -5,11 +5,10 @@ * 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.ovsdb.utils.mdsal.utils; import java.util.ArrayList; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class TransactionHistory extends ArrayList { diff --git a/utils/mdsal-utils/src/test/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsAsyncTest.java b/utils/mdsal-utils/src/test/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsAsyncTest.java index 135131628..480cadbe7 100644 --- a/utils/mdsal-utils/src/test/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsAsyncTest.java +++ b/utils/mdsal-utils/src/test/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsAsyncTest.java @@ -37,8 +37,8 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; @RunWith(MockitoJUnitRunner.class) public class MdsalUtilsAsyncTest extends AbstractDataBrokerTest { diff --git a/utils/mdsal-utils/src/test/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsTest.java b/utils/mdsal-utils/src/test/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsTest.java index 238f8d167..33c8fddb7 100644 --- a/utils/mdsal-utils/src/test/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsTest.java +++ b/utils/mdsal-utils/src/test/java/org/opendaylight/ovsdb/utils/mdsal/utils/MdsalUtilsTest.java @@ -27,8 +27,8 @@ import org.opendaylight.mdsal.binding.api.ReadTransaction; import org.opendaylight.mdsal.binding.api.WriteTransaction; import org.opendaylight.mdsal.common.api.CommitInfo; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.yangtools.binding.DataObject; import org.opendaylight.yangtools.util.concurrent.FluentFutures; -import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** diff --git a/utils/odl-ovsdb-utils/pom.xml b/utils/odl-ovsdb-utils/pom.xml index c94b22c20..e10c8c946 100644 --- a/utils/odl-ovsdb-utils/pom.xml +++ b/utils/odl-ovsdb-utils/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent single-feature-parent - 13.0.11 + 14.0.2 @@ -29,7 +29,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.controller controller-artifacts - 9.0.2 + 10.0.1 pom import diff --git a/utils/odl-ovsdb-utils/src/main/feature/feature.xml b/utils/odl-ovsdb-utils/src/main/feature/feature.xml index ae1c184e3..c6210d54d 100644 --- a/utils/odl-ovsdb-utils/src/main/feature/feature.xml +++ b/utils/odl-ovsdb-utils/src/main/feature/feature.xml @@ -8,6 +8,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html --> - odl-mdsal-broker + odl-mdsal-broker diff --git a/utils/pom.xml b/utils/pom.xml index efce0a0ef..0791b9468 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.odlparent odlparent-lite - 13.0.11 + 14.0.2 diff --git a/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java b/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java index c9833bae2..aeaa2ebf0 100644 --- a/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java +++ b/utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java @@ -114,12 +114,14 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey; -import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObject; +import org.opendaylight.yangtools.binding.DataObjectIdentifier; +import org.opendaylight.yangtools.binding.Key; +import org.opendaylight.yangtools.binding.KeyStep; +import org.opendaylight.yangtools.binding.NodeStep; +import org.opendaylight.yangtools.binding.PropertyIdentifier; +import org.opendaylight.yangtools.binding.util.BindingMap; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.Key; -import org.opendaylight.yangtools.yang.binding.KeyStep; -import org.opendaylight.yangtools.yang.binding.NodeStep; -import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; @@ -536,7 +538,7 @@ public class SouthboundUtils { OvsdbBridgeAugmentation bridgeAugmentation = extractBridgeAugmentation(bridgeNode); if (bridgeAugmentation != null) { InstanceIdentifier ovsdbNodeIid = - (InstanceIdentifier) bridgeAugmentation.getManagedBy().getValue(); + ((DataObjectIdentifier) bridgeAugmentation.getManagedBy().getValue()).toLegacy(); ovsdbNode = provider.read(LogicalDatastoreType.OPERATIONAL, ovsdbNodeIid); } else { LOG.debug("readOvsdbNode: Provided node is not a bridge node : {}",bridgeNode); @@ -670,7 +672,7 @@ public class SouthboundUtils { .setProtocolEntry(createMdsalProtocols()) .setFailMode(OVSDB_FAIL_MODE_MAP.inverse().get("secure")) .setBridgeExternalIds(setBridgeExternalIds()) - .setManagedBy(new OvsdbNodeRef(createInstanceIdentifier(ovsdbNode.key().getNodeId()))) + .setManagedBy(new OvsdbNodeRef(createInstanceIdentifier(ovsdbNode.key().getNodeId()).toIdentifier())) // TODO: Currently netvirt relies on this function to set disabled-in-band=true. However, // TODO (cont): a better design would be to have netvirt pass that in. That way this function // TODO (cont): can take a null otherConfigs to erase other_configs. @@ -767,7 +769,7 @@ public class SouthboundUtils { private static void setManagedBy(final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder, final ConnectionInfo connectionInfo) { InstanceIdentifier connectionNodePath = createInstanceIdentifier(connectionInfo); - ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath)); + ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath.toIdentifier())); } public boolean addTerminationPoint( @@ -1030,7 +1032,12 @@ public class SouthboundUtils { // see OVSDB-470 for background private static boolean matchesBridgeName(ManagedNodeEntry managedNode, String bridgeName) { - InstanceIdentifier bridgeIid = managedNode.getBridgeRef().getValue(); + final var iid = switch (managedNode.getBridgeRef().getValue()) { + case DataObjectIdentifier doi -> doi; + case PropertyIdentifier pi -> pi.container(); + }; + + InstanceIdentifier bridgeIid = iid.toLegacy(); for (var bridgeIidPathArg : bridgeIid.getPathArguments()) { if (bridgeIidPathArg instanceof KeyStep identifiableItem) { Key key = identifiableItem.key(); diff --git a/utils/yang-utils/pom.xml b/utils/yang-utils/pom.xml index 35848bfaa..a1548e4b5 100644 --- a/utils/yang-utils/pom.xml +++ b/utils/yang-utils/pom.xml @@ -15,9 +15,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html ../../commons/binding-parent - org.opendaylight.ovsdb utils.yang-utils - 1.19.0-SNAPSHOT bundle @@ -25,8 +23,8 @@ and is available at http://www.eclipse.org/legal/epl-v10.html - org.opendaylight.mdsal - yang-binding + org.opendaylight.yangtools + binding-spec diff --git a/utils/yang-utils/src/main/java/org/opendaylight/ovsdb/utils/yang/YangUtils.java b/utils/yang-utils/src/main/java/org/opendaylight/ovsdb/utils/yang/YangUtils.java index 95ab35439..7425767bf 100644 --- a/utils/yang-utils/src/main/java/org/opendaylight/ovsdb/utils/yang/YangUtils.java +++ b/utils/yang-utils/src/main/java/org/opendaylight/ovsdb/utils/yang/YangUtils.java @@ -14,8 +14,8 @@ import java.util.Map; import java.util.function.Function; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.opendaylight.yangtools.yang.binding.Key; -import org.opendaylight.yangtools.yang.binding.KeyAware; +import org.opendaylight.yangtools.binding.EntryObject; +import org.opendaylight.yangtools.binding.Key; /** * YANG utility functions. @@ -65,7 +65,7 @@ public final class YangUtils { * @param The value type. * @return The map. */ - public static , T extends KeyAware, K, V> + public static , T extends EntryObject, K, V> @NonNull Map copyYangKeyValueListToMap(@NonNull Map map, @Nullable Map yangList, @NonNull Function keyExtractor, @NonNull Function valueExtractor) { @@ -102,7 +102,7 @@ public final class YangUtils { * @param The value type. * @return The map. */ - public static , T extends KeyAware, K, V> @NonNull Map + public static , T extends EntryObject, K, V> @NonNull Map convertYangKeyValueListToMap(@Nullable Map yangList, @NonNull Function keyExtractor, @NonNull Function valueExtractor) { return copyYangKeyValueListToMap(new HashMap<>(), yangList, keyExtractor, valueExtractor); -- 2.43.0 From 4f5fd68bbf432f9a8c20bd6f36284cce3476fd39 Mon Sep 17 00:00:00 2001 From: jenkins-releng Date: Thu, 8 Aug 2024 09:29:42 +0000 Subject: [PATCH 5/5] Release Validate --- commons/binding-parent/pom.xml | 2 +- commons/it/pom.xml | 2 +- commons/pom.xml | 2 +- hwvtepsouthbound/hwvtepsouthbound-api/pom.xml | 4 ++-- hwvtepsouthbound/hwvtepsouthbound-artifacts/pom.xml | 2 +- hwvtepsouthbound/hwvtepsouthbound-features/features/pom.xml | 2 +- .../odl-ovsdb-hwvtepsouthbound-api/pom.xml | 2 +- .../odl-ovsdb-hwvtepsouthbound-rest/pom.xml | 4 ++-- .../odl-ovsdb-hwvtepsouthbound-test/pom.xml | 2 +- .../odl-ovsdb-hwvtepsouthbound-ui/pom.xml | 4 ++-- .../odl-ovsdb-hwvtepsouthbound/pom.xml | 2 +- hwvtepsouthbound/hwvtepsouthbound-features/pom.xml | 2 +- hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml | 2 +- hwvtepsouthbound/hwvtepsouthbound-it/pom.xml | 2 +- hwvtepsouthbound/hwvtepsouthbound-karaf/pom.xml | 2 +- hwvtepsouthbound/pom.xml | 2 +- library/artifacts/pom.xml | 2 +- library/features/features/pom.xml | 2 +- library/features/odl-ovsdb-library/pom.xml | 2 +- library/features/pom.xml | 2 +- library/impl/pom.xml | 4 ++-- library/it/pom.xml | 6 +++--- library/karaf/pom.xml | 2 +- library/pom.xml | 2 +- pom.xml | 2 +- schemas/hardwarevtep/pom.xml | 4 ++-- schemas/openvswitch/pom.xml | 4 ++-- schemas/pom.xml | 2 +- southbound/pom.xml | 2 +- southbound/southbound-api/pom.xml | 4 ++-- southbound/southbound-artifacts/pom.xml | 2 +- southbound/southbound-features/features/pom.xml | 2 +- .../southbound-features/odl-ovsdb-southbound-api/pom.xml | 2 +- .../odl-ovsdb-southbound-impl-rest/pom.xml | 4 ++-- .../odl-ovsdb-southbound-impl-ui/pom.xml | 4 ++-- .../southbound-features/odl-ovsdb-southbound-impl/pom.xml | 2 +- .../southbound-features/odl-ovsdb-southbound-test/pom.xml | 2 +- southbound/southbound-features/pom.xml | 2 +- southbound/southbound-impl/pom.xml | 2 +- southbound/southbound-it/pom.xml | 2 +- southbound/southbound-karaf/pom.xml | 2 +- utils/config/pom.xml | 4 ++-- utils/hwvtepsouthbound-utils/pom.xml | 4 ++-- utils/mdsal-utils/pom.xml | 4 ++-- utils/odl-ovsdb-utils/pom.xml | 2 +- utils/ovsdb-it-utils/pom.xml | 2 +- utils/pom.xml | 2 +- utils/servicehelper/pom.xml | 4 ++-- utils/southbound-utils/pom.xml | 4 ++-- utils/yang-utils/pom.xml | 2 +- 50 files changed, 66 insertions(+), 66 deletions(-) diff --git a/commons/binding-parent/pom.xml b/commons/binding-parent/pom.xml index 9d3c6ab22..4eedb0653 100644 --- a/commons/binding-parent/pom.xml +++ b/commons/binding-parent/pom.xml @@ -17,7 +17,7 @@ org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 pom diff --git a/commons/it/pom.xml b/commons/it/pom.xml index 206402570..4fcee628d 100644 --- a/commons/it/pom.xml +++ b/commons/it/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb it - 1.19.0-SNAPSHOT + 1.19.0 pom diff --git a/commons/pom.xml b/commons/pom.xml index 992a54fef..1c2f6b379 100644 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb parents - 1.19.0-SNAPSHOT + 1.19.0 ODL :: ovsdb :: ${project.artifactId} diff --git a/hwvtepsouthbound/hwvtepsouthbound-api/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-api/pom.xml index 868c73049..5983117e6 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-api/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-api/pom.xml @@ -10,14 +10,14 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent 4.0.0 org.opendaylight.ovsdb hwvtepsouthbound-api - 1.19.0-SNAPSHOT + 1.19.0 bundle diff --git a/hwvtepsouthbound/hwvtepsouthbound-artifacts/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-artifacts/pom.xml index 8705fff79..d37cc487a 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-artifacts/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-artifacts/pom.xml @@ -19,7 +19,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb hwvtepsouthbound-artifacts - 1.19.0-SNAPSHOT + 1.19.0 pom diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/features/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/features/pom.xml index 09de4666a..01962d079 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/features/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/features/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb hwvtepsouthbound-features - 1.19.0-SNAPSHOT + 1.19.0 feature diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/pom.xml index 3fc7ee5cd..b461ce58b 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-api/pom.xml @@ -11,7 +11,7 @@ org.opendaylight.ovsdb odl-ovsdb-hwvtepsouthbound-api - 1.19.0-SNAPSHOT + 1.19.0 feature diff --git a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/pom.xml index f1397c740..ea0000f7f 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-features/odl-ovsdb-hwvtepsouthbound-rest/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb odl-ovsdb-hwvtepsouthbound-rest - 1.19.0-SNAPSHOT + 1.19.0 feature diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml index c94031386..b84d7603c 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent diff --git a/hwvtepsouthbound/hwvtepsouthbound-it/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-it/pom.xml index b50f49bde..e12a261cf 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-it/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-it/pom.xml @@ -11,7 +11,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb it - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/it diff --git a/hwvtepsouthbound/hwvtepsouthbound-karaf/pom.xml b/hwvtepsouthbound/hwvtepsouthbound-karaf/pom.xml index c96a4595f..8167324d2 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-karaf/pom.xml +++ b/hwvtepsouthbound/hwvtepsouthbound-karaf/pom.xml @@ -15,7 +15,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL 4.0.0 org.opendaylight.ovsdb hwvtepsouthbound-karaf - 1.19.0-SNAPSHOT + 1.19.0 pom diff --git a/hwvtepsouthbound/pom.xml b/hwvtepsouthbound/pom.xml index 12c19f4b5..45f219daf 100644 --- a/hwvtepsouthbound/pom.xml +++ b/hwvtepsouthbound/pom.xml @@ -17,7 +17,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL org.opendaylight.ovsdb hwvtepsouthbound-aggregator - 1.19.0-SNAPSHOT + 1.19.0 ODL :: ovsdb :: ${project.artifactId} diff --git a/library/artifacts/pom.xml b/library/artifacts/pom.xml index c654e1158..6c57507db 100644 --- a/library/artifacts/pom.xml +++ b/library/artifacts/pom.xml @@ -19,7 +19,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb library-artifacts - 1.19.0-SNAPSHOT + 1.19.0 pom diff --git a/library/features/features/pom.xml b/library/features/features/pom.xml index 1dd804a54..139dd749a 100644 --- a/library/features/features/pom.xml +++ b/library/features/features/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb library-features - 1.19.0-SNAPSHOT + 1.19.0 feature diff --git a/library/features/odl-ovsdb-library/pom.xml b/library/features/odl-ovsdb-library/pom.xml index a7534640b..b2ac28ee8 100644 --- a/library/features/odl-ovsdb-library/pom.xml +++ b/library/features/odl-ovsdb-library/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb odl-ovsdb-library - 1.19.0-SNAPSHOT + 1.19.0 feature ODL :: ovsdb :: ${project.artifactId} diff --git a/library/impl/pom.xml b/library/impl/pom.xml index ca171e037..2f563bbdb 100644 --- a/library/impl/pom.xml +++ b/library/impl/pom.xml @@ -12,14 +12,14 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent 4.0.0 org.opendaylight.ovsdb library - 1.19.0-SNAPSHOT + 1.19.0 bundle diff --git a/library/it/pom.xml b/library/it/pom.xml index 5c9f7624e..34ea198d6 100644 --- a/library/it/pom.xml +++ b/library/it/pom.xml @@ -11,14 +11,14 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb it - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/it 4.0.0 org.opendaylight.ovsdb library-it - 1.19.0-SNAPSHOT + 1.19.0 jar @@ -27,7 +27,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb library-karaf - 1.19.0-SNAPSHOT + 1.19.0 zip diff --git a/library/karaf/pom.xml b/library/karaf/pom.xml index b56c88b0e..57c6972c7 100644 --- a/library/karaf/pom.xml +++ b/library/karaf/pom.xml @@ -15,7 +15,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL 4.0.0 org.opendaylight.ovsdb library-karaf - 1.19.0-SNAPSHOT + 1.19.0 pom diff --git a/library/pom.xml b/library/pom.xml index 0ea825461..b77dad528 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -17,7 +17,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb library-aggregator - 1.19.0-SNAPSHOT + 1.19.0 ODL :: ovsdb :: ${project.artifactId} diff --git a/pom.xml b/pom.xml index 889a6c774..29b1d74ee 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb - 1.19.0-SNAPSHOT + 1.19.0 ${project.artifactId} pom diff --git a/schemas/hardwarevtep/pom.xml b/schemas/hardwarevtep/pom.xml index 70c118d26..6c808344f 100644 --- a/schemas/hardwarevtep/pom.xml +++ b/schemas/hardwarevtep/pom.xml @@ -12,13 +12,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent org.opendaylight.ovsdb schema.hardwarevtep - 1.19.0-SNAPSHOT + 1.19.0 bundle diff --git a/schemas/openvswitch/pom.xml b/schemas/openvswitch/pom.xml index a2f5f2703..136c9f0f5 100644 --- a/schemas/openvswitch/pom.xml +++ b/schemas/openvswitch/pom.xml @@ -12,13 +12,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent org.opendaylight.ovsdb schema.openvswitch - 1.19.0-SNAPSHOT + 1.19.0 bundle diff --git a/schemas/pom.xml b/schemas/pom.xml index 41bfa899b..9b92bfdab 100644 --- a/schemas/pom.xml +++ b/schemas/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb schemas - 1.19.0-SNAPSHOT + 1.19.0 ODL :: ovsdb :: ${project.artifactId} diff --git a/southbound/pom.xml b/southbound/pom.xml index 73b0e4560..337a8fb11 100644 --- a/southbound/pom.xml +++ b/southbound/pom.xml @@ -16,7 +16,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL org.opendaylight.ovsdb southbound-aggregator - 1.19.0-SNAPSHOT + 1.19.0 ODL :: ovsdb :: ${project.artifactId} diff --git a/southbound/southbound-api/pom.xml b/southbound/southbound-api/pom.xml index 36e640f16..3daa6b903 100644 --- a/southbound/southbound-api/pom.xml +++ b/southbound/southbound-api/pom.xml @@ -10,14 +10,14 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent 4.0.0 org.opendaylight.ovsdb southbound-api - 1.19.0-SNAPSHOT + 1.19.0 bundle diff --git a/southbound/southbound-artifacts/pom.xml b/southbound/southbound-artifacts/pom.xml index 67110daaa..708512f20 100644 --- a/southbound/southbound-artifacts/pom.xml +++ b/southbound/southbound-artifacts/pom.xml @@ -19,7 +19,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb southbound-artifacts - 1.19.0-SNAPSHOT + 1.19.0 pom diff --git a/southbound/southbound-features/features/pom.xml b/southbound/southbound-features/features/pom.xml index a495de2f4..abc39335b 100644 --- a/southbound/southbound-features/features/pom.xml +++ b/southbound/southbound-features/features/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb southbound-features - 1.19.0-SNAPSHOT + 1.19.0 feature diff --git a/southbound/southbound-features/odl-ovsdb-southbound-api/pom.xml b/southbound/southbound-features/odl-ovsdb-southbound-api/pom.xml index 52258d22f..62eca9cde 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-api/pom.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-api/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb odl-ovsdb-southbound-api - 1.19.0-SNAPSHOT + 1.19.0 feature diff --git a/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/pom.xml b/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/pom.xml index d1ba82d83..c9d05e918 100644 --- a/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/pom.xml +++ b/southbound/southbound-features/odl-ovsdb-southbound-impl-rest/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb odl-ovsdb-southbound-impl-rest - 1.19.0-SNAPSHOT + 1.19.0 feature ODL :: ovsdb :: ${project.artifactId} diff --git a/southbound/southbound-impl/pom.xml b/southbound/southbound-impl/pom.xml index 494da27e3..c21424aac 100644 --- a/southbound/southbound-impl/pom.xml +++ b/southbound/southbound-impl/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent diff --git a/southbound/southbound-it/pom.xml b/southbound/southbound-it/pom.xml index a927273bc..40098492d 100644 --- a/southbound/southbound-it/pom.xml +++ b/southbound/southbound-it/pom.xml @@ -12,7 +12,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb it - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/it 4.0.0 diff --git a/southbound/southbound-karaf/pom.xml b/southbound/southbound-karaf/pom.xml index 73bfaf331..5bf7a715e 100644 --- a/southbound/southbound-karaf/pom.xml +++ b/southbound/southbound-karaf/pom.xml @@ -15,7 +15,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL 4.0.0 org.opendaylight.ovsdb southbound-karaf - 1.19.0-SNAPSHOT + 1.19.0 pom diff --git a/utils/config/pom.xml b/utils/config/pom.xml index 5548042d6..d67cfaedc 100644 --- a/utils/config/pom.xml +++ b/utils/config/pom.xml @@ -12,13 +12,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent org.opendaylight.ovsdb utils.config - 1.19.0-SNAPSHOT + 1.19.0 ODL :: ovsdb :: ${project.artifactId} diff --git a/utils/hwvtepsouthbound-utils/pom.xml b/utils/hwvtepsouthbound-utils/pom.xml index fb4586094..a76df9b44 100644 --- a/utils/hwvtepsouthbound-utils/pom.xml +++ b/utils/hwvtepsouthbound-utils/pom.xml @@ -11,13 +11,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent org.opendaylight.ovsdb utils.hwvtepsouthbound-utils - 1.19.0-SNAPSHOT + 1.19.0 bundle diff --git a/utils/mdsal-utils/pom.xml b/utils/mdsal-utils/pom.xml index 67b61b155..c111598f6 100644 --- a/utils/mdsal-utils/pom.xml +++ b/utils/mdsal-utils/pom.xml @@ -11,13 +11,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent org.opendaylight.ovsdb utils.mdsal-utils - 1.19.0-SNAPSHOT + 1.19.0 bundle diff --git a/utils/odl-ovsdb-utils/pom.xml b/utils/odl-ovsdb-utils/pom.xml index e10c8c946..1ed0ec03b 100644 --- a/utils/odl-ovsdb-utils/pom.xml +++ b/utils/odl-ovsdb-utils/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb odl-ovsdb-utils - 1.19.0-SNAPSHOT + 1.19.0 feature diff --git a/utils/ovsdb-it-utils/pom.xml b/utils/ovsdb-it-utils/pom.xml index b3ca76819..a40d87876 100644 --- a/utils/ovsdb-it-utils/pom.xml +++ b/utils/ovsdb-it-utils/pom.xml @@ -11,7 +11,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent diff --git a/utils/pom.xml b/utils/pom.xml index 0791b9468..6ded4ced9 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -18,7 +18,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb utils - 1.19.0-SNAPSHOT + 1.19.0 pom diff --git a/utils/servicehelper/pom.xml b/utils/servicehelper/pom.xml index de0ee8ca5..9817b6a13 100644 --- a/utils/servicehelper/pom.xml +++ b/utils/servicehelper/pom.xml @@ -12,13 +12,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent org.opendaylight.ovsdb utils.servicehelper - 1.19.0-SNAPSHOT + 1.19.0 bundle diff --git a/utils/southbound-utils/pom.xml b/utils/southbound-utils/pom.xml index 7f6291acb..f0b256fb2 100644 --- a/utils/southbound-utils/pom.xml +++ b/utils/southbound-utils/pom.xml @@ -11,13 +11,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent org.opendaylight.ovsdb utils.southbound-utils - 1.19.0-SNAPSHOT + 1.19.0 bundle diff --git a/utils/yang-utils/pom.xml b/utils/yang-utils/pom.xml index a1548e4b5..aecc9ae04 100644 --- a/utils/yang-utils/pom.xml +++ b/utils/yang-utils/pom.xml @@ -11,7 +11,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html org.opendaylight.ovsdb ovsdb-binding-parent - 1.19.0-SNAPSHOT + 1.19.0 ../../commons/binding-parent -- 2.43.0