Make TransactionBuilder type-aware 01/86101/7
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 2 Dec 2019 12:33:50 +0000 (13:33 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 2 Dec 2019 15:03:53 +0000 (16:03 +0100)
This centralizes dispatch to TyperUtils, so that users do not have
to type out acquisition of schema and acquisition of wrapper.

This also allows interception of most calls via normal mocking, as
we can hook into the TransactionBuilder instance -- thus reducing
the need for static mocking.

Change-Id: I9a244be8164ff2dfc1f51edc80b70c4dab635848
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
44 files changed:
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterRemoveCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchRemoveCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalRemoveCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsLocalUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteRemoveCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/McastMacsRemoteUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortRemoveCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalPortUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchRemoveCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/PhysicalSwitchUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalRemoveCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsLocalUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteRemoveCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/UcastMacsRemoteUpdateCommand.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/operations/TransactionBuilder.java
library/impl/src/main/java/org/opendaylight/ovsdb/lib/schema/typed/TyperUtils.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundMapper.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachRemovedCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/AutoAttachUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeRemovedCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/BridgeUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerRemovedCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ControllerUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolRemovedCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosRemovedCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QosUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueRemovedCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/QueueUpdateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointDeleteCommand.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommand.java
southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OpenVSwitchBridgeAddCommandTest.java
southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommandTest.java
southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/ProtocolRemovedCommandTest.java
southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointCreateCommandTest.java
southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TerminationPointUpdateCommandTest.java

index 5ff6d1db54ad879aae82df48c094b8cbf396a002..1ff121d52aeaed42569806a9fe96ce10ecbaef1c 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -22,7 +21,6 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalRouter;
 import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
@@ -35,13 +33,13 @@ import org.slf4j.LoggerFactory;
 public class LogicalRouterRemoveCommand extends AbstractTransactCommand<LogicalRouters, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(LogicalRouterRemoveCommand.class);
 
-    public LogicalRouterRemoveCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public LogicalRouterRemoveCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<LogicalRouters>> removed =
               extractRemoved(getChanges(),LogicalRouters.class);
 
@@ -49,7 +47,7 @@ public class LogicalRouterRemoveCommand extends AbstractTransactCommand<LogicalR
             if (!HwvtepSouthboundUtil.isEmpty(created.getValue())) {
                 getOperationalState().getDeviceInfo().scheduleTransaction(new TransactCommand() {
                     @Override
-                    public void execute(TransactionBuilder transactionBuilder) {
+                    public void execute(final TransactionBuilder transactionBuilder) {
                         HwvtepConnectionInstance connectionInstance = getDeviceInfo().getConnectionInstance();
                         HwvtepOperationalState operState = new HwvtepOperationalState(
                                 connectionInstance.getDataBroker(), connectionInstance, Collections.EMPTY_LIST);
@@ -61,12 +59,12 @@ public class LogicalRouterRemoveCommand extends AbstractTransactCommand<LogicalR
 
 
                     @Override
-                    public void onSuccess(TransactionBuilder deviceTransaction) {
+                    public void onSuccess(final TransactionBuilder deviceTransaction) {
                         LogicalRouterRemoveCommand.this.onSuccess(deviceTransaction);
                     }
 
                     @Override
-                    public void onFailure(TransactionBuilder deviceTransaction) {
+                    public void onFailure(final TransactionBuilder deviceTransaction) {
                         LogicalRouterRemoveCommand.this.onFailure(deviceTransaction);
                     }
                 });
@@ -76,7 +74,7 @@ public class LogicalRouterRemoveCommand extends AbstractTransactCommand<LogicalR
 
     @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
             justification = "https://github.com/spotbugs/spotbugs/issues/811")
-    private void removeLogicalRouter(TransactionBuilder transaction,
+    private void removeLogicalRouter(final TransactionBuilder transaction,
             final InstanceIdentifier<Node> instanceIdentifier, final List<LogicalRouters> routerList) {
         for (LogicalRouters lrouter: routerList) {
             LOG.debug("Removing logical router named: {}", lrouter.getHwvtepNodeName().getValue());
@@ -85,8 +83,7 @@ public class LogicalRouterRemoveCommand extends AbstractTransactCommand<LogicalR
 
             if (operationalRouterOptional.isPresent()
                     && operationalRouterOptional.get().getLogicalRouterUuid() != null) {
-                LogicalRouter logicalRouter = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                        LogicalRouter.class, null);
+                LogicalRouter logicalRouter = transaction.getTypedRowSchema(LogicalRouter.class);
                 UUID logicalRouterUuid = new UUID(operationalRouterOptional.get().getLogicalRouterUuid().getValue());
                 transaction.add(op.delete(logicalRouter.getSchema())
                         .where(logicalRouter.getUuidColumn().getSchema().opEqual(logicalRouterUuid)).build());
index 94744587bc26c1f9a9a3fb7c0efd5b5c4d9f27b8..dc434b96437f3466b00db43587e08a785f5c3b42 100644 (file)
@@ -19,7 +19,6 @@ import java.util.Map.Entry;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalRouter;
 import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
@@ -39,13 +38,13 @@ import org.slf4j.LoggerFactory;
 public class LogicalRouterUpdateCommand extends AbstractTransactCommand<LogicalRouters, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(LogicalRouterUpdateCommand.class);
 
-    public LogicalRouterUpdateCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public LogicalRouterUpdateCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<LogicalRouters>> updateMap =
                 extractUpdated(getChanges(),LogicalRouters.class);
 
@@ -55,8 +54,8 @@ public class LogicalRouterUpdateCommand extends AbstractTransactCommand<LogicalR
         }
     }
 
-    private void updateLogicalRouter(TransactionBuilder transaction, final InstanceIdentifier<Node> instanceIdentifier,
-            final List<LogicalRouters> routerList) {
+    private void updateLogicalRouter(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> instanceIdentifier, final List<LogicalRouters> routerList) {
         for (LogicalRouters lrouter: routerList) {
             InstanceIdentifier<LogicalRouters> routerKey = instanceIdentifier
                     .augmentation(HwvtepGlobalAugmentation.class).child(LogicalRouters.class, lrouter.key());
@@ -64,8 +63,7 @@ public class LogicalRouterUpdateCommand extends AbstractTransactCommand<LogicalR
 
             final Optional<LogicalRouters> operationalRouterOptional =
                     getOperationalState().getLogicalRouters(instanceIdentifier, lrouter.key());
-            LogicalRouter logicalRouter = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    LogicalRouter.class);
+            LogicalRouter logicalRouter = transaction.getTypedRowWrapper(LogicalRouter.class);
             setDescription(logicalRouter, lrouter);
 
             setSwitchBindings(transaction, logicalRouter, lrouter.getSwitchBindings());
@@ -83,8 +81,7 @@ public class LogicalRouterUpdateCommand extends AbstractTransactCommand<LogicalR
             } else {
                 LogicalRouters updatedLRouter = operationalRouterOptional.get();
                 String existingLogicalRouterName = updatedLRouter.getHwvtepNodeName().getValue();
-                LogicalRouter extraLogicalRouter = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                        LogicalRouter.class);
+                LogicalRouter extraLogicalRouter = transaction.getTypedRowWrapper(LogicalRouter.class);
                 extraLogicalRouter.setName("");
                 LOG.trace("Updating LogicalRouter entry: {}", logicalRouter);
                 transaction.add(op.update(logicalRouter)
@@ -106,7 +103,7 @@ public class LogicalRouterUpdateCommand extends AbstractTransactCommand<LogicalR
     }
 
     private void setName(final LogicalRouter logicalRouter, final LogicalRouters inputRouter,
-            Optional<LogicalRouters> inputRouterOptional) {
+            final Optional<LogicalRouters> inputRouterOptional) {
         if (inputRouter.getHwvtepNodeName() != null) {
             logicalRouter.setName(inputRouter.getHwvtepNodeName().getValue());
         } else if (inputRouterOptional.isPresent() && inputRouterOptional.get().getHwvtepNodeName() != null) {
index f09ca6a1a87d26e481fd223cda562a5a64a62489..8bb63be1e61ce4c07e79cbffa3cbfb2a4729ff2a 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -23,7 +22,6 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalSwitch;
 import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsLocal;
 import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsRemote;
@@ -40,13 +38,13 @@ import org.slf4j.LoggerFactory;
 public class LogicalSwitchRemoveCommand extends AbstractTransactCommand<LogicalSwitches, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(LogicalSwitchRemoveCommand.class);
 
-    public LogicalSwitchRemoveCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public LogicalSwitchRemoveCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<LogicalSwitches>> removeds =
                 extractRemoved(getChanges(),LogicalSwitches.class);
 
@@ -55,7 +53,7 @@ public class LogicalSwitchRemoveCommand extends AbstractTransactCommand<LogicalS
                 HwvtepConnectionInstance connectionInstance = getDeviceInfo().getConnectionInstance();
                 getDeviceInfo().scheduleTransaction(new TransactCommand() {
                     @Override
-                    public void execute(TransactionBuilder transactionBuilder) {
+                    public void execute(final TransactionBuilder transactionBuilder) {
                         HwvtepOperationalState operState = new HwvtepOperationalState(
                                 connectionInstance.getDataBroker(), connectionInstance, Collections.EMPTY_LIST);
                         hwvtepOperationalState = operState;
@@ -65,12 +63,12 @@ public class LogicalSwitchRemoveCommand extends AbstractTransactCommand<LogicalS
                     }
 
                     @Override
-                    public void onSuccess(TransactionBuilder deviceTransaction) {
+                    public void onSuccess(final TransactionBuilder deviceTransaction) {
                         LogicalSwitchRemoveCommand.this.onSuccess(deviceTransaction);
                     }
 
                     @Override
-                    public void onFailure(TransactionBuilder deviceTransaction) {
+                    public void onFailure(final TransactionBuilder deviceTransaction) {
                         LogicalSwitchRemoveCommand.this.onFailure(deviceTransaction);
                     }
                 });
@@ -107,31 +105,26 @@ public class LogicalSwitchRemoveCommand extends AbstractTransactCommand<LogicalS
         LOG.debug("Removing logical switch named: {}", lswitch.getHwvtepNodeName().getValue());
         HwvtepDeviceInfo.DeviceData deviceData  = getOperationalState().getDeviceInfo().getDeviceOperData(
                 LogicalSwitches.class, lsKey);
-        LogicalSwitch logicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                LogicalSwitch.class, null);
+        LogicalSwitch logicalSwitch = transaction.getTypedRowSchema(LogicalSwitch.class);
 
         if (deviceData != null && deviceData.getUuid() != null) {
             UUID logicalSwitchUuid = deviceData.getUuid();
             transaction.add(op.delete(logicalSwitch.getSchema())
                     .where(logicalSwitch.getUuidColumn().getSchema().opEqual(logicalSwitchUuid)).build());
 
-            UcastMacsRemote ucastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    UcastMacsRemote.class, null);
+            UcastMacsRemote ucastMacsRemote = transaction.getTypedRowSchema(UcastMacsRemote.class);
             transaction.add(op.delete(ucastMacsRemote.getSchema())
                     .where(ucastMacsRemote.getLogicalSwitchColumn().getSchema().opEqual(logicalSwitchUuid)).build());
 
-            UcastMacsLocal ucastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    UcastMacsLocal.class, null);
+            UcastMacsLocal ucastMacsLocal = transaction.getTypedRowSchema(UcastMacsLocal.class);
             transaction.add(op.delete(ucastMacsLocal.getSchema())
                     .where(ucastMacsLocal.getLogicalSwitchColumn().getSchema().opEqual(logicalSwitchUuid)).build());
 
-            McastMacsRemote mcastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    McastMacsRemote.class, null);
+            McastMacsRemote mcastMacsRemote = transaction.getTypedRowSchema(McastMacsRemote.class);
             transaction.add(op.delete(mcastMacsRemote.getSchema())
                     .where(mcastMacsRemote.getLogicalSwitchColumn().getSchema().opEqual(logicalSwitchUuid)).build());
 
-            McastMacsLocal mcastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    McastMacsLocal.class, null);
+            McastMacsLocal mcastMacsLocal = transaction.getTypedRowSchema(McastMacsLocal.class);
             transaction.add(op.delete(mcastMacsLocal.getSchema())
                     .where(mcastMacsLocal.getLogicalSwitchColumn().getSchema().opEqual(logicalSwitchUuid)).build());
             updateCurrentTxDeleteData(LogicalSwitches.class, lsKey, lswitch);
@@ -143,12 +136,12 @@ public class LogicalSwitchRemoveCommand extends AbstractTransactCommand<LogicalS
     }
 
     @Override
-    protected List<LogicalSwitches> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<LogicalSwitches> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getLogicalSwitches();
     }
 
     @Override
-    protected boolean areEqual(LogicalSwitches sw1, LogicalSwitches sw2) {
+    protected boolean areEqual(final LogicalSwitches sw1, final LogicalSwitches sw2) {
         return sw1.key().equals(sw2.key()) && Objects.equals(sw1.getTunnelKey(), sw2.getTunnelKey());
     }
 
index c872369a3a496af9ba87192016765e06feb020c0..9002127f887aec93fcf19b366c0b5ef2fd41ae64 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil.schemaMismatchLog;
@@ -23,7 +22,6 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
 import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalSwitch;
 import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
@@ -36,13 +34,13 @@ import org.slf4j.LoggerFactory;
 public class LogicalSwitchUpdateCommand extends AbstractTransactCommand<LogicalSwitches, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(LogicalSwitchUpdateCommand.class);
 
-    public LogicalSwitchUpdateCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public LogicalSwitchUpdateCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<LogicalSwitches>> updateds =
                 extractUpdated(getChanges(),LogicalSwitches.class);
         if (!updateds.isEmpty()) {
@@ -80,8 +78,7 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand<LogicalS
         LOG.debug("Creating logical switch named: {}", lswitch.getHwvtepNodeName());
         final HwvtepDeviceInfo.DeviceData operationalSwitchOptional =
                 getDeviceInfo().getDeviceOperData(LogicalSwitches.class, lsKey);
-        LogicalSwitch logicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                LogicalSwitch.class);
+        LogicalSwitch logicalSwitch = transaction.getTypedRowWrapper(LogicalSwitch.class);
         setDescription(logicalSwitch, lswitch);
         setTunnelKey(logicalSwitch, lswitch);
         setReplicationMode(logicalSwitch, lswitch);
@@ -96,8 +93,7 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand<LogicalS
         } else {
             String existingLogicalSwitchName = lswitch.getHwvtepNodeName().getValue();
             // Name is immutable, and so we *can't* update it.  So we use extraBridge for the schema stuff
-            LogicalSwitch extraLogicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    LogicalSwitch.class);
+            LogicalSwitch extraLogicalSwitch = transaction.getTypedRowWrapper(LogicalSwitch.class);
             extraLogicalSwitch.setName("");
             LOG.trace("execute: updating LogicalSwitch entry: {}", logicalSwitch);
             transaction.add(op.update(logicalSwitch)
@@ -108,19 +104,19 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand<LogicalS
         }
     }
 
-    private void setDescription(LogicalSwitch logicalSwitch, LogicalSwitches inputSwitch) {
+    private static void setDescription(final LogicalSwitch logicalSwitch, final LogicalSwitches inputSwitch) {
         if (inputSwitch.getHwvtepNodeDescription() != null) {
             logicalSwitch.setDescription(inputSwitch.getHwvtepNodeDescription());
         }
     }
 
-    private void setName(LogicalSwitch logicalSwitch, LogicalSwitches inputSwitch) {
+    private static void setName(final LogicalSwitch logicalSwitch, final LogicalSwitches inputSwitch) {
         if (inputSwitch.getHwvtepNodeName() != null) {
             logicalSwitch.setName(inputSwitch.getHwvtepNodeName().getValue());
         }
     }
 
-    private void setTunnelKey(LogicalSwitch logicalSwitch, LogicalSwitches inputSwitch) {
+    private static void setTunnelKey(final LogicalSwitch logicalSwitch, final LogicalSwitches inputSwitch) {
         if (inputSwitch.getTunnelKey() != null) {
             Set<Long> tunnel = new HashSet<>();
             tunnel.add(Long.valueOf(inputSwitch.getTunnelKey()));
@@ -128,7 +124,7 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand<LogicalS
         }
     }
 
-    private void setReplicationMode(LogicalSwitch logicalSwitch, LogicalSwitches inputSwitch) {
+    private static void setReplicationMode(final LogicalSwitch logicalSwitch, final LogicalSwitches inputSwitch) {
         if (inputSwitch.getReplicationMode() != null) {
             Set<String> mode = new HashSet<>();
             mode.add(inputSwitch.getReplicationMode());
@@ -142,12 +138,12 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand<LogicalS
     }
 
     @Override
-    protected List<LogicalSwitches> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<LogicalSwitches> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getLogicalSwitches();
     }
 
     @Override
-    protected boolean areEqual(LogicalSwitches sw1, LogicalSwitches sw2) {
+    protected boolean areEqual(final LogicalSwitches sw1, final LogicalSwitches sw2) {
         return sw1.key().equals(sw2.key()) && Objects.equals(sw1.getTunnelKey(), sw2.getTunnelKey());
     }
 }
index 9e4eb510c9f37738b799ff508f219662e005727f..a575803a9f00bd796bee4f590fb93189dff5b70a 100644 (file)
@@ -19,7 +19,6 @@ import java.util.Map.Entry;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsLocal;
 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.hwvtep.global.attributes.LocalMcastMacs;
@@ -31,13 +30,13 @@ import org.slf4j.LoggerFactory;
 public class McastMacsLocalRemoveCommand extends AbstractTransactCommand<LocalMcastMacs, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(McastMacsLocalRemoveCommand.class);
 
-    public McastMacsLocalRemoveCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public McastMacsLocalRemoveCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<LocalMcastMacs>> removeds =
                 extractRemoved(getChanges(),LocalMcastMacs.class);
         if (!removeds.isEmpty()) {
@@ -48,14 +47,13 @@ public class McastMacsLocalRemoveCommand extends AbstractTransactCommand<LocalMc
         }
     }
 
-    private void removeMcastMacLocal(TransactionBuilder transaction,
-            InstanceIdentifier<Node> instanceIdentifier, List<LocalMcastMacs> macList) {
+    private void removeMcastMacLocal(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> instanceIdentifier, final List<LocalMcastMacs> macList) {
         for (LocalMcastMacs mac: macList) {
             LOG.debug("Removing localMcastMacs, mac address: {}", mac.getMacEntryKey().getValue());
             Optional<LocalMcastMacs> operationalMacOptional =
                     getOperationalState().getLocalMcastMacs(instanceIdentifier, mac.key());
-            McastMacsLocal mcastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    McastMacsLocal.class, null);
+            McastMacsLocal mcastMacsLocal = transaction.getTypedRowSchema(McastMacsLocal.class);
             if (operationalMacOptional.isPresent() && operationalMacOptional.get().getMacEntryUuid() != null) {
                 //when mac entry is deleted, its referenced locator set and locators are deleted automatically.
                 //TODO: locator in config DS is not deleted
@@ -72,7 +70,7 @@ public class McastMacsLocalRemoveCommand extends AbstractTransactCommand<LocalMc
     }
 
     @Override
-    protected List<LocalMcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<LocalMcastMacs> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getLocalMcastMacs();
     }
 
@@ -90,12 +88,12 @@ public class McastMacsLocalRemoveCommand extends AbstractTransactCommand<LocalMc
 
     public static class MacDependencyGetter extends UnMetDependencyGetter<LocalMcastMacs> {
         @Override
-        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(LocalMcastMacs data) {
+        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(final LocalMcastMacs data) {
             return Collections.singletonList(data.getLogicalSwitchRef().getValue());
         }
 
         @Override
-        public List<InstanceIdentifier<?>> getTerminationPointDependencies(LocalMcastMacs data) {
+        public List<InstanceIdentifier<?>> getTerminationPointDependencies(final LocalMcastMacs data) {
             return Collections.emptyList();
         }
     }
index 8a8ed9bb7f07378340406f92799860db7ba15558..6450c885fd3c2654ecd2c04a205ad2b778cbf299 100644 (file)
@@ -19,7 +19,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundConstants;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsLocal;
 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.hwvtep.rev150901.HwvtepGlobalAugmentation;
@@ -33,13 +32,13 @@ import org.slf4j.LoggerFactory;
 public class McastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalMcastMacs, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(McastMacsLocalUpdateCommand.class);
 
-    public McastMacsLocalUpdateCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public McastMacsLocalUpdateCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<LocalMcastMacs>> updateds =
                 extractUpdated(getChanges(),LocalMcastMacs.class);
         if (!updateds.isEmpty()) {
@@ -50,14 +49,13 @@ public class McastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalMc
         }
     }
 
-    private void updateMcastMacsLocal(TransactionBuilder transaction,
-            InstanceIdentifier<Node> instanceIdentifier, List<LocalMcastMacs> localMcastMacs) {
+    private void updateMcastMacsLocal(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> instanceIdentifier, final List<LocalMcastMacs> localMcastMacs) {
         for (LocalMcastMacs localMcastMac: localMcastMacs) {
             LOG.debug("Creating localMcastMac, mac address: {}", localMcastMac.getMacEntryKey().getValue());
             final Optional<LocalMcastMacs> operationalMacOptional =
                     getOperationalState().getLocalMcastMacs(instanceIdentifier, localMcastMac.key());
-            McastMacsLocal mcastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    McastMacsLocal.class);
+            McastMacsLocal mcastMacsLocal = transaction.getTypedRowWrapper(McastMacsLocal.class);
             setIpAddress(mcastMacsLocal, localMcastMac);
             setLocatorSet(transaction, mcastMacsLocal, localMcastMac);
             setLogicalSwitch(mcastMacsLocal, localMcastMac);
@@ -68,8 +66,7 @@ public class McastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalMc
                 transaction.add(op.comment("McastMacLocal: Creating " + localMcastMac.getMacEntryKey().getValue()));
             } else if (operationalMacOptional.get().getMacEntryUuid() != null) {
                 UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
-                McastMacsLocal extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                                McastMacsLocal.class, null);
+                McastMacsLocal extraMac = transaction.getTypedRowSchema(McastMacsLocal.class);
                 extraMac.getUuidColumn().setData(macEntryUUID);
                 LOG.trace("execute: update LocalMcastMac entry: {}", mcastMacsLocal);
                 transaction.add(op.update(mcastMacsLocal)
@@ -83,7 +80,7 @@ public class McastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalMc
         }
     }
 
-    private void setLogicalSwitch(McastMacsLocal mcastMacsLocal, LocalMcastMacs inputMac) {
+    private void setLogicalSwitch(final McastMacsLocal mcastMacsLocal, final LocalMcastMacs inputMac) {
         if (inputMac.getLogicalSwitchRef() != null) {
             @SuppressWarnings("unchecked")
             InstanceIdentifier<LogicalSwitches> lswitchIid =
@@ -102,7 +99,8 @@ public class McastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalMc
         }
     }
 
-    private void setLocatorSet(TransactionBuilder transaction, McastMacsLocal mcastMacsLocal, LocalMcastMacs inputMac) {
+    private void setLocatorSet(final TransactionBuilder transaction, final McastMacsLocal mcastMacsLocal,
+            final LocalMcastMacs inputMac) {
         if (inputMac.getLocatorSet() != null && !inputMac.getLocatorSet().isEmpty()) {
             UUID locatorSetUuid = TransactUtils.createPhysicalLocatorSet(getOperationalState(), transaction,
                     inputMac.getLocatorSet());
@@ -110,14 +108,14 @@ public class McastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalMc
         }
     }
 
-    private void setIpAddress(McastMacsLocal mcastMacsLocal, LocalMcastMacs inputMac) {
+    private static void setIpAddress(final McastMacsLocal mcastMacsLocal, final LocalMcastMacs inputMac) {
         if (inputMac.getIpaddr() != null) {
             mcastMacsLocal.setIpAddress(inputMac.getIpaddr().getIpv4Address().getValue());
         }
     }
 
-    private void setMac(McastMacsLocal mcastMacsLocal, LocalMcastMacs inputMac,
-            Optional<LocalMcastMacs> inputSwitchOptional) {
+    private static void setMac(final McastMacsLocal mcastMacsLocal, final LocalMcastMacs inputMac,
+            final Optional<LocalMcastMacs> inputSwitchOptional) {
         if (inputMac.getMacEntryKey() != null) {
             if (inputMac.getMacEntryKey().equals(HwvtepSouthboundConstants.UNKNOWN_DST_MAC)) {
                 mcastMacsLocal.setMac(HwvtepSouthboundConstants.UNKNOWN_DST_STRING);
@@ -130,7 +128,7 @@ public class McastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalMc
     }
 
     @Override
-    protected List<LocalMcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<LocalMcastMacs> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getLocalMcastMacs();
     }
 }
index 4cf5f38d43a4da647634a5c8ec7064e8a92c659b..6dab0fdc32b5bc7e94e26cba1d488c9b495e0f1a 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -21,7 +20,6 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsRemote;
 import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
@@ -35,13 +33,13 @@ import org.slf4j.LoggerFactory;
 public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand<RemoteMcastMacs, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(McastMacsRemoteRemoveCommand.class);
 
-    public McastMacsRemoteRemoveCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public McastMacsRemoteRemoveCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<RemoteMcastMacs>> removeds =
                 extractRemoved(getChanges(),RemoteMcastMacs.class);
         if (!removeds.isEmpty()) {
@@ -97,8 +95,7 @@ public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand<Remote
         LOG.debug("Removing remoteMcastMacs, mac address: {}", mac.getMacEntryKey().getValue());
         HwvtepDeviceInfo.DeviceData operationalMacOptional =
                 getDeviceInfo().getDeviceOperData(RemoteMcastMacs.class, macIid);
-        McastMacsRemote mcastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                McastMacsRemote.class, null);
+        McastMacsRemote mcastMacsRemote = transaction.getTypedRowSchema(McastMacsRemote.class);
         if (operationalMacOptional != null && operationalMacOptional.getUuid() != null) {
             //when mac entry is deleted, its referenced locator set and locators are deleted automatically.
             //TODO: locator in config DS is not deleted
@@ -116,12 +113,12 @@ public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand<Remote
     }
 
     @Override
-    protected List<RemoteMcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<RemoteMcastMacs> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getRemoteMcastMacs();
     }
 
     @Override
-    protected boolean areEqual(RemoteMcastMacs macs1, RemoteMcastMacs macs2) {
+    protected boolean areEqual(final RemoteMcastMacs macs1, final RemoteMcastMacs macs2) {
         return macs1.key().equals(macs2.key()) && Objects.equals(macs1.getLocatorSet(), macs2.getLocatorSet());
     }
 
index 6e13651c98e8023d7d5d49ce135af144643fec0e..e1edc7ed09b32d20efd648c57f4f9734d3915c44 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -24,7 +23,6 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundConstants;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.McastMacsRemote;
 import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
@@ -40,13 +38,13 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
     private static final Logger LOG = LoggerFactory.getLogger(McastMacsRemoteUpdateCommand.class);
     private static final McastMacUnMetDependencyGetter MCAST_MAC_DATA_VALIDATOR = new McastMacUnMetDependencyGetter();
 
-    public McastMacsRemoteUpdateCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public McastMacsRemoteUpdateCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<RemoteMcastMacs>> updateds =
                 extractUpdated(getChanges(),RemoteMcastMacs.class);
         if (!updateds.isEmpty()) {
@@ -57,8 +55,8 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
         }
     }
 
-    private void updateMcastMacRemote(TransactionBuilder transaction,
-            InstanceIdentifier<Node> instanceIdentifier, List<RemoteMcastMacs> macList) {
+    private void updateMcastMacRemote(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> instanceIdentifier, final List<RemoteMcastMacs> macList) {
         for (RemoteMcastMacs mac: macList) {
             //add / update only if locator set got changed
             if (!HwvtepSouthboundUtil.isEmpty(mac.getLocatorSet())) {
@@ -68,27 +66,26 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
     }
 
     @Override
-    public void onConfigUpdate(TransactionBuilder transaction,
-                                  InstanceIdentifier<Node> nodeIid,
-                                  RemoteMcastMacs remoteMcastMac,
-                                  InstanceIdentifier macKey,
-                                  Object... extraData) {
+    public void onConfigUpdate(final TransactionBuilder transaction,
+                               final InstanceIdentifier<Node> nodeIid,
+                               final RemoteMcastMacs remoteMcastMac,
+                               final InstanceIdentifier macKey,
+                               final Object... extraData) {
         InstanceIdentifier<RemoteMcastMacs> macIid = nodeIid.augmentation(HwvtepGlobalAugmentation.class)
                 .child(RemoteMcastMacs.class, remoteMcastMac.key());
         processDependencies(MCAST_MAC_DATA_VALIDATOR, transaction, nodeIid, macIid, remoteMcastMac);
     }
 
     @Override
-    public void doDeviceTransaction(TransactionBuilder transaction,
-                                       InstanceIdentifier<Node> instanceIdentifier,
-                                       RemoteMcastMacs mac,
-                                       InstanceIdentifier macKey,
-                                       Object... extraData) {
+    public void doDeviceTransaction(final TransactionBuilder transaction,
+                                       final InstanceIdentifier<Node> instanceIdentifier,
+                                       final RemoteMcastMacs mac,
+                                       final InstanceIdentifier macKey,
+                                       final Object... extraData) {
         LOG.debug("Creating remoteMcastMacs, mac address: {}", mac.getMacEntryKey().getValue());
         final HwvtepDeviceInfo.DeviceData operationalMacOptional =
                 getDeviceInfo().getDeviceOperData(RemoteMcastMacs.class, macKey);
-        McastMacsRemote mcastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                McastMacsRemote.class);
+        McastMacsRemote mcastMacsRemote = transaction.getTypedRowWrapper(McastMacsRemote.class);
         setIpAddress(mcastMacsRemote, mac);
         setLocatorSet(transaction, mcastMacsRemote, mac);
         setLogicalSwitch(transaction, mcastMacsRemote, mac);
@@ -101,8 +98,7 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
             updateControllerTxHistory(TransactionType.ADD, mcastMacsRemote);
         } else if (operationalMacOptional.getUuid() != null) {
             UUID macEntryUUID = operationalMacOptional.getUuid();
-            McastMacsRemote extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    McastMacsRemote.class, null);
+            McastMacsRemote extraMac = transaction.getTypedRowSchema(McastMacsRemote.class);
             extraMac.getUuidColumn().setData(macEntryUUID);
             LOG.trace("execute: update RemoteMcastMac entry: {}", mcastMacsRemote);
             transaction.add(op.update(mcastMacsRemote)
@@ -129,8 +125,8 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
         }
     }
 
-    private void setLocatorSet(TransactionBuilder transaction, McastMacsRemote mcastMacsRemote,
-            RemoteMcastMacs inputMac) {
+    private void setLocatorSet(final TransactionBuilder transaction, final McastMacsRemote mcastMacsRemote,
+            final RemoteMcastMacs inputMac) {
         if (inputMac.getLocatorSet() != null && !inputMac.getLocatorSet().isEmpty()) {
             UUID locatorSetUuid = TransactUtils.createPhysicalLocatorSet(getOperationalState(),
                     transaction, inputMac.getLocatorSet());
@@ -138,13 +134,13 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
         }
     }
 
-    private void setIpAddress(McastMacsRemote mcastMacsRemote, RemoteMcastMacs inputMac) {
+    private void setIpAddress(final McastMacsRemote mcastMacsRemote, final RemoteMcastMacs inputMac) {
         if (inputMac.getIpaddr() != null) {
             mcastMacsRemote.setIpAddress(inputMac.getIpaddr().getIpv4Address().getValue());
         }
     }
 
-    private void setMac(McastMacsRemote mcastMacsRemote, RemoteMcastMacs inputMac) {
+    private void setMac(final McastMacsRemote mcastMacsRemote, final RemoteMcastMacs inputMac) {
         if (inputMac.getMacEntryKey() != null) {
             if (inputMac.getMacEntryKey().equals(HwvtepSouthboundConstants.UNKNOWN_DST_MAC)) {
                 mcastMacsRemote.setMac(HwvtepSouthboundConstants.UNKNOWN_DST_STRING);
@@ -155,19 +151,19 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
     }
 
     @Override
-    protected List<RemoteMcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<RemoteMcastMacs> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getRemoteMcastMacs();
     }
 
     @Override
-    protected boolean areEqual(RemoteMcastMacs macs1, RemoteMcastMacs macs2) {
+    protected boolean areEqual(final RemoteMcastMacs macs1, final RemoteMcastMacs macs2) {
         return macs1.key().equals(macs2.key()) && Objects.equals(macs1.getLocatorSet(), macs2.getLocatorSet());
     }
 
     static class McastMacUnMetDependencyGetter extends UnMetDependencyGetter<RemoteMcastMacs> {
 
         @Override
-        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(RemoteMcastMacs data) {
+        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(final RemoteMcastMacs data) {
             if (data == null) {
                 return Collections.emptyList();
             }
@@ -175,7 +171,7 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
         }
 
         @Override
-        public List<InstanceIdentifier<?>> getTerminationPointDependencies(RemoteMcastMacs data) {
+        public List<InstanceIdentifier<?>> getTerminationPointDependencies(final RemoteMcastMacs data) {
             if (data == null || HwvtepSouthboundUtil.isEmpty(data.getLocatorSet())) {
                 return Collections.emptyList();
             }
@@ -188,7 +184,7 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
     }
 
     @SuppressFBWarnings("UC_USELESS_OBJECT")
-    private void updateLocatorRefCounts(MdsalUpdate mdsalUpdate) {
+    private void updateLocatorRefCounts(final MdsalUpdate mdsalUpdate) {
         //decrement the refcounts from old mcast mac
         //increment the refcounts for new mcast mac
         RemoteMcastMacs newMac = (RemoteMcastMacs) mdsalUpdate.getNewData();
index 5860036e89c0f28cb281ec99c40fce2d3acf66d1..48bbc70f1f32f1bda9d1d71deea0cb0a834bd892 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -20,7 +19,6 @@ import java.util.Map.Entry;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalPort;
 import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation;
@@ -33,13 +31,13 @@ import org.slf4j.LoggerFactory;
 public class PhysicalPortRemoveCommand extends AbstractTransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
 
-    public PhysicalPortRemoveCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public PhysicalPortRemoveCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         //TODO reuse from base class instead of extractRemovedPorts
         Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> removeds =
                 extractRemovedPorts(getChanges(), HwvtepPhysicalPortAugmentation.class);
@@ -59,13 +57,11 @@ public class PhysicalPortRemoveCommand extends AbstractTransactCommand {
             Optional<HwvtepPhysicalPortAugmentation> operationalPhysicalPortOptional =
                     getOperationalState().getPhysicalPortAugmentation(psNodeiid, port.getHwvtepNodeName());
             if (operationalPhysicalPortOptional.isPresent()) {
-                PhysicalPort physicalPort = TyperUtils.getTypedRowWrapper(
-                        transaction.getDatabaseSchema(),PhysicalPort.class);
+                PhysicalPort physicalPort = transaction.getTypedRowWrapper(PhysicalPort.class);
                 physicalPort.setVlanBindings(new HashMap<>());
                 HwvtepPhysicalPortAugmentation updatedPhysicalPort = operationalPhysicalPortOptional.get();
                 String existingPhysicalPortName = updatedPhysicalPort.getHwvtepNodeName().getValue();
-                PhysicalPort extraPhyscialPort =
-                        TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), PhysicalPort.class);
+                PhysicalPort extraPhyscialPort = transaction.getTypedRowWrapper(PhysicalPort.class);
                 extraPhyscialPort.setName("");
                 LOG.trace("execute: updating physical port: {}", physicalPort);
                 transaction.add(op.update(physicalPort)
@@ -80,7 +76,7 @@ public class PhysicalPortRemoveCommand extends AbstractTransactCommand {
     }
 
     protected Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> extractRemovedPorts(
-            Collection<DataTreeModification<Node>> changes, Class<HwvtepPhysicalPortAugmentation> class1) {
+            final Collection<DataTreeModification<Node>> changes, final Class<HwvtepPhysicalPortAugmentation> class1) {
         Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> result = new HashMap<>();
         if (changes != null && !changes.isEmpty()) {
             for (DataTreeModification<Node> change : changes) {
index f32ed0c9a751875b476f67d334a0e88a51c8fd35..91b0a1eccaed9f05429d96321c51345c864a951b 100644 (file)
@@ -24,7 +24,6 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalPort;
 import org.opendaylight.ovsdb.utils.mdsal.utils.TransactionType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation;
@@ -43,13 +42,13 @@ public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortUpdateCommand.class);
     private static final VlanBindingsUnMetDependencyGetter DEPENDENCY_GETTER = new VlanBindingsUnMetDependencyGetter();
 
-    public PhysicalPortUpdateCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public PhysicalPortUpdateCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> createds =
                 extractCreated(getChanges(),HwvtepPhysicalPortAugmentation.class);
         if (!createds.isEmpty()) {
@@ -80,14 +79,12 @@ public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
                 //create a physical port always happens from device
                 LOG.error("Physical port {} not present in oper datastore", port.getHwvtepNodeName().getValue());
             } else {
-                PhysicalPort physicalPort = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                        PhysicalPort.class);
+                PhysicalPort physicalPort = transaction.getTypedRowWrapper(PhysicalPort.class);
                 physicalPort.setName(port.getHwvtepNodeName().getValue());
                 setVlanBindings(psNodeiid, physicalPort, port, transaction);
                 setDescription(physicalPort, port);
                 String existingPhysicalPortName = port.getHwvtepNodeName().getValue();
-                PhysicalPort extraPhyscialPort =
-                        TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), PhysicalPort.class);
+                PhysicalPort extraPhyscialPort = transaction.getTypedRowWrapper(PhysicalPort.class);
                 extraPhyscialPort.setName("");
                 LOG.trace("execute: updating physical port: {}", physicalPort);
                 transaction.add(op.update(physicalPort)
@@ -99,7 +96,8 @@ public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
         }
     }
 
-    private void setDescription(PhysicalPort physicalPort, HwvtepPhysicalPortAugmentation inputPhysicalPort) {
+    private static void setDescription(final PhysicalPort physicalPort,
+            final HwvtepPhysicalPortAugmentation inputPhysicalPort) {
         if (inputPhysicalPort.getHwvtepNodeDescription() != null) {
             physicalPort.setDescription(inputPhysicalPort.getHwvtepNodeDescription());
         }
@@ -179,19 +177,15 @@ public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
         getDeviceInfo().addJobToQueue(configWaitingJob);
     }
 
-    private InstanceIdentifier<TerminationPoint> getTpIid(final InstanceIdentifier<Node> psNodeiid,
-                                                          final String portName) {
-        return psNodeiid.child(
-                TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
+    private static InstanceIdentifier<TerminationPoint> getTpIid(final InstanceIdentifier<Node> psNodeiid,
+                                                                 final String portName) {
+        return psNodeiid.child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
     }
 
-    private InstanceIdentifier<VlanBindings> getVlanBindingIid(
-            final InstanceIdentifier<Node> psNodeiid,
-            final PhysicalPort physicalPort,
-            final VlanBindings vlanBinding) {
-
-        return psNodeiid.child(
-                TerminationPoint.class, new TerminationPointKey(new TpId(physicalPort.getName())))
+    private static InstanceIdentifier<VlanBindings> getVlanBindingIid(final InstanceIdentifier<Node> psNodeiid,
+                                                                      final PhysicalPort physicalPort,
+                                                                      final VlanBindings vlanBinding) {
+        return getTpIid(psNodeiid, physicalPort.getName())
                 .augmentation(HwvtepPhysicalPortAugmentation.class)
                 .child(VlanBindings.class, new VlanBindingsKey(vlanBinding.getVlanIdKey()));
     }
@@ -199,7 +193,7 @@ public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
     static class VlanBindingsUnMetDependencyGetter extends UnMetDependencyGetter<VlanBindings> {
 
         @Override
-        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(VlanBindings data) {
+        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(final VlanBindings data) {
             if (data == null) {
                 return Collections.emptyList();
             }
@@ -207,13 +201,13 @@ public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
         }
 
         @Override
-        public List<InstanceIdentifier<?>> getTerminationPointDependencies(VlanBindings data) {
+        public List<InstanceIdentifier<?>> getTerminationPointDependencies(final VlanBindings data) {
             return Collections.emptyList();
         }
     }
 
-    private Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> extractCreated(
-            Collection<DataTreeModification<Node>> changes, Class<HwvtepPhysicalPortAugmentation> class1) {
+    private static Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> extractCreated(
+            final Collection<DataTreeModification<Node>> changes, final Class<HwvtepPhysicalPortAugmentation> class1) {
         Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> result = new HashMap<>();
         if (changes != null && !changes.isEmpty()) {
             for (DataTreeModification<Node> change : changes) {
@@ -238,8 +232,8 @@ public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
         return result;
     }
 
-    private Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> extractUpdatedPorts(
-            Collection<DataTreeModification<Node>> changes, Class<HwvtepPhysicalPortAugmentation> class1) {
+    private static Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> extractUpdatedPorts(
+            final Collection<DataTreeModification<Node>> changes, final Class<HwvtepPhysicalPortAugmentation> class1) {
         Map<InstanceIdentifier<Node>, List<HwvtepPhysicalPortAugmentation>> result = new HashMap<>();
         if (changes != null && !changes.isEmpty()) {
             for (DataTreeModification<Node> change : changes) {
index f28a29fd9af6e8cb01ca34e2f47e52a2ca59719b..066687bb58e60a893902e3b00ed602594eca78d8 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -21,7 +20,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.Global;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalSwitch;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation;
@@ -33,13 +31,13 @@ import org.slf4j.LoggerFactory;
 public class PhysicalSwitchRemoveCommand extends AbstractTransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(PhysicalSwitchRemoveCommand.class);
 
-    public PhysicalSwitchRemoveCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public PhysicalSwitchRemoveCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> removeds =
                 extractRemovedSwitches(getChanges(),PhysicalSwitchAugmentation.class);
         if (!removeds.isEmpty()) {
@@ -50,19 +48,17 @@ public class PhysicalSwitchRemoveCommand extends AbstractTransactCommand {
         }
     }
 
-    private void removePhysicalSwitch(TransactionBuilder transaction,
-            InstanceIdentifier<Node> iid, PhysicalSwitchAugmentation physicalSwitchAugmentation) {
+    private void removePhysicalSwitch(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> iid, final PhysicalSwitchAugmentation physicalSwitchAugmentation) {
         LOG.debug("Removing a physical switch named: {}", physicalSwitchAugmentation.getHwvtepNodeName().getValue());
         Optional<PhysicalSwitchAugmentation> operationalPhysicalSwitchOptional =
                 getOperationalState().getPhysicalSwitchAugmentation(iid);
-        PhysicalSwitch physicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                PhysicalSwitch.class, null);
+        PhysicalSwitch physicalSwitch = transaction.getTypedRowSchema(PhysicalSwitch.class);
         if (operationalPhysicalSwitchOptional.isPresent()
                 && operationalPhysicalSwitchOptional.get().getPhysicalSwitchUuid() != null) {
             UUID physicalSwitchUuid = new UUID(operationalPhysicalSwitchOptional.get()
                     .getPhysicalSwitchUuid().getValue());
-            Global global = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    Global.class, null);
+            Global global = transaction.getTypedRowSchema(Global.class);
             transaction.add(op.delete(physicalSwitch.getSchema())
                     .where(physicalSwitch.getUuidColumn().getSchema().opEqual(physicalSwitchUuid)).build());
             transaction.add(op.comment("Physical Switch: Deleting "
@@ -79,7 +75,7 @@ public class PhysicalSwitchRemoveCommand extends AbstractTransactCommand {
     }
 
     private Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> extractRemovedSwitches(
-            Collection<DataTreeModification<Node>> changes, Class<PhysicalSwitchAugmentation> class1) {
+            final Collection<DataTreeModification<Node>> changes, final Class<PhysicalSwitchAugmentation> class1) {
         Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> result = new HashMap<>();
         if (changes != null && !changes.isEmpty()) {
             for (DataTreeModification<Node> change : changes) {
index 81297bf2407e220b6161efdb1ca5e1dd836d20df..6edee470395d583d1279b58b8640ec102d48fda5 100644 (file)
@@ -29,7 +29,6 @@ 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.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.Global;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalSwitch;
 import org.opendaylight.ovsdb.schema.hardwarevtep.Tunnel;
@@ -51,13 +50,13 @@ import org.slf4j.LoggerFactory;
 public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(PhysicalSwitchUpdateCommand.class);
 
-    public PhysicalSwitchUpdateCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public PhysicalSwitchUpdateCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> created =
                 extractCreated(getChanges(),PhysicalSwitchAugmentation.class);
         if (!created.isEmpty()) {
@@ -77,13 +76,12 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
     }
 
 
-    private void updatePhysicalSwitch(TransactionBuilder transaction,
-            InstanceIdentifier<Node> iid, PhysicalSwitchAugmentation physicalSwitchAugmentation) {
+    private void updatePhysicalSwitch(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> iid, final PhysicalSwitchAugmentation physicalSwitchAugmentation) {
         LOG.debug("Creating a physical switch named: {}", physicalSwitchAugmentation.getHwvtepNodeName());
         Optional<PhysicalSwitchAugmentation> operationalPhysicalSwitchOptional =
                 getOperationalState().getPhysicalSwitchAugmentation(iid);
-        PhysicalSwitch physicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                PhysicalSwitch.class);
+        PhysicalSwitch physicalSwitch = transaction.getTypedRowWrapper(PhysicalSwitch.class);
         setDescription(physicalSwitch, physicalSwitchAugmentation);
         setManagementIps(physicalSwitch, physicalSwitchAugmentation);
         setTunnuleIps(physicalSwitch, operationalPhysicalSwitchOptional.get());
@@ -101,7 +99,7 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
             transaction.add(op.comment("Physical Switch: Creating "
                     + physicalSwitchAugmentation.getHwvtepNodeName().getValue()));
             //update global table
-            Global global = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Global.class);
+            Global global = transaction.getTypedRowWrapper(Global.class);
             global.setSwitches(Collections.singleton(new UUID(pswitchUuid)));
 
             LOG.trace("execute: create physical switch: {}", physicalSwitch);
@@ -122,8 +120,7 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
                 existingPhysicalSwitchName = operationalPhysicalSwitchOptional.get().getHwvtepNodeName().getValue();
             }
             // Name is immutable, and so we *can't* update it.  So we use extraPhysicalSwitch for the schema stuff
-            PhysicalSwitch extraPhysicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    PhysicalSwitch.class);
+            PhysicalSwitch extraPhysicalSwitch = transaction.getTypedRowWrapper(PhysicalSwitch.class);
             extraPhysicalSwitch.setName("");
             LOG.trace("execute: updating physical switch: {}", physicalSwitch);
             transaction.add(op.update(physicalSwitch)
@@ -133,8 +130,9 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         }
     }
 
-    private void setName(PhysicalSwitch physicalSwitch, PhysicalSwitchAugmentation physicalSwitchAugmentation,
-            Optional<PhysicalSwitchAugmentation> operationalPhysicalSwitchOptional) {
+    private static void setName(final PhysicalSwitch physicalSwitch,
+            final PhysicalSwitchAugmentation physicalSwitchAugmentation,
+            final Optional<PhysicalSwitchAugmentation> operationalPhysicalSwitchOptional) {
         if (physicalSwitchAugmentation.getHwvtepNodeName() != null) {
             physicalSwitch.setName(physicalSwitchAugmentation.getHwvtepNodeName().getValue());
         } else if (operationalPhysicalSwitchOptional.isPresent()
@@ -143,14 +141,15 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         }
     }
 
-    private void setDescription(PhysicalSwitch physicalSwitch, PhysicalSwitchAugmentation physicalSwitchAugmentation) {
+    private static void setDescription(final PhysicalSwitch physicalSwitch,
+            final PhysicalSwitchAugmentation physicalSwitchAugmentation) {
         if (physicalSwitchAugmentation.getHwvtepNodeDescription() != null) {
             physicalSwitch.setDescription(physicalSwitchAugmentation.getHwvtepNodeDescription());
         }
     }
 
-    private void setManagementIps(PhysicalSwitch physicalSwitch,
-            PhysicalSwitchAugmentation physicalSwitchAugmentation) {
+    private static void setManagementIps(final PhysicalSwitch physicalSwitch,
+            final PhysicalSwitchAugmentation physicalSwitchAugmentation) {
         Set<String> ipSet = new HashSet<>();
         if (physicalSwitchAugmentation.getManagementIps() != null) {
             for (ManagementIps ip: physicalSwitchAugmentation.getManagementIps()) {
@@ -160,7 +159,8 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         }
     }
 
-    private void setTunnuleIps(PhysicalSwitch physicalSwitch, PhysicalSwitchAugmentation physicalSwitchAugmentation) {
+    private static void setTunnuleIps(final PhysicalSwitch physicalSwitch,
+            final PhysicalSwitchAugmentation physicalSwitchAugmentation) {
         Set<String> ipSet = new HashSet<>();
         if (physicalSwitchAugmentation.getTunnelIps() != null) {
             for (TunnelIps ip: physicalSwitchAugmentation.getTunnelIps()) {
@@ -171,15 +171,15 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
     }
 
     @SuppressWarnings("unchecked")
-    private void setTunnels(TransactionBuilder transaction, InstanceIdentifier<Node> iid,
-                    PhysicalSwitch physicalSwitch, PhysicalSwitchAugmentation physicalSwitchAugmentation,
-                    boolean switchExists) {
+    private void setTunnels(final TransactionBuilder transaction, final InstanceIdentifier<Node> iid,
+            final PhysicalSwitch physicalSwitch, final PhysicalSwitchAugmentation physicalSwitchAugmentation,
+            final boolean switchExists) {
         //TODO: revisit this code for optimizations
         //TODO: needs more testing
         if (physicalSwitchAugmentation.getTunnels() != null) {
             for (Tunnels tunnel : physicalSwitchAugmentation.getTunnels()) {
                 Optional<Tunnels> opTunnelOpt = getOperationalState().getTunnels(iid, tunnel.key());
-                Tunnel newTunnel = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Tunnel.class);
+                Tunnel newTunnel = transaction.getTypedRowWrapper(Tunnel.class);
 
                 UUID localUUID = getLocatorUUID(transaction,
                                 (InstanceIdentifier<TerminationPoint>) tunnel.getLocalLocatorRef().getValue());
@@ -201,9 +201,7 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
                             LOG.warn("Tunnel configuration requires pre-existing physicalSwitch");
                         } else {
                             // TODO: Can we reuse physicalSwitch instead?
-                            PhysicalSwitch phySwitch =
-                                            TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                                                            PhysicalSwitch.class);
+                            PhysicalSwitch phySwitch = transaction.getTypedRowWrapper(PhysicalSwitch.class);
                             phySwitch.setTunnels(Collections.singleton(new UUID(tunnelUuid)));
                             phySwitch.setName(physicalSwitchAugmentation.getHwvtepNodeName().getValue());
                             transaction.add(op.mutate(phySwitch)
@@ -216,8 +214,7 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
                         }
                     } else {
                         UUID uuid = new UUID(opTunnelOpt.get().getTunnelUuid().getValue());
-                        Tunnel extraTunnel =
-                                TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Tunnel.class, null);
+                        Tunnel extraTunnel = transaction.getTypedRowSchema(Tunnel.class);
                         extraTunnel.getUuidColumn().setData(uuid);
                         transaction.add(op.update(newTunnel)
                                         .where(extraTunnel.getUuidColumn().getSchema().opEqual(uuid))
@@ -229,7 +226,7 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         }
     }
 
-    private void setBfdParams(Tunnel tunnel, Tunnels psAugTunnel) {
+    private static void setBfdParams(final Tunnel tunnel, final Tunnels psAugTunnel) {
         List<BfdParams> bfdParams = psAugTunnel.getBfdParams();
         if (bfdParams != null) {
             Map<String, String> bfdParamMap = new HashMap<>();
@@ -244,7 +241,7 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         }
     }
 
-    private void setBfdLocalConfigs(Tunnel tunnel, Tunnels psAugTunnel) {
+    private static void setBfdLocalConfigs(final Tunnel tunnel, final Tunnels psAugTunnel) {
         List<BfdLocalConfigs> bfdLocalConfigs = psAugTunnel.getBfdLocalConfigs();
         if (bfdLocalConfigs != null) {
             Map<String, String> configLocalMap = new HashMap<>();
@@ -259,7 +256,7 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         }
     }
 
-    private void setBfdRemoteConfigs(Tunnel tunnel, Tunnels psAugTunnel) {
+    private static void setBfdRemoteConfigs(final Tunnel tunnel, final Tunnels psAugTunnel) {
         List<BfdRemoteConfigs> bfdRemoteConfigs = psAugTunnel.getBfdRemoteConfigs();
         if (bfdRemoteConfigs != null) {
             Map<String, String> configRemoteMap = new HashMap<>();
@@ -274,7 +271,7 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         }
     }
 
-    private UUID getLocatorUUID(TransactionBuilder transaction, InstanceIdentifier<TerminationPoint> iid) {
+    private UUID getLocatorUUID(final TransactionBuilder transaction, final InstanceIdentifier<TerminationPoint> iid) {
         UUID locatorUUID = null;
         Optional<HwvtepPhysicalLocatorAugmentation> opLocOptional =
                         getOperationalState().getPhysicalLocatorAugmentation(iid);
@@ -296,8 +293,8 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         return locatorUUID;
     }
 
-    private Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> extractCreated(
-            Collection<DataTreeModification<Node>> changes, Class<PhysicalSwitchAugmentation> class1) {
+    private static Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> extractCreated(
+            final Collection<DataTreeModification<Node>> changes, final Class<PhysicalSwitchAugmentation> class1) {
         Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> result = new HashMap<>();
         if (changes != null && !changes.isEmpty()) {
             for (DataTreeModification<Node> change : changes) {
@@ -316,8 +313,8 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         return result;
     }
 
-    private Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> extractUpdatedSwitches(
-            Collection<DataTreeModification<Node>> changes, Class<PhysicalSwitchAugmentation> class1) {
+    private static Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> extractUpdatedSwitches(
+            final Collection<DataTreeModification<Node>> changes, final Class<PhysicalSwitchAugmentation> class1) {
         Map<InstanceIdentifier<Node>, PhysicalSwitchAugmentation> result = new HashMap<>();
         if (changes != null && !changes.isEmpty()) {
             for (DataTreeModification<Node> change : changes) {
index a1f3ff02092cd817db0155ef52e988d893ac19bb..2c66faac49f12636781f5c045d7e0736c10c34b0 100644 (file)
@@ -26,7 +26,6 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundConstants;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundMapper;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocatorSet;
 import org.opendaylight.ovsdb.utils.mdsal.utils.ControllerMdsalUtils;
@@ -52,7 +51,7 @@ public final class TransactUtils {
     private TransactUtils(){
     }
 
-    public static Node getCreated(DataObjectModification<Node> mod) {
+    public static Node getCreated(final DataObjectModification<Node> mod) {
         if (mod.getModificationType() == ModificationType.WRITE
                         && mod.getDataBefore() == null) {
             return mod.getDataAfter();
@@ -60,14 +59,14 @@ public final class TransactUtils {
         return null;
     }
 
-    public static Node getRemoved(DataObjectModification<Node> mod) {
+    public static Node getRemoved(final DataObjectModification<Node> mod) {
         if (mod.getModificationType() == ModificationType.DELETE) {
             return mod.getDataBefore();
         }
         return null;
     }
 
-    public static Node getUpdated(DataObjectModification<Node> mod) {
+    public static Node getUpdated(final DataObjectModification<Node> mod) {
         Node node = null;
         switch (mod.getModificationType()) {
             case SUBTREE_MODIFIED:
@@ -84,7 +83,7 @@ public final class TransactUtils {
         return node;
     }
 
-    public static Node getOriginal(DataObjectModification<Node> mod) {
+    public static Node getOriginal(final DataObjectModification<Node> mod) {
         Node node = null;
         switch (mod.getModificationType()) {
             case SUBTREE_MODIFIED:
@@ -104,7 +103,7 @@ public final class TransactUtils {
 
     //TODO: change this function to be generic
     public static Map<InstanceIdentifier<Node>, Node> extractCreatedOrUpdatedOrRemoved(
-            Collection<DataTreeModification<Node>> changes, Class<Node> class1) {
+            final Collection<DataTreeModification<Node>> changes, final Class<Node> class1) {
         Map<InstanceIdentifier<Node>, Node> result = new HashMap<>();
         for (DataTreeModification<Node> change : changes) {
             final InstanceIdentifier<Node> key = change.getRootPath().getRootIdentifier();
@@ -125,10 +124,10 @@ public final class TransactUtils {
         return result;
     }
 
-    public static UUID createPhysicalLocatorSet(HwvtepOperationalState hwvtepOperationalState,
-            TransactionBuilder transaction, List<LocatorSet> locatorList) {
+    public static UUID createPhysicalLocatorSet(final HwvtepOperationalState hwvtepOperationalState,
+            final TransactionBuilder transaction, final List<LocatorSet> locatorList) {
         Set<UUID> locators = new HashSet<>();
-        Set<String> locatorsInfo = new HashSet<String>();
+        Set<String> locatorsInfo = new HashSet<>();
         for (LocatorSet locator: locatorList) {
             @SuppressWarnings("unchecked")
             InstanceIdentifier<TerminationPoint> iid =
@@ -139,8 +138,7 @@ public final class TransactUtils {
                 addLocatorToTransactionHistory(hwvtepOperationalState, locatorsInfo, iid);
             }
         }
-        PhysicalLocatorSet physicalLocatorSet = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                PhysicalLocatorSet.class);
+        PhysicalLocatorSet physicalLocatorSet = transaction.getTypedRowWrapper(PhysicalLocatorSet.class);
         physicalLocatorSet.setLocators(locators);
         String locatorSetUuid = "PhysicalLocatorSet_" + HwvtepSouthboundMapper.getRandomUUID();
         transaction.add(op.insert(physicalLocatorSet).withId(locatorSetUuid));
@@ -150,8 +148,9 @@ public final class TransactUtils {
         return new UUID(locatorSetUuid);
     }
 
-    public static UUID createPhysicalLocator(TransactionBuilder transaction, HwvtepOperationalState operationalState,
-                                             InstanceIdentifier<TerminationPoint> iid) {
+    public static UUID createPhysicalLocator(final TransactionBuilder transaction,
+                                             final HwvtepOperationalState operationalState,
+                                             final InstanceIdentifier<TerminationPoint> iid) {
         UUID locatorUuid = null;
         HwvtepDeviceInfo.DeviceData deviceData = operationalState.getDeviceInfo().getDeviceOperData(
                 TerminationPoint.class, iid);
@@ -176,12 +175,11 @@ public final class TransactUtils {
         return locatorUuid;
     }
 
-    public static UUID createPhysicalLocator(TransactionBuilder transaction,
-                                             HwvtepPhysicalLocatorAugmentation inputLocator,
-                                             HwvtepOperationalState hwvtepOperationalState) {
+    public static UUID createPhysicalLocator(final TransactionBuilder transaction,
+                                             final HwvtepPhysicalLocatorAugmentation inputLocator,
+                                             final HwvtepOperationalState hwvtepOperationalState) {
         LOG.debug("Creating a physical locator: {}", inputLocator.getDstIp());
-        PhysicalLocator physicalLocator = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                PhysicalLocator.class);
+        PhysicalLocator physicalLocator = transaction.getTypedRowWrapper(PhysicalLocator.class);
         setEncapsulationType(physicalLocator, inputLocator);
         setDstIp(physicalLocator, inputLocator);
         String locatorUuid = "PhysicalLocator_" + HwvtepSouthboundMapper.getRandomUUID();
@@ -191,8 +189,8 @@ public final class TransactUtils {
         return new UUID(locatorUuid);
     }
 
-    private static void setEncapsulationType(PhysicalLocator physicalLocator,
-            HwvtepPhysicalLocatorAugmentation inputLocator) {
+    private static void setEncapsulationType(final PhysicalLocator physicalLocator,
+            final HwvtepPhysicalLocatorAugmentation inputLocator) {
         if (inputLocator.getEncapsulationType() != null) {
             String encapType = HwvtepSouthboundConstants.ENCAPS_TYPE_MAP.get(
                     HwvtepSouthboundMapper.createEncapsulationType(""));
@@ -200,27 +198,27 @@ public final class TransactUtils {
         }
     }
 
-    private static void setDstIp(PhysicalLocator physicalLocator,
-            HwvtepPhysicalLocatorAugmentation inputLocator) {
+    private static void setDstIp(final PhysicalLocator physicalLocator,
+            final HwvtepPhysicalLocatorAugmentation inputLocator) {
         if (inputLocator.getDstIp() != null) {
             physicalLocator.setDstIp(inputLocator.getDstIp().getIpv4Address().getValue());
         }
     }
 
-    static String sanitizeUUID(HwvtepNodeName hwvtepNodeName) {
+    static String sanitizeUUID(final HwvtepNodeName hwvtepNodeName) {
         return sanitizeUUID(hwvtepNodeName.getValue());
     }
 
-    static String sanitizeUUID(String nodeName) {
+    static String sanitizeUUID(final String nodeName) {
         //ovs is not accepting '-' in the named uuids
         return nodeName.replaceAll("-", "_");
     }
 
-    public static String getLogicalSwitchId(LogicalSwitches lswitch) {
+    public static String getLogicalSwitchId(final LogicalSwitches lswitch) {
         return HwvtepSouthboundConstants.LOGICALSWITCH_UUID_PREFIX + sanitizeUUID(lswitch.getHwvtepNodeName());
     }
 
-    public static UUID getLogicalSwitchUUID(InstanceIdentifier<LogicalSwitches> lswitchIid) {
+    public static UUID getLogicalSwitchUUID(final InstanceIdentifier<LogicalSwitches> lswitchIid) {
         return new UUID(HwvtepSouthboundConstants.LOGICALSWITCH_UUID_PREFIX
                 + sanitizeUUID(lswitchIid.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName()));
     }
@@ -261,8 +259,8 @@ public final class TransactUtils {
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
-    private static void addLocatorToTransactionHistory(HwvtepOperationalState hwvtepOperationalState,
-                                                 Set<String> locatorsInfo, InstanceIdentifier<TerminationPoint> iid) {
+    private static void addLocatorToTransactionHistory(final HwvtepOperationalState hwvtepOperationalState,
+            final Set<String> locatorsInfo, final InstanceIdentifier<TerminationPoint> iid) {
         try {
             HwvtepDeviceInfo.DeviceData deviceData = hwvtepOperationalState.getDeviceInfo().getDeviceOperData(
                     TerminationPoint.class, iid);
index d7142d01cc023d027d60106658c411ede81d7910..a3a06b111485c6be4a0bc66798a5061e5b8766c7 100644 (file)
@@ -19,7 +19,6 @@ import java.util.Map.Entry;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsLocal;
 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.hwvtep.global.attributes.LocalUcastMacs;
@@ -31,13 +30,13 @@ import org.slf4j.LoggerFactory;
 public class UcastMacsLocalRemoveCommand extends AbstractTransactCommand<LocalUcastMacs, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(UcastMacsLocalRemoveCommand.class);
 
-    public UcastMacsLocalRemoveCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public UcastMacsLocalRemoveCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<LocalUcastMacs>> removeds =
                 extractRemoved(getChanges(),LocalUcastMacs.class);
         if (!removeds.isEmpty()) {
@@ -48,14 +47,13 @@ public class UcastMacsLocalRemoveCommand extends AbstractTransactCommand<LocalUc
         }
     }
 
-    private void removeUcastMacLocal(TransactionBuilder transaction,
-            InstanceIdentifier<Node> instanceIdentifier, List<LocalUcastMacs> macList) {
+    private void removeUcastMacLocal(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> instanceIdentifier, final List<LocalUcastMacs> macList) {
         for (LocalUcastMacs mac: macList) {
             LOG.debug("Removing remoteUcastMacs, mac address: {}", mac.getMacEntryKey().getValue());
             Optional<LocalUcastMacs> operationalMacOptional =
                     getOperationalState().getLocalUcastMacs(instanceIdentifier, mac.key());
-            UcastMacsLocal ucastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    UcastMacsLocal.class, null);
+            UcastMacsLocal ucastMacsLocal = transaction.getTypedRowSchema(UcastMacsLocal.class);
             if (operationalMacOptional.isPresent() && operationalMacOptional.get().getMacEntryUuid() != null) {
                 //when mac entry is deleted, its referenced locators are deleted automatically.
                 //locators in config DS is not deleted and user need to be removed explicitly by user.
@@ -72,7 +70,7 @@ public class UcastMacsLocalRemoveCommand extends AbstractTransactCommand<LocalUc
     }
 
     @Override
-    protected List<LocalUcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<LocalUcastMacs> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getLocalUcastMacs();
     }
 
@@ -90,12 +88,12 @@ public class UcastMacsLocalRemoveCommand extends AbstractTransactCommand<LocalUc
 
     public static class MacDependencyGetter extends UnMetDependencyGetter<LocalUcastMacs> {
         @Override
-        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(LocalUcastMacs data) {
+        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(final LocalUcastMacs data) {
             return Collections.singletonList(data.getLogicalSwitchRef().getValue());
         }
 
         @Override
-        public List<InstanceIdentifier<?>> getTerminationPointDependencies(LocalUcastMacs data) {
+        public List<InstanceIdentifier<?>> getTerminationPointDependencies(final LocalUcastMacs data) {
             return Collections.emptyList();
         }
     }
index 6bc9d65c891e902028347ff2cfcaa2cfce57c9e2..9c8130ca988bb8d9f837e7a815867e7446bac2a2 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -19,7 +18,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsLocal;
 import org.opendaylight.ovsdb.utils.mdsal.utils.ControllerMdsalUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
@@ -36,13 +34,13 @@ import org.slf4j.LoggerFactory;
 public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalUcastMacs, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(UcastMacsLocalUpdateCommand.class);
 
-    public UcastMacsLocalUpdateCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public UcastMacsLocalUpdateCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<LocalUcastMacs>> updateds =
                 extractUpdated(getChanges(),LocalUcastMacs.class);
         if (!updateds.isEmpty()) {
@@ -53,14 +51,13 @@ public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalUc
         }
     }
 
-    private void updateUcastMacsLocal(TransactionBuilder transaction,
-            InstanceIdentifier<Node> instanceIdentifier, List<LocalUcastMacs> localUcastMacs) {
+    private void updateUcastMacsLocal(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> instanceIdentifier, final List<LocalUcastMacs> localUcastMacs) {
         for (LocalUcastMacs localUcastMac: localUcastMacs) {
             LOG.debug("Creating localUcastMacs, mac address: {}", localUcastMac.getMacEntryKey().getValue());
             final Optional<LocalUcastMacs> operationalMacOptional =
                     getOperationalState().getLocalUcastMacs(instanceIdentifier, localUcastMac.key());
-            UcastMacsLocal ucastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    UcastMacsLocal.class);
+            UcastMacsLocal ucastMacsLocal = transaction.getTypedRowWrapper(UcastMacsLocal.class);
             setIpAddress(ucastMacsLocal, localUcastMac);
             setLocator(transaction, ucastMacsLocal, localUcastMac);
             setLogicalSwitch(ucastMacsLocal, localUcastMac);
@@ -71,8 +68,7 @@ public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalUc
                 transaction.add(op.comment("UcastMacLocal: Creating " + localUcastMac.getMacEntryKey().getValue()));
             } else if (operationalMacOptional.get().getMacEntryUuid() != null) {
                 UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
-                UcastMacsLocal extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                                UcastMacsLocal.class, null);
+                UcastMacsLocal extraMac = transaction.getTypedRowSchema(UcastMacsLocal.class);
                 extraMac.getUuidColumn().setData(macEntryUUID);
                 LOG.trace("execute: updating LocalUcastMac entry: {}", ucastMacsLocal);
                 transaction.add(op.update(ucastMacsLocal)
@@ -86,7 +82,7 @@ public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalUc
         }
     }
 
-    private void setLogicalSwitch(UcastMacsLocal ucastMacsLocal, LocalUcastMacs inputMac) {
+    private void setLogicalSwitch(final UcastMacsLocal ucastMacsLocal, final LocalUcastMacs inputMac) {
         if (inputMac.getLogicalSwitchRef() != null) {
             @SuppressWarnings("unchecked")
             InstanceIdentifier<LogicalSwitches> lswitchIid =
@@ -105,7 +101,8 @@ public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalUc
         }
     }
 
-    private void setLocator(TransactionBuilder transaction, UcastMacsLocal ucastMacsLocal, LocalUcastMacs inputMac) {
+    private void setLocator(final TransactionBuilder transaction, final UcastMacsLocal ucastMacsLocal,
+            final LocalUcastMacs inputMac) {
         //get UUID by locatorRef
         if (inputMac.getLocatorRef() != null) {
             UUID locatorUuid = null;
@@ -139,14 +136,14 @@ public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalUc
         }
     }
 
-    private void setIpAddress(UcastMacsLocal ucastMacsLocal, LocalUcastMacs inputMac) {
+    private static void setIpAddress(final UcastMacsLocal ucastMacsLocal, final LocalUcastMacs inputMac) {
         if (inputMac.getIpaddr() != null) {
             ucastMacsLocal.setIpAddress(inputMac.getIpaddr().getIpv4Address().getValue());
         }
     }
 
-    private void setMac(UcastMacsLocal ucastMacsLocal, LocalUcastMacs inputMac,
-            Optional<LocalUcastMacs> inputSwitchOptional) {
+    private static void setMac(final UcastMacsLocal ucastMacsLocal, final LocalUcastMacs inputMac,
+            final Optional<LocalUcastMacs> inputSwitchOptional) {
         if (inputMac.getMacEntryKey() != null) {
             ucastMacsLocal.setMac(inputMac.getMacEntryKey().getValue());
         } else if (inputSwitchOptional.isPresent() && inputSwitchOptional.get().getMacEntryKey() != null) {
@@ -155,8 +152,7 @@ public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand<LocalUc
     }
 
     @Override
-    protected List<LocalUcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<LocalUcastMacs> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getLocalUcastMacs();
     }
-
 }
index f98f135434aed25ab091ab5fca33532fc9e93d39..008b2e12dc5e38af76f7cee1b87bc923f8f9e650 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -18,7 +17,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsRemote;
 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.hwvtep.global.attributes.LogicalSwitches;
@@ -31,13 +29,13 @@ import org.slf4j.LoggerFactory;
 public class UcastMacsRemoteRemoveCommand extends AbstractTransactCommand<RemoteUcastMacs, HwvtepGlobalAugmentation> {
     private static final Logger LOG = LoggerFactory.getLogger(UcastMacsRemoteRemoveCommand.class);
 
-    public UcastMacsRemoteRemoveCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public UcastMacsRemoteRemoveCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<RemoteUcastMacs>> removeds =
                 extractRemoved(getChanges(),RemoteUcastMacs.class);
         if (!removeds.isEmpty()) {
@@ -79,8 +77,7 @@ public class UcastMacsRemoteRemoveCommand extends AbstractTransactCommand<Remote
                 .child(RemoteUcastMacs.class, mac.key());
         HwvtepDeviceInfo.DeviceData deviceData =
                 getOperationalState().getDeviceInfo().getDeviceOperData(RemoteUcastMacs.class, macIid);
-        UcastMacsRemote ucastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                UcastMacsRemote.class, null);
+        UcastMacsRemote ucastMacsRemote = transaction.getTypedRowSchema(UcastMacsRemote.class);
         if (deviceData != null && deviceData.getUuid() != null) {
             //when mac entry is deleted, its referenced locators are deleted automatically.
             //locators in config DS is not deleted and need to be removed explicitly by user.
@@ -97,7 +94,7 @@ public class UcastMacsRemoteRemoveCommand extends AbstractTransactCommand<Remote
     }
 
     @Override
-    protected List<RemoteUcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<RemoteUcastMacs> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getRemoteUcastMacs();
     }
 
index 3731a63fb996ac16b53768edf0b3b265dfe9e7e2..e845cfd600c579ebe2d3dca88714e42493054a75 100644 (file)
@@ -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.hwvtepsouthbound.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -19,7 +18,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsRemote;
 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.hwvtep.global.attributes.LogicalSwitches;
@@ -34,13 +32,13 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
     private static final Logger LOG = LoggerFactory.getLogger(UcastMacsRemoteUpdateCommand.class);
     private static final UcastMacUnMetDependencyGetter UCAST_MAC_DATA_VALIDATOR = new UcastMacUnMetDependencyGetter();
 
-    public UcastMacsRemoteUpdateCommand(HwvtepOperationalState state,
-            Collection<DataTreeModification<Node>> changes) {
+    public UcastMacsRemoteUpdateCommand(final HwvtepOperationalState state,
+            final Collection<DataTreeModification<Node>> changes) {
         super(state, changes);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction) {
+    public void execute(final TransactionBuilder transaction) {
         Map<InstanceIdentifier<Node>, List<RemoteUcastMacs>> updateds =
                 extractUpdated(getChanges(),RemoteUcastMacs.class);
         if (!updateds.isEmpty()) {
@@ -83,8 +81,7 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
         final HwvtepDeviceInfo.DeviceData deviceData =
                 getOperationalState().getDeviceInfo().getDeviceOperData(RemoteUcastMacs.class, macKey);
 
-        UcastMacsRemote ucastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                UcastMacsRemote.class);
+        UcastMacsRemote ucastMacsRemote = transaction.getTypedRowWrapper(UcastMacsRemote.class);
         setIpAddress(ucastMacsRemote, remoteUcastMac);
         setLocator(transaction, ucastMacsRemote, remoteUcastMac);
         setLogicalSwitch(transaction, ucastMacsRemote, remoteUcastMac);
@@ -96,8 +93,7 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
             updateCurrentTxData(RemoteUcastMacs.class, macKey, new UUID("uuid"), remoteUcastMac);
         } else if (deviceData.getUuid() != null) {
             UUID macEntryUUID = deviceData.getUuid();
-            UcastMacsRemote extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    UcastMacsRemote.class, null);
+            UcastMacsRemote extraMac = transaction.getTypedRowSchema(UcastMacsRemote.class);
             extraMac.getUuidColumn().setData(macEntryUUID);
             LOG.trace("doDeviceTransaction: updating RemotUcastMac entry: {}", ucastMacsRemote);
             transaction.add(op.update(ucastMacsRemote)
@@ -120,7 +116,8 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
         }
     }
 
-    private void setLocator(TransactionBuilder transaction, UcastMacsRemote ucastMacsRemote, RemoteUcastMacs inputMac) {
+    private void setLocator(final TransactionBuilder transaction, final UcastMacsRemote ucastMacsRemote,
+            final RemoteUcastMacs inputMac) {
         //get UUID by locatorRef
         if (inputMac.getLocatorRef() != null) {
             @SuppressWarnings("unchecked")
@@ -133,27 +130,27 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
         }
     }
 
-    private void setIpAddress(UcastMacsRemote ucastMacsRemote, RemoteUcastMacs inputMac) {
+    private static void setIpAddress(final UcastMacsRemote ucastMacsRemote, final RemoteUcastMacs inputMac) {
         if (inputMac.getIpaddr() != null) {
             ucastMacsRemote.setIpAddress(inputMac.getIpaddr().getIpv4Address().getValue());
         }
     }
 
-    private void setMac(UcastMacsRemote ucastMacsRemote, RemoteUcastMacs inputMac) {
+    private static void setMac(final UcastMacsRemote ucastMacsRemote, final RemoteUcastMacs inputMac) {
         if (inputMac.getMacEntryKey() != null) {
             ucastMacsRemote.setMac(inputMac.getMacEntryKey().getValue());
         }
     }
 
     @Override
-    protected List<RemoteUcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
+    protected List<RemoteUcastMacs> getData(final HwvtepGlobalAugmentation augmentation) {
         return augmentation.getRemoteUcastMacs();
     }
 
     static class UcastMacUnMetDependencyGetter extends UnMetDependencyGetter<RemoteUcastMacs> {
 
         @Override
-        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(RemoteUcastMacs data) {
+        public List<InstanceIdentifier<?>> getLogicalSwitchDependencies(final RemoteUcastMacs data) {
             if (data == null) {
                 return Collections.emptyList();
             }
@@ -161,7 +158,7 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand<Remote
         }
 
         @Override
-        public List<InstanceIdentifier<?>> getTerminationPointDependencies(RemoteUcastMacs data) {
+        public List<InstanceIdentifier<?>> getTerminationPointDependencies(final RemoteUcastMacs data) {
             if (data == null) {
                 return Collections.emptyList();
             }
index 0f17a1f226333b4e52095f16433bcc1f91fd540c..4b5b4f2e112398c0195e6ece8b34b4f51aa1dabc 100644 (file)
@@ -5,31 +5,33 @@
  * 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 static java.util.Objects.requireNonNull;
+
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.ovsdb.lib.OvsdbClient;
 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 
 public class TransactionBuilder {
+    private final List<Operation> operations = new ArrayList<>();
+    private final @NonNull DatabaseSchema databaseSchema;
+    private final OvsdbClient ovs;
 
-    private DatabaseSchema databaseSchema;
-    OvsdbClient ovs;
-    List<Operation> operations = new ArrayList<>();
-
-    public TransactionBuilder(OvsdbClient ovs, DatabaseSchema schema) {
+    public TransactionBuilder(final OvsdbClient ovs, final DatabaseSchema schema) {
         this.ovs = ovs;
-        databaseSchema = schema;
+        this.databaseSchema = requireNonNull(schema);
     }
 
     public List<Operation> getOperations() {
         return operations;
     }
 
-    public TransactionBuilder add(Operation operation) {
+    public TransactionBuilder add(final Operation operation) {
         operations.add(operation);
         return this;
     }
@@ -42,7 +44,15 @@ public class TransactionBuilder {
         return ovs.transact(databaseSchema, operations);
     }
 
-    public DatabaseSchema getDatabaseSchema() {
+    public @NonNull DatabaseSchema getDatabaseSchema() {
         return databaseSchema;
     }
+
+    public <T> T getTypedRowWrapper(final Class<T> klazz) {
+        return TyperUtils.getTypedRowWrapper(databaseSchema, klazz);
+    }
+
+    public <T> T getTypedRowSchema(final Class<T> klazz) {
+        return TyperUtils.getTypedRowWrapper(databaseSchema, klazz, null);
+    }
 }
index 44f610133f29728b174dfab420829ce232c5c6ec..6ce57b71dc22ab9c141dc4be94980552bced74a2 100644 (file)
@@ -72,6 +72,7 @@ public final class TyperUtils {
      * @param dbSchema DatabaseSchema as learnt from a OVSDB connection
      * @param klazz Typed Class that represents a Table
      */
+    @Deprecated
     public static <T> T getTypedRowWrapper(final DatabaseSchema dbSchema, final Class<T> klazz) {
         return getTypedRowWrapper(dbSchema, klazz, new Row<>());
     }
@@ -95,6 +96,7 @@ public final class TyperUtils {
      * @param row The actual Row that the wrapper is operating on. It can be null if the caller
      *            is just interested in getting ColumnSchema.
      */
+    @Deprecated
     public static <T> T getTypedRowWrapper(final DatabaseSchema dbSchema, final Class<T> klazz,
                                            final Row<GenericTableSchema> row) {
         return dbSchema == null ? null : getTyped(dbSchema).getTypedRowWrapper(klazz, row);
index 5655489db306f2f7762e868032838f30d7f28792..d0ddd88d404775be842ed9ec92c577eaa53187ea 100644 (file)
@@ -45,7 +45,6 @@ import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
 import org.opendaylight.ovsdb.lib.schema.TableSchema;
 import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
 import org.opendaylight.ovsdb.lib.schema.typed.TypedDatabaseSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.southbound.ovsdb.transact.BridgeOperationalState;
 import org.opendaylight.ovsdb.southbound.ovsdb.transact.DataChangeEvent;
@@ -196,7 +195,7 @@ public class OvsdbConnectionInstance {
             TransactionBuilder transaction = new TransactionBuilder(this.client, entry.getKey());
 
             // OpenVSwitchPart
-            OpenVSwitch ovs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), OpenVSwitch.class);
+            OpenVSwitch ovs = transaction.getTypedRowWrapper(OpenVSwitch.class);
 
             List<OpenvswitchExternalIds> externalIds = this.initialCreateData.getOpenvswitchExternalIds();
 
@@ -238,7 +237,7 @@ public class OvsdbConnectionInstance {
 
     private static void stampInstanceIdentifier(final TransactionBuilder transaction,final InstanceIdentifier<Node> iid,
             final InstanceIdentifierCodec instanceIdentifierCodec) {
-        OpenVSwitch ovs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), OpenVSwitch.class);
+        OpenVSwitch ovs = transaction.getTypedRowWrapper(OpenVSwitch.class);
         ovs.setExternalIds(Collections.emptyMap());
         TransactUtils.stampInstanceIdentifier(transaction, iid, ovs.getSchema(), ovs.getExternalIdsColumn().getSchema(),
                 instanceIdentifierCodec);
index 91905ca84455b2874f0890b83a0fca6a2064ab71..db89248c34e103095b00833f2d9ade9f719065f5 100644 (file)
@@ -48,7 +48,6 @@ import org.opendaylight.ovsdb.lib.operations.OperationResult;
 import org.opendaylight.ovsdb.lib.operations.Select;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
 import org.opendaylight.ovsdb.lib.schema.typed.TypedDatabaseSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.southbound.reconciliation.ReconciliationManager;
 import org.opendaylight.ovsdb.southbound.reconciliation.ReconciliationTask;
@@ -530,7 +529,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos
         }
 
         return results == null || results.isEmpty() ? null
-                : TyperUtils.getTypedRowWrapper(dbSchema, OpenVSwitch.class, results.get(0).getRows().get(0));
+                : dbSchema.getTypedRowWrapper(OpenVSwitch.class, results.get(0).getRows().get(0));
     }
 
     private Entity getEntityFromConnectionInstance(@NonNull final OvsdbConnectionInstance ovsdbConnectionInstance) {
index cfba85621a97d2964529c5f265557e85c62f55aa..99bcca1c76e2f72dc6aeca3226121b80721e5de6 100644 (file)
@@ -28,7 +28,7 @@ import org.opendaylight.ovsdb.lib.OvsdbClient;
 import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedDatabaseSchema;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Controller;
 import org.opendaylight.ovsdb.schema.openvswitch.Manager;
@@ -77,7 +77,7 @@ public final class SouthboundMapper {
 
     }
 
-    public static IpAddress createIpAddress(InetAddress address) {
+    public static IpAddress createIpAddress(final InetAddress address) {
         IpAddress ip = null;
         if (address instanceof Inet4Address) {
             ip = createIpAddress((Inet4Address)address);
@@ -87,11 +87,11 @@ public final class SouthboundMapper {
         return ip;
     }
 
-    public static IpAddress createIpAddress(Inet4Address address) {
+    public static IpAddress createIpAddress(final Inet4Address address) {
         return IetfInetUtil.INSTANCE.ipAddressFor(address);
     }
 
-    public static IpAddress createIpAddress(Inet6Address address) {
+    public static IpAddress createIpAddress(final Inet6Address address) {
         Ipv6Address ipv6 = new Ipv6Address(address.getHostAddress());
         return new IpAddress(ipv6);
     }
@@ -102,14 +102,15 @@ public final class SouthboundMapper {
                 .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));
     }
 
-    public static InstanceIdentifier<Node> createInstanceIdentifier(NodeId nodeId) {
+    public static InstanceIdentifier<Node> createInstanceIdentifier(final NodeId nodeId) {
         return createTopologyInstanceIdentifier()
                 .child(Node.class,new NodeKey(nodeId));
     }
 
     @SuppressWarnings("unchecked")
-    public static InstanceIdentifier<Node> createInstanceIdentifier(InstanceIdentifierCodec instanceIdentifierCodec,
-            OvsdbConnectionInstance client, Bridge bridge) {
+    public static InstanceIdentifier<Node> createInstanceIdentifier(
+            final InstanceIdentifierCodec instanceIdentifierCodec, final OvsdbConnectionInstance client,
+            final Bridge bridge) {
         InstanceIdentifier<Node> iid;
         if (bridge.getExternalIdsColumn() != null
                 && bridge.getExternalIdsColumn().getData() != null
@@ -123,8 +124,9 @@ public final class SouthboundMapper {
     }
 
     @SuppressWarnings("unchecked")
-    public static InstanceIdentifier<Node> createInstanceIdentifier(InstanceIdentifierCodec instanceIdentifierCodec,
-            OvsdbConnectionInstance client, Controller controller, String bridgeName) {
+    public static InstanceIdentifier<Node> createInstanceIdentifier(
+            final InstanceIdentifierCodec instanceIdentifierCodec, final OvsdbConnectionInstance client,
+            final Controller controller, final String bridgeName) {
         InstanceIdentifier<Node> iid;
         if (controller.getExternalIdsColumn() != null
                 && controller.getExternalIdsColumn().getData() != null
@@ -138,7 +140,7 @@ public final class SouthboundMapper {
     }
 
     public static InstanceIdentifier<Node> createInstanceIdentifier(
-            OvsdbConnectionInstance client, String bridgeName) {
+            final OvsdbConnectionInstance client, final String bridgeName) {
         String nodeString = client.getNodeKey().getNodeId().getValue()
                 + "/bridge/" + bridgeName;
         NodeId nodeId = new NodeId(new Uri(nodeString));
@@ -146,12 +148,12 @@ public final class SouthboundMapper {
 
     }
 
-    public static NodeId createManagedNodeId(InstanceIdentifier<Node> iid) {
+    public static NodeId createManagedNodeId(final InstanceIdentifier<Node> iid) {
         NodeKey nodeKey = iid.firstKeyOf(Node.class);
         return nodeKey.getNodeId();
     }
 
-    public static InetAddress createInetAddress(IpAddress ip) throws UnknownHostException {
+    public static InetAddress createInetAddress(final IpAddress ip) throws UnknownHostException {
         if (ip.getIpv4Address() != null) {
             return InetAddresses.forString(ip.getIpv4Address().getValue());
         } else if (ip.getIpv6Address() != null) {
@@ -161,7 +163,7 @@ public final class SouthboundMapper {
         }
     }
 
-    public static DatapathId createDatapathId(Bridge bridge) {
+    public static DatapathId createDatapathId(final Bridge bridge) {
         Preconditions.checkNotNull(bridge);
         if (bridge.getDatapathIdColumn() == null) {
             return null;
@@ -170,7 +172,7 @@ public final class SouthboundMapper {
         }
     }
 
-    public static DatapathId createDatapathId(Set<String> dpids) {
+    public static DatapathId createDatapathId(final Set<String> dpids) {
         Preconditions.checkNotNull(dpids);
         if (dpids.isEmpty()) {
             return null;
@@ -181,7 +183,7 @@ public final class SouthboundMapper {
         }
     }
 
-    public static DatapathId createDatapathId(String dpid) {
+    public static DatapathId createDatapathId(final String dpid) {
         Preconditions.checkNotNull(dpid);
         DatapathId datapath;
         if (dpid.matches("^[0-9a-fA-F]{16}")) {
@@ -194,7 +196,7 @@ public final class SouthboundMapper {
         return datapath;
     }
 
-    public static String createDatapathType(OvsdbBridgeAugmentation mdsalbridge) {
+    public static String createDatapathType(final OvsdbBridgeAugmentation mdsalbridge) {
         String datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(DatapathTypeSystem.class);
 
         if (mdsalbridge.getDatapathType() != null && !mdsalbridge.getDatapathType().equals(DatapathTypeBase.class)) {
@@ -206,7 +208,7 @@ public final class SouthboundMapper {
         return datapathtype;
     }
 
-    public static  Class<? extends DatapathTypeBase> createDatapathType(String type) {
+    public static  Class<? extends DatapathTypeBase> createDatapathType(final String type) {
         Preconditions.checkNotNull(type);
         if (type.isEmpty()) {
             return DatapathTypeSystem.class;
@@ -217,7 +219,7 @@ public final class SouthboundMapper {
         }
     }
 
-    public static Set<String> createOvsdbBridgeProtocols(OvsdbBridgeAugmentation ovsdbBridgeNode) {
+    public static Set<String> createOvsdbBridgeProtocols(final OvsdbBridgeAugmentation ovsdbBridgeNode) {
         Set<String> protocols = new HashSet<>();
         if (ovsdbBridgeNode.getProtocolEntry() != null && ovsdbBridgeNode.getProtocolEntry().size() > 0) {
             for (ProtocolEntry protocol : ovsdbBridgeNode.getProtocolEntry()) {
@@ -231,19 +233,19 @@ public final class SouthboundMapper {
         return protocols;
     }
 
-    public static  Class<? extends InterfaceTypeBase> createInterfaceType(String type) {
+    public static  Class<? extends InterfaceTypeBase> createInterfaceType(final String type) {
         Preconditions.checkNotNull(type);
         return SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.get(type);
     }
 
-    public static String createOvsdbInterfaceType(Class<? extends InterfaceTypeBase> mdsaltype) {
+    public static String createOvsdbInterfaceType(final Class<? extends InterfaceTypeBase> mdsaltype) {
         Preconditions.checkNotNull(mdsaltype);
         ImmutableBiMap<Class<? extends InterfaceTypeBase>, String> mapper =
                 SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.inverse();
         return mapper.get(mdsaltype);
     }
 
-    public static List<ProtocolEntry> createMdsalProtocols(Bridge bridge) {
+    public static List<ProtocolEntry> createMdsalProtocols(final Bridge bridge) {
         Set<String> protocols = null;
         try {
             protocols = bridge.getProtocolsColumn().getData();
@@ -271,8 +273,8 @@ public final class SouthboundMapper {
      * @param updatedControllerRows the list of {@link Controller} controllers with updates
      * @return list of {@link ControllerEntry} entries
      */
-    public static List<ControllerEntry> createControllerEntries(Bridge bridge,
-                                                                Map<UUID, Controller> updatedControllerRows) {
+    public static List<ControllerEntry> createControllerEntries(final Bridge bridge,
+                                                                final Map<UUID, Controller> updatedControllerRows) {
 
         LOG.debug("createControllerEntries Bridge: {}\n, updatedControllerRows: {}",
                 bridge, updatedControllerRows);
@@ -294,8 +296,8 @@ public final class SouthboundMapper {
      * @param updatedControllerRows the list of {@link Controller} controllers with updates
      * @return list of {@link ControllerEntry} entries
      */
-    public static List<ControllerEntry> createControllerEntries(Node bridgeNode,
-                                                                Map<UUID, Controller> updatedControllerRows) {
+    public static List<ControllerEntry> createControllerEntries(final Node bridgeNode,
+                                                                final Map<UUID, Controller> updatedControllerRows) {
 
         LOG.debug("createControllerEntries Bridge 2: {}\n, updatedControllerRows: {}",
                 bridgeNode, updatedControllerRows);
@@ -324,7 +326,7 @@ public final class SouthboundMapper {
      * @param controllerEntries the list of {@link ControllerEntry} to update
      * @param controller the updated OVSDB {@link Controller}
      */
-    public static void addControllerEntries(List<ControllerEntry> controllerEntries,
+    public static void addControllerEntries(final List<ControllerEntry> controllerEntries,
                                             final Controller controller) {
 
         if (controller != null && controller.getTargetColumn() != null) {
@@ -350,13 +352,14 @@ public final class SouthboundMapper {
     }
 
     // This is not called from anywhere but test. Do we need this?
-    public static Map<UUID, Controller> createOvsdbController(OvsdbBridgeAugmentation omn,DatabaseSchema dbSchema) {
+    public static Map<UUID, Controller> createOvsdbController(final OvsdbBridgeAugmentation omn,
+            final DatabaseSchema dbSchema) {
         List<ControllerEntry> controllerEntries = omn.getControllerEntry();
         Map<UUID,Controller> controllerMap = new HashMap<>();
         if (controllerEntries != null && !controllerEntries.isEmpty()) {
             for (ControllerEntry controllerEntry : controllerEntries) {
                 String controllerNamedUuid = "Controller_" + getRandomUuid();
-                Controller controller = TyperUtils.getTypedRowWrapper(dbSchema, Controller.class);
+                Controller controller = TypedDatabaseSchema.of(dbSchema).getTypedRowWrapper(Controller.class);
                 controller.setTarget(controllerEntry.getTarget().getValue());
                 controllerMap.put(new UUID(controllerNamedUuid), controller);
             }
@@ -368,7 +371,7 @@ public final class SouthboundMapper {
         return "Random_" + java.util.UUID.randomUUID().toString().replace("-", "");
     }
 
-    public static ConnectionInfo createConnectionInfo(OvsdbClient client) {
+    public static ConnectionInfo createConnectionInfo(final OvsdbClient client) {
         ConnectionInfoBuilder connectionInfoBuilder = new ConnectionInfoBuilder();
         connectionInfoBuilder.setRemoteIp(createIpAddress(client.getConnectionInfo().getRemoteAddress()));
         connectionInfoBuilder.setRemotePort(new PortNumber(client.getConnectionInfo().getRemotePort()));
@@ -377,7 +380,7 @@ public final class SouthboundMapper {
         return connectionInfoBuilder.build();
     }
 
-    public static ConnectionInfo suppressLocalIpPort(ConnectionInfo connectionInfo) {
+    public static ConnectionInfo suppressLocalIpPort(final ConnectionInfo connectionInfo) {
         ConnectionInfoBuilder connectionInfoBuilder = new ConnectionInfoBuilder();
         connectionInfoBuilder.setRemoteIp(connectionInfo.getRemoteIp());
         connectionInfoBuilder.setRemotePort(connectionInfo.getRemotePort());
@@ -392,8 +395,8 @@ public final class SouthboundMapper {
      * @param updatedManagerRows the list of {@link Manager} managers with updates
      * @return list of {@link ManagerEntry} entries
      */
-    public static List<ManagerEntry> createManagerEntries(OpenVSwitch ovsdbNode,
-                                                                Map<UUID, Manager> updatedManagerRows) {
+    public static List<ManagerEntry> createManagerEntries(final OpenVSwitch ovsdbNode,
+                                                                final Map<UUID, Manager> updatedManagerRows) {
 
         LOG.debug("createManagerEntries OpenVSwitch: {}\n, updatedManagerRows: {}",
                 ovsdbNode, updatedManagerRows);
@@ -415,8 +418,8 @@ public final class SouthboundMapper {
      * @param updatedManagerRows the list of {@link Manager} managers with updates
      * @return list of {@link ManagerEntry} entries
      */
-    public static List<ManagerEntry> createManagerEntries(Node ovsdbNode,
-                                                                Map<Uri, Manager> updatedManagerRows) {
+    public static List<ManagerEntry> createManagerEntries(final Node ovsdbNode,
+                                                                final Map<Uri, Manager> updatedManagerRows) {
 
         LOG.debug("createManagerEntries based on OVSDB Node: {}\n, updatedManagerRows: {}",
                 ovsdbNode, updatedManagerRows);
@@ -444,7 +447,7 @@ public final class SouthboundMapper {
      * @param managerEntries the list of {@link ManagerEntry} to update
      * @param manager the updated OVSDB {@link Manager}
      */
-    public static void addManagerEntries(List<ManagerEntry> managerEntries,
+    public static void addManagerEntries(final List<ManagerEntry> managerEntries,
                                             final Manager manager) {
 
         if (manager != null && manager.getTargetColumn() != null) {
@@ -475,7 +478,7 @@ public final class SouthboundMapper {
      * @param type the QoS type to match {@link String}
      * @return class matching the input QoS type {@link QosTypeBase}
      */
-    public static  Class<? extends QosTypeBase> createQosType(String type) {
+    public static  Class<? extends QosTypeBase> createQosType(final String type) {
         Preconditions.checkNotNull(type);
         if (type.isEmpty()) {
             LOG.info("QoS type not supplied");
@@ -492,7 +495,7 @@ public final class SouthboundMapper {
         }
     }
 
-    public static String createQosType(Class<? extends QosTypeBase> qosTypeClass) {
+    public static String createQosType(final Class<? extends QosTypeBase> qosTypeClass) {
         String qosType = SouthboundConstants.QOS_TYPE_MAP.get(QosTypeBase.class);
 
         if (qosTypeClass != null && !qosTypeClass.equals(QosTypeBase.class)) {
@@ -505,8 +508,8 @@ public final class SouthboundMapper {
     }
 
 
-    public static InstanceIdentifier<Node> getInstanceIdentifier(InstanceIdentifierCodec instanceIdentifierCodec,
-            OpenVSwitch ovs) {
+    public static InstanceIdentifier<Node> getInstanceIdentifier(final InstanceIdentifierCodec instanceIdentifierCodec,
+            final OpenVSwitch ovs) {
         if (ovs.getExternalIdsColumn() != null
                 && ovs.getExternalIdsColumn().getData() != null
                 && ovs.getExternalIdsColumn().getData().containsKey(SouthboundConstants.IID_EXTERNAL_ID_KEY)) {
index 0f382fa33ca728ed90d81d2e53769651536fa1f3..f266ef714af7a8fe86a7af10bc2e5f20ee585c32 100644 (file)
@@ -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.southbound.ovsdb.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -23,7 +22,6 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.AutoAttach;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
@@ -45,22 +43,23 @@ public class AutoAttachRemovedCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(AutoAttachRemovedCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractOriginal(modifications, OvsdbNodeAugmentation.class),
                 TransactUtils.extractUpdated(modifications, OvsdbNodeAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractOriginal(events, OvsdbNodeAugmentation.class),
                 TransactUtils.extractUpdated(events, OvsdbNodeAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                         Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> original,
-                         Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated) {
+    private void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+                         final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> original,
+                         final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated) {
 
         for (final Map.Entry<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originalEntry :
                 original.entrySet()) {
@@ -92,25 +91,22 @@ public class AutoAttachRemovedCommand implements TransactCommand {
         }
     }
 
-    private void deleteAutoAttach(TransactionBuilder transaction,
-            InstanceIdentifier<OvsdbNodeAugmentation> ovsdbNodeIid,
-            Uuid autoattachUuid) {
+    private void deleteAutoAttach(final TransactionBuilder transaction,
+            final InstanceIdentifier<OvsdbNodeAugmentation> ovsdbNodeIid,
+            final Uuid autoattachUuid) {
 
         LOG.debug("Received request to delete Autoattach entry {}", autoattachUuid);
         final OvsdbBridgeAugmentation bridgeAugmentation = getBridge(ovsdbNodeIid, autoattachUuid);
         if (autoattachUuid != null && bridgeAugmentation != null) {
             final UUID uuid = new UUID(autoattachUuid.getValue());
-            final AutoAttach autoattach =
-                    TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), AutoAttach.class, null);
+            final AutoAttach autoattach = transaction.getTypedRowSchema(AutoAttach.class);
             transaction.add(op.delete(autoattach.getSchema())
                     .where(autoattach.getUuidColumn().getSchema().opEqual(uuid))
                     .build());
             transaction.add(op.comment("AutoAttach: Deleting {} " + uuid
                     + " attached to " + bridgeAugmentation.getBridgeName().getValue()));
 
-            final Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                    Bridge.class,null);
-
+            final Bridge bridge = transaction.getTypedRowSchema(Bridge.class);
             transaction.add(op.mutate(bridge.getSchema())
                     .addMutation(bridge.getAutoAttachColumn().getSchema(),
                             Mutator.DELETE, Collections.singleton(uuid))
@@ -125,7 +121,7 @@ public class AutoAttachRemovedCommand implements TransactCommand {
         }
     }
 
-    private Uuid getAutoAttachUuid(List<Autoattach> currentAutoAttach, Uri autoAttachId) {
+    private Uuid getAutoAttachUuid(final List<Autoattach> currentAutoAttach, final Uri autoAttachId) {
         if (currentAutoAttach != null && !currentAutoAttach.isEmpty()) {
             for (final Autoattach autoAttach : currentAutoAttach) {
                 if (autoAttach.getAutoattachId().equals(autoAttachId)) {
@@ -136,7 +132,7 @@ public class AutoAttachRemovedCommand implements TransactCommand {
         return null;
     }
 
-    private OvsdbBridgeAugmentation getBridge(InstanceIdentifier<OvsdbNodeAugmentation> key, Uuid aaUuid) {
+    private OvsdbBridgeAugmentation getBridge(final InstanceIdentifier<OvsdbNodeAugmentation> key, final Uuid aaUuid) {
         if (aaUuid == null) {
             return null;
         }
index fbc512d9cae2cada4faf4a526f4d876d8056bb9c..6d90e93d347fe3c5c2c99eda07d2dcc5e04dc9a5 100644 (file)
@@ -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.southbound.ovsdb.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -25,7 +24,6 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.AutoAttach;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
@@ -54,19 +52,20 @@ public class AutoAttachUpdateCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(AutoAttachUpdateCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(events, OvsdbNodeAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(modifications, OvsdbNodeAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                         Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> createdOrUpdated) {
+    private void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+                         final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> createdOrUpdated) {
 
         for (final Entry<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> ovsdbNodeEntry
                 : createdOrUpdated.entrySet()) {
@@ -74,9 +73,9 @@ public class AutoAttachUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateAutoAttach(TransactionBuilder transaction, BridgeOperationalState state,
-            InstanceIdentifier<OvsdbNodeAugmentation> iid,
-            OvsdbNodeAugmentation ovsdbNode) {
+    private void updateAutoAttach(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final InstanceIdentifier<OvsdbNodeAugmentation> iid,
+            final OvsdbNodeAugmentation ovsdbNode) {
 
         if (!state.getBridgeNode(iid).isPresent()) {
             return;
@@ -94,8 +93,7 @@ public class AutoAttachUpdateCommand implements TransactCommand {
                     state.getBridgeNode(iid).get().augmentation(OvsdbNodeAugmentation.class);
             final List<Autoattach> currentAutoAttach = currentOvsdbNode.getAutoattach();
             for (final Autoattach autoAttach : autoAttachList) {
-                final AutoAttach autoAttachWrapper =
-                        TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), AutoAttach.class);
+                final AutoAttach autoAttachWrapper = transaction.getTypedRowWrapper(AutoAttach.class);
                 if (autoAttach.getSystemName() != null) {
                     autoAttachWrapper.setSystemName(autoAttach.getSystemName());
                 }
@@ -133,8 +131,7 @@ public class AutoAttachUpdateCommand implements TransactCommand {
                 final Uuid aaUuid = getAutoAttachUuid(currentAutoAttach, autoAttach.getAutoattachId());
                 if (aaUuid != null) {
                     final UUID uuid = new UUID(aaUuid.getValue());
-                    final AutoAttach newAutoAttach = TyperUtils.getTypedRowWrapper(
-                            transaction.getDatabaseSchema(), AutoAttach.class, null);
+                    final AutoAttach newAutoAttach = transaction.getTypedRowSchema(AutoAttach.class);
                     newAutoAttach.getUuidColumn().setData(uuid);
                     LOG.trace("Updating autoattach table entries {}", uuid);
                     transaction.add(op.update(autoAttachWrapper)
@@ -143,7 +140,7 @@ public class AutoAttachUpdateCommand implements TransactCommand {
                 } else {
                     final Uri bridgeUri = autoAttach.getBridgeId();
                     final String namedUuid = SouthboundMapper.getRandomUuid();
-                    final Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+                    final Bridge bridge = transaction.getTypedRowWrapper(Bridge.class);
                     transaction.add(op.insert(autoAttachWrapper).withId(namedUuid));
                     final OvsdbBridgeAugmentation ovsdbBridgeAugmentation = getBridge(iid, bridgeUri);
                     if (ovsdbBridgeAugmentation != null) {
@@ -165,8 +162,8 @@ public class AutoAttachUpdateCommand implements TransactCommand {
         }
     }
 
-    private OvsdbBridgeAugmentation getBridge(InstanceIdentifier<OvsdbNodeAugmentation> key,
-            Uri bridgeUri) {
+    private OvsdbBridgeAugmentation getBridge(final InstanceIdentifier<OvsdbNodeAugmentation> key,
+            final Uri bridgeUri) {
         final InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid = InstanceIdentifier
                 .create(NetworkTopology.class)
                 .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
@@ -186,7 +183,7 @@ public class AutoAttachUpdateCommand implements TransactCommand {
         return bridge;
     }
 
-    private Uuid getAutoAttachUuid(List<Autoattach> currentAutoAttach, Uri autoattachId) {
+    private Uuid getAutoAttachUuid(final List<Autoattach> currentAutoAttach, final Uri autoattachId) {
         if (currentAutoAttach != null && !currentAutoAttach.isEmpty()) {
             for (final Autoattach autoAttach : currentAutoAttach) {
                 if (autoAttach.getAutoattachId().equals(autoattachId)) {
index c06df98fe76aa93872bba91118344fca4547afdd..95b7ea1ae32aff515fc99959036ac345e1dc7270 100644 (file)
@@ -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.southbound.ovsdb.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -19,7 +18,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
@@ -33,33 +31,33 @@ public class BridgeRemovedCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(BridgeRemovedCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractRemoved(events, OvsdbBridgeAugmentation.class),
                 TransactUtils.extractOriginal(events, OvsdbBridgeAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractRemoved(modifications, OvsdbBridgeAugmentation.class),
                 TransactUtils.extractOriginal(modifications, OvsdbBridgeAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                         Set<InstanceIdentifier<OvsdbBridgeAugmentation>> removed,
-                         Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> originals) {
+    private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Set<InstanceIdentifier<OvsdbBridgeAugmentation>> removed,
+            final Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> originals) {
         for (InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbManagedNodeIid: removed) {
             LOG.debug("Received request to delete ovsdb node : {}",
                     ovsdbManagedNodeIid);
             OvsdbBridgeAugmentation original = originals.get(ovsdbManagedNodeIid);
-            Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class,null);
+            Bridge bridge = transaction.getTypedRowSchema(Bridge.class);
             Optional<OvsdbBridgeAugmentation> ovsdbAugmentationOptional = state
                     .getOvsdbBridgeAugmentation(ovsdbManagedNodeIid);
             if (ovsdbAugmentationOptional.isPresent() && ovsdbAugmentationOptional.get().getBridgeUuid() != null) {
                 UUID bridgeUuid = new UUID(ovsdbAugmentationOptional.get().getBridgeUuid().getValue());
-                OpenVSwitch ovs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                        OpenVSwitch.class,null);
+                OpenVSwitch ovs = transaction.getTypedRowSchema(OpenVSwitch.class);
                 transaction.add(op.delete(bridge.getSchema())
                         .where(bridge.getUuidColumn().getSchema().opEqual(bridgeUuid)).build());
                 transaction.add(op.comment("Bridge: Deleting " + original.getBridgeName()));
index 370ff0cfd1bc973798287faa9b302aaeedc27ccb..705366c0e07ec4356927e0d1d25d7812bbddb0b2 100644 (file)
@@ -22,7 +22,6 @@ import org.opendaylight.ovsdb.lib.operations.Insert;
 import org.opendaylight.ovsdb.lib.operations.Mutate;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
@@ -44,23 +43,24 @@ public class BridgeUpdateCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(BridgeUpdateCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(events, OvsdbBridgeAugmentation.class),
                 instanceIdentifierCodec);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state,
                 TransactUtils.extractCreatedOrUpdated(modifications, OvsdbBridgeAugmentation.class),
                 instanceIdentifierCodec);
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> createdOrUpdated,
-            InstanceIdentifierCodec instanceIdentifierCodec) {
+    private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> createdOrUpdated,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         for (Entry<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> ovsdbManagedNodeEntry :
                 createdOrUpdated.entrySet()) {
             updateBridge(transaction, state, ovsdbManagedNodeEntry.getKey(), ovsdbManagedNodeEntry.getValue(),
@@ -68,13 +68,13 @@ public class BridgeUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateBridge(TransactionBuilder transaction, BridgeOperationalState state,
-            InstanceIdentifier<OvsdbBridgeAugmentation> iid, OvsdbBridgeAugmentation ovsdbManagedNode,
-            InstanceIdentifierCodec instanceIdentifierCodec) {
+    private static void updateBridge(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final InstanceIdentifier<OvsdbBridgeAugmentation> iid, final OvsdbBridgeAugmentation ovsdbManagedNode,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         LOG.debug("Received request to create ovsdb bridge name: {} uuid: {}",
                 ovsdbManagedNode.getBridgeName(),
                 ovsdbManagedNode.getBridgeUuid());
-        Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+        Bridge bridge = transaction.getTypedRowWrapper(Bridge.class);
         setFailMode(bridge, ovsdbManagedNode);
         setDataPathType(bridge, ovsdbManagedNode);
         setStpEnalbe(bridge, ovsdbManagedNode);
@@ -93,7 +93,7 @@ public class BridgeUpdateCommand implements TransactCommand {
             String existingBridgeName = operationalBridgeOptional.get().getBridgeName().getValue();
             LOG.debug("Bridge {} already exists in device updating {}", existingBridgeName, iid);
             // Name is immutable, and so we *can't* update it.  So we use extraBridge for the schema stuff
-            Bridge extraBridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+            Bridge extraBridge = transaction.getTypedRowWrapper(Bridge.class);
             extraBridge.setName("");
             transaction.add(op.update(bridge)
                     .where(extraBridge.getNameColumn().getSchema().opEqual(existingBridgeName))
@@ -103,20 +103,20 @@ public class BridgeUpdateCommand implements TransactCommand {
         }
     }
 
-    private void setDataPathType(Bridge bridge,OvsdbBridgeAugmentation ovsdbManagedNode) {
+    private static void setDataPathType(final Bridge bridge,final OvsdbBridgeAugmentation ovsdbManagedNode) {
         if (ovsdbManagedNode.getDatapathType() != null) {
             bridge.setDatapathType(SouthboundMapper.createDatapathType(ovsdbManagedNode));
         }
     }
 
-    private void setStpEnalbe(Bridge bridge, OvsdbBridgeAugmentation ovsdbManageNode) {
+    private static void setStpEnalbe(final Bridge bridge, final OvsdbBridgeAugmentation ovsdbManageNode) {
         if (ovsdbManageNode.isStpEnable() != null) {
             bridge.setStpEnable(ovsdbManageNode.isStpEnable());
         }
     }
 
-    private void setName(Bridge bridge, OvsdbBridgeAugmentation ovsdbManagedNode,
-            Optional<OvsdbBridgeAugmentation> operationalBridgeOptional) {
+    private static void setName(final Bridge bridge, final OvsdbBridgeAugmentation ovsdbManagedNode,
+            final Optional<OvsdbBridgeAugmentation> operationalBridgeOptional) {
         if (ovsdbManagedNode.getBridgeName() != null) {
             bridge.setName(ovsdbManagedNode.getBridgeName().getValue());
         } else if (operationalBridgeOptional.isPresent() && operationalBridgeOptional.get().getBridgeName() != null) {
@@ -124,8 +124,9 @@ public class BridgeUpdateCommand implements TransactCommand {
         }
     }
 
-    private void setOpenDaylightExternalIds(Bridge bridge, InstanceIdentifier<OvsdbBridgeAugmentation> iid,
-            OvsdbBridgeAugmentation ovsdbManagedNode, InstanceIdentifierCodec instanceIdentifierCodec) {
+    private static void setOpenDaylightExternalIds(final Bridge bridge,
+            final InstanceIdentifier<OvsdbBridgeAugmentation> iid, final OvsdbBridgeAugmentation ovsdbManagedNode,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         // Set the iid external_id
         Map<String, String> externalIdMap = new HashMap<>();
         externalIdMap.put(SouthboundConstants.IID_EXTERNAL_ID_KEY, instanceIdentifierCodec.serialize(iid));
@@ -139,7 +140,8 @@ public class BridgeUpdateCommand implements TransactCommand {
         bridge.setExternalIds(externalIdMap);
     }
 
-    private void setOpenDaylightOtherConfig(@NonNull Bridge bridge, @NonNull OvsdbBridgeAugmentation ovsdbManagedNode) {
+    private static void setOpenDaylightOtherConfig(final @NonNull Bridge bridge,
+            final @NonNull OvsdbBridgeAugmentation ovsdbManagedNode) {
         try {
             bridge.setOtherConfig(YangUtils.convertYangKeyValueListToMap(ovsdbManagedNode.getBridgeOtherConfigs(),
                     BridgeOtherConfigs::getBridgeOtherConfigKey, BridgeOtherConfigs::getBridgeOtherConfigValue));
@@ -148,24 +150,24 @@ public class BridgeUpdateCommand implements TransactCommand {
         }
     }
 
-    private void setPort(TransactionBuilder transaction, Bridge bridge,
-            OvsdbBridgeAugmentation ovsdbManagedNode) {
+    private static void setPort(final TransactionBuilder transaction, final Bridge bridge,
+            final OvsdbBridgeAugmentation ovsdbManagedNode) {
 
         Insert<GenericTableSchema> interfaceInsert = setInterface(transaction,ovsdbManagedNode);
         // Port part
         String portNamedUuid = "Port_" + SouthboundMapper.getRandomUuid();
-        Port port = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Port.class);
+        Port port = transaction.getTypedRowWrapper(Port.class);
         port.setName(ovsdbManagedNode.getBridgeName().getValue());
         port.setInterfaces(Collections.singleton(TransactUtils.extractNamedUuid(interfaceInsert)));
         transaction.add(op.insert(port).withId(portNamedUuid));
         bridge.setPorts(Collections.singleton(new UUID(portNamedUuid)));
     }
 
-    private Insert<GenericTableSchema> setInterface(TransactionBuilder transaction,
-            OvsdbBridgeAugmentation ovsdbManagedNode) {
+    private static Insert<GenericTableSchema> setInterface(final TransactionBuilder transaction,
+            final OvsdbBridgeAugmentation ovsdbManagedNode) {
         // Interface part
         String interfaceNamedUuid = "Interface_" + SouthboundMapper.getRandomUuid();
-        Interface interfaceOvs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Interface.class);
+        Interface interfaceOvs = transaction.getTypedRowWrapper(Interface.class);
         interfaceOvs.setName(ovsdbManagedNode.getBridgeName().getValue());
         interfaceOvs.setType(SouthboundMapper.createOvsdbInterfaceType(InterfaceTypeInternal.class));
         Insert<GenericTableSchema> result = op.insert(interfaceOvs).withId(interfaceNamedUuid);
@@ -173,8 +175,8 @@ public class BridgeUpdateCommand implements TransactCommand {
         return result;
     }
 
-    private void setFailMode(Bridge bridge,
-            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(Collections.singleton(
@@ -182,9 +184,10 @@ public class BridgeUpdateCommand implements TransactCommand {
         }
     }
 
-    private void stampInstanceIdentifier(TransactionBuilder transaction,InstanceIdentifier<Node> iid,
-            String bridgeName, InstanceIdentifierCodec instanceIdentifierCodec) {
-        Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+    private static void stampInstanceIdentifier(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> 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(),
index 38588fbba4968b51f30c47d25b53fb0d107412a7..e51780de855b80b8322453440d1e4bdf7f5fac26 100644 (file)
@@ -18,7 +18,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
@@ -32,22 +31,23 @@ public class ControllerRemovedCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(ControllerRemovedCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractRemoved(events, ControllerEntry.class),
                 TransactUtils.extractCreatedOrUpdatedOrRemoved(events, OvsdbBridgeAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractRemoved(modifications, ControllerEntry.class),
                 TransactUtils.extractCreatedOrUpdatedOrRemoved(modifications, OvsdbBridgeAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                         Set<InstanceIdentifier<ControllerEntry>> removedControllers,
-                         Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation>
+    private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+                         final Set<InstanceIdentifier<ControllerEntry>> removedControllers,
+                         final Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation>
                                  modifiedBridges) {
         for (InstanceIdentifier<ControllerEntry> controllerIid : removedControllers) {
             LOG.debug("Removing Registered...ODL controller : {} ", controllerIid);
@@ -57,14 +57,11 @@ public class ControllerRemovedCommand implements TransactCommand {
             Optional<ControllerEntry> controllerEntryOptional = state.getControllerEntry(controllerIid);
             if (ovsdbBridge != null && controllerEntryOptional.isPresent()) {
                 ControllerEntry controllerEntry = controllerEntryOptional.get();
-                Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+                Bridge bridge = transaction.getTypedRowWrapper(Bridge.class);
                 bridge.setController(Collections.singleton(new UUID(controllerEntry.getControllerUuid().getValue())));
                 transaction.add(op.mutate(bridge).addMutation(bridge.getControllerColumn().getSchema(),
                         Mutator.DELETE, bridge.getControllerColumn().getData()));
             }
         }
-
-
     }
-
 }
index 18067b8e1cdd18eb12ef7938e4526d8ffd8f0bac..c62172ee5b8e4f068c1078269d7feb467a5daed6 100644 (file)
@@ -18,7 +18,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Controller;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
@@ -34,22 +33,23 @@ public class ControllerUpdateCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(ControllerUpdateCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(events, ControllerEntry.class),
                 TransactUtils.extractCreatedOrUpdated(events, OvsdbBridgeAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(modifications, ControllerEntry.class),
                 TransactUtils.extractCreatedOrUpdated(modifications, OvsdbBridgeAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                         Map<InstanceIdentifier<ControllerEntry>, ControllerEntry> controllers,
-                         Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> bridges) {
+    private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Map<InstanceIdentifier<ControllerEntry>, ControllerEntry> controllers,
+            final Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> bridges) {
         LOG.info("Register ODL controllers : {}  bridges detail : {}",
                 controllers, bridges);
         for (Entry<InstanceIdentifier<ControllerEntry>, ControllerEntry> entry: controllers.entrySet()) {
@@ -66,8 +66,7 @@ public class ControllerUpdateCommand implements TransactCommand {
                         && entry.getValue() != null
                         && entry.getValue().getTarget() != null) {
                     ControllerEntry controllerEntry = entry.getValue();
-                    Controller controller =
-                            TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Controller.class);
+                    Controller controller = transaction.getTypedRowWrapper(Controller.class);
                     controller.setTarget(controllerEntry.getTarget().getValue());
                     if (controllerEntry.getMaxBackoff() != null) {
                         controller.setMaxBackoff(Collections.singleton(controllerEntry.getMaxBackoff().toJava()));
@@ -80,7 +79,7 @@ public class ControllerUpdateCommand implements TransactCommand {
                     UUID controllerNamedUuid = new UUID(controllerNamedUuidString);
                     transaction.add(op.insert(controller).withId(controllerNamedUuidString));
 
-                    Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+                    Bridge bridge = transaction.getTypedRowWrapper(Bridge.class);
                     bridge.setName(ovsdbBridge.getBridgeName().getValue());
                     bridge.setController(Collections.singleton(controllerNamedUuid));
                     LOG.trace("Added controller : {} for bridge : {}",
@@ -96,5 +95,4 @@ public class ControllerUpdateCommand implements TransactCommand {
         LOG.trace("Executed transaction: {}", transaction.build());
 
     }
-
 }
index 341bcffd8acd01d2a7ad5fc30ac145d1f35cc685..967d4d063f2d54366614841c04e3118e2acb8394 100644 (file)
@@ -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.southbound.ovsdb.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -17,7 +16,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.operations.Insert;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
@@ -26,22 +24,23 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 public class OpenVSwitchBridgeAddCommand implements TransactCommand {
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction);
     }
 
-    private void execute(TransactionBuilder transaction) {
-        Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+    private static void execute(final TransactionBuilder transaction) {
+        Bridge bridge = transaction.getTypedRowWrapper(Bridge.class);
         List<Insert> inserts = TransactUtils.extractInsert(transaction, bridge.getSchema());
         for (Insert insert : inserts) {
-            OpenVSwitch ovs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), OpenVSwitch.class);
+            OpenVSwitch ovs = transaction.getTypedRowWrapper(OpenVSwitch.class);
             ovs.setBridges(Collections.singleton(TransactUtils.extractNamedUuid(insert)));
             transaction.add(op.mutate(ovs).addMutation(ovs.getBridgesColumn().getSchema(),
                     Mutator.INSERT,
index ba0da80d6f75a069a235f5e57f0291c9ea2bfeb0..bc8e2cc8a2d3477fd587bea818e5fb90628dd35d 100644 (file)
@@ -19,7 +19,6 @@ import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.operations.Mutate;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.ovsdb.utils.yang.YangUtils;
@@ -35,22 +34,23 @@ public class OvsdbNodeUpdateCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(OvsdbNodeUpdateCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, TransactUtils.extractCreatedOrUpdated(events, OvsdbNodeAugmentation.class),
                 instanceIdentifierCodec);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, TransactUtils.extractCreatedOrUpdated(modifications, OvsdbNodeAugmentation.class),
                 instanceIdentifierCodec);
     }
 
-    private void execute(TransactionBuilder transaction,
-            Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated,
-            InstanceIdentifierCodec instanceIdentifierCodec) {
+    private static void execute(final TransactionBuilder transaction,
+            final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         for (Entry<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> ovsdbNodeEntry:
             updated.entrySet()) {
             OvsdbNodeAugmentation ovsdbNode = ovsdbNodeEntry.getValue();
@@ -63,7 +63,7 @@ public class OvsdbNodeUpdateCommand implements TransactCommand {
             }
 
             // OpenVSwitchPart
-            OpenVSwitch ovs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), OpenVSwitch.class);
+            OpenVSwitch ovs = transaction.getTypedRowWrapper(OpenVSwitch.class);
 
             stampInstanceIdentifier(transaction, ovsdbNodeEntry.getKey().firstIdentifierOf(Node.class),
                     instanceIdentifierCodec);
@@ -97,9 +97,9 @@ public class OvsdbNodeUpdateCommand implements TransactCommand {
         }
     }
 
-    private void stampInstanceIdentifier(TransactionBuilder transaction, InstanceIdentifier<Node> iid,
-            InstanceIdentifierCodec instanceIdentifierCodec) {
-        OpenVSwitch ovs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), OpenVSwitch.class);
+    private static void stampInstanceIdentifier(final TransactionBuilder transaction,
+            final InstanceIdentifier<Node> iid, final InstanceIdentifierCodec instanceIdentifierCodec) {
+        OpenVSwitch ovs = transaction.getTypedRowWrapper(OpenVSwitch.class);
         ovs.setExternalIds(Collections.emptyMap());
         TransactUtils.stampInstanceIdentifier(transaction, iid, ovs.getSchema(),
                 ovs.getExternalIdsColumn().getSchema(), instanceIdentifierCodec);
index 4a20b98227a510bf022b575049730ab09af3555a..2816585e7bc68670ff1eae4da1f1cdd6d497910d 100644 (file)
@@ -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.southbound.ovsdb.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -20,7 +19,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.ovsdb.southbound.SouthboundConstants;
@@ -36,22 +34,23 @@ public class ProtocolRemovedCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(ProtocolRemovedCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractRemoved(events, ProtocolEntry.class),
                 TransactUtils.extractCreatedOrUpdatedOrRemoved(events, OvsdbBridgeAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractRemoved(modifications, ProtocolEntry.class),
                 TransactUtils.extractCreatedOrUpdatedOrRemoved(modifications, OvsdbBridgeAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                         Set<InstanceIdentifier<ProtocolEntry>> removed,
-                         Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> updatedBridges) {
+    private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Set<InstanceIdentifier<ProtocolEntry>> removed,
+            final Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> updatedBridges) {
         for (InstanceIdentifier<ProtocolEntry> protocolIid : removed) {
             InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid =
                     protocolIid.firstIdentifierOf(OvsdbBridgeAugmentation.class);
@@ -61,7 +60,7 @@ public class ProtocolRemovedCommand implements TransactCommand {
                     && protocolEntryOptional.isPresent()) {
                 ProtocolEntry protocolEntry = protocolEntryOptional.get();
                 if (protocolEntry != null && protocolEntry.getProtocol() != null) {
-                    Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+                    Bridge bridge = transaction.getTypedRowWrapper(Bridge.class);
                     String protocolString = SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocolEntry.getProtocol());
                     if (protocolString != null) {
                         bridge.setProtocols(Collections.singleton(protocolString));
index 6e516e33fec837b285f95227098041dd0ea32a54..8758c8175ddcbab09529b262d3c0d54ed33b79a5 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.ovsdb.southbound.SouthboundConstants;
@@ -36,22 +35,23 @@ public class ProtocolUpdateCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(ProtocolUpdateCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(events, ProtocolEntry.class),
                 TransactUtils.extractCreatedOrUpdated(events, OvsdbBridgeAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(modifications, ProtocolEntry.class),
                 TransactUtils.extractCreatedOrUpdated(modifications, OvsdbBridgeAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                         Map<InstanceIdentifier<ProtocolEntry>, ProtocolEntry> protocols,
-                         Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> bridges) {
+    private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Map<InstanceIdentifier<ProtocolEntry>, ProtocolEntry> protocols,
+            final Map<InstanceIdentifier<OvsdbBridgeAugmentation>, OvsdbBridgeAugmentation> bridges) {
         for (Entry<InstanceIdentifier<ProtocolEntry>, ProtocolEntry> entry: protocols.entrySet()) {
             Optional<ProtocolEntry> operationalProtocolEntryOptional =
                     state.getProtocolEntry(entry.getKey());
@@ -72,7 +72,7 @@ public class ProtocolUpdateCommand implements TransactCommand {
                         && entry.getValue().getProtocol() != null) {
                     String protocolString = SouthboundConstants.OVSDB_PROTOCOL_MAP.get(entry.getValue().getProtocol());
                     if (protocolString != null) {
-                        Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+                        Bridge bridge = transaction.getTypedRowWrapper(Bridge.class);
                         bridge.setName(ovsdbBridge.getBridgeName().getValue());
                         try {
                             bridge.setProtocols(Collections.singleton(protocolString));
index 63d38df496e5f586dbadf714aaa8c30b7d8f8228..db128c4116f4deff15022aa9f5232a8f17809f33 100644 (file)
@@ -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.southbound.ovsdb.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -16,7 +15,6 @@ import java.util.Map;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Qos;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
@@ -32,24 +30,25 @@ public class QosRemovedCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(QosRemovedCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state,
                 TransactUtils.extractOriginal(events, OvsdbNodeAugmentation.class),
                 TransactUtils.extractUpdated(events, OvsdbNodeAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state,
                 TransactUtils.extractOriginal(modifications, OvsdbNodeAugmentation.class),
                 TransactUtils.extractUpdated(modifications, OvsdbNodeAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                        Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originals,
-                        Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated) {
+    private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originals,
+            final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated) {
         for (Map.Entry<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originalEntry : originals
                 .entrySet()) {
             InstanceIdentifier<OvsdbNodeAugmentation> ovsdbNodeIid = originalEntry.getKey();
@@ -78,8 +77,7 @@ public class QosRemovedCommand implements TransactCommand {
                             LOG.debug("Received request to delete QoS entry {}", origQosEntry.getQosId());
                             Uuid qosUuid = getQosEntryUuid(operQosEntries, origQosEntry.getQosId());
                             if (qosUuid != null) {
-                                Qos qos =
-                                        TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Qos.class, null);
+                                Qos qos = transaction.getTypedRowSchema(Qos.class);
                                 transaction.add(op.delete(qos.getSchema())
                                         .where(qos.getUuidColumn().getSchema().opEqual(new UUID(qosUuid.getValue())))
                                         .build());
@@ -97,7 +95,7 @@ public class QosRemovedCommand implements TransactCommand {
         }
     }
 
-    private Uuid getQosEntryUuid(List<QosEntries> operQosEntries, Uri qosId) {
+    private static Uuid getQosEntryUuid(final List<QosEntries> operQosEntries, final Uri qosId) {
         if (operQosEntries != null && !operQosEntries.isEmpty()) {
             for (QosEntries qosEntry : operQosEntries) {
                 if (qosEntry.getQosId().equals(qosId)) {
@@ -107,5 +105,4 @@ public class QosRemovedCommand implements TransactCommand {
         }
         return null;
     }
-
 }
index 46703757584767073f866cadf71dc253e802516d..ee0ac726ad70373461c962255c6f1370e78ea7ac 100644 (file)
@@ -18,7 +18,6 @@ import java.util.Map.Entry;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Qos;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.ovsdb.southbound.SouthboundConstants;
@@ -44,22 +43,23 @@ public class QosUpdateCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(QosUpdateCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(events, QosEntries.class),
                 instanceIdentifierCodec);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(modifications, QosEntries.class),
                 instanceIdentifierCodec);
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Map<InstanceIdentifier<QosEntries>, QosEntries> createdOrUpdated,
-            InstanceIdentifierCodec instanceIdentifierCodec) {
+    private void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Map<InstanceIdentifier<QosEntries>, QosEntries> createdOrUpdated,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         for (Entry<InstanceIdentifier<QosEntries>, QosEntries> qosMapEntry: createdOrUpdated.entrySet()) {
             InstanceIdentifier<OvsdbNodeAugmentation> iid =
                     qosMapEntry.getKey().firstIdentifierOf(OvsdbNodeAugmentation.class);
@@ -70,7 +70,7 @@ public class QosUpdateCommand implements TransactCommand {
                 state.getBridgeNode(iid).get().augmentation(OvsdbNodeAugmentation.class);
 
             QosEntries qosEntry = qosMapEntry.getValue();
-            Qos qos = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Qos.class);
+            Qos qos = transaction.getTypedRowWrapper(Qos.class);
 
             if (qosEntry.getQosType() != null) {
                 qos.setType(SouthboundMapper.createQosType(qosEntry.getQosType()));
@@ -118,8 +118,7 @@ public class QosUpdateCommand implements TransactCommand {
                 LOG.info("Added QoS Uuid: {} for node : {} ", namedUuid, operNode.getConnectionInfo());
             } else {
                 UUID uuid = new UUID(operQosUuid.getValue());
-                Qos extraQos = TyperUtils.getTypedRowWrapper(
-                        transaction.getDatabaseSchema(), Qos.class, null);
+                Qos extraQos = transaction.getTypedRowSchema(Qos.class);
                 extraQos.getUuidColumn().setData(uuid);
                 transaction.add(op.update(qos)
                         .where(extraQos.getUuidColumn().getSchema().opEqual(uuid)).build());
@@ -128,7 +127,7 @@ public class QosUpdateCommand implements TransactCommand {
         }
     }
 
-    private String getQueueUuid(OvsdbQueueRef queueRef, OvsdbNodeAugmentation operNode) {
+    private String getQueueUuid(final OvsdbQueueRef queueRef, final OvsdbNodeAugmentation operNode) {
         QueuesKey queueKey = queueRef.getValue().firstKeyOf(Queues.class);
         if (operNode.getQueues() != null && !operNode.getQueues().isEmpty()) {
             for (Queues queue : operNode.getQueues()) {
@@ -141,7 +140,7 @@ public class QosUpdateCommand implements TransactCommand {
                 + TransactUtils.bytesToHexString(queueKey.getQueueId().getValue().getBytes(UTF_8));
     }
 
-    private Uuid getQosEntryUuid(List<QosEntries> operQosEntries, Uri qosId) {
+    private Uuid getQosEntryUuid(final List<QosEntries> operQosEntries, final Uri qosId) {
         if (operQosEntries != null && !operQosEntries.isEmpty()) {
             for (QosEntries qosEntry : operQosEntries) {
                 if (qosEntry.getQosId().equals(qosId)) {
index 002197896a1b12bf78310e282d482f5920519099..2e48d1d73b2f3edcb1b2b689f886b4c86999a451 100644 (file)
@@ -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.southbound.ovsdb.transact;
 
 import static org.opendaylight.ovsdb.lib.operations.Operations.op;
@@ -16,7 +15,6 @@ import java.util.Map;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Queue;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
@@ -32,22 +30,23 @@ public class QueueRemovedCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(QueueRemovedCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractOriginal(events, OvsdbNodeAugmentation.class),
                 TransactUtils.extractUpdated(events, OvsdbNodeAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractOriginal(modifications, OvsdbNodeAugmentation.class),
                 TransactUtils.extractUpdated(modifications, OvsdbNodeAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                         Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originals,
-                         Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated) {
+    private void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+                         final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originals,
+                         final Map<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> updated) {
         for (Map.Entry<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> originalEntry : originals
                 .entrySet()) {
             InstanceIdentifier<OvsdbNodeAugmentation> ovsdbNodeIid = originalEntry.getKey();
@@ -77,9 +76,7 @@ public class QueueRemovedCommand implements TransactCommand {
                             LOG.debug("Received request to delete Queue entry {}", origQueue.getQueueId());
                             Uuid queueUuid = getQueueUuid(operQueues, origQueue.getQueueId());
                             if (queueUuid != null) {
-                                Queue queue =
-                                        TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Queue.class,
-                                                null);
+                                Queue queue = transaction.getTypedRowSchema(Queue.class);
                                 transaction.add(op.delete(queue.getSchema())
                                         .where(queue.getUuidColumn().getSchema().opEqual(
                                                 new UUID(queueUuid.getValue())))
@@ -97,7 +94,7 @@ public class QueueRemovedCommand implements TransactCommand {
         }
     }
 
-    private Uuid getQueueUuid(List<Queues> operQueues, Uri queueId) {
+    private Uuid getQueueUuid(final List<Queues> operQueues, final Uri queueId) {
         if (operQueues != null && !operQueues.isEmpty()) {
             for (Queues queueEntry : operQueues) {
                 if (queueEntry.getQueueId().equals(queueId)) {
index 927c45b4508acac505a274c93696e6caaab9a6a0..7769b8ce48312a3900c626f5d472589abeafbb47 100644 (file)
@@ -20,7 +20,6 @@ import java.util.Set;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Queue;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.ovsdb.southbound.SouthboundConstants;
@@ -42,21 +41,23 @@ public class QueueUpdateCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(QueueUpdateCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(events, Queues.class),
                 instanceIdentifierCodec);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreatedOrUpdated(modifications, Queues.class),
                 instanceIdentifierCodec);
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Map<InstanceIdentifier<Queues>, Queues> createdOrUpdated, InstanceIdentifierCodec instanceIdentifierCodec) {
+    private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Map<InstanceIdentifier<Queues>, Queues> createdOrUpdated,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         for (Entry<InstanceIdentifier<Queues>, Queues> queueMapEntry: createdOrUpdated.entrySet()) {
             InstanceIdentifier<OvsdbNodeAugmentation> iid =
                     queueMapEntry.getKey().firstIdentifierOf(OvsdbNodeAugmentation.class);
@@ -65,7 +66,7 @@ public class QueueUpdateCommand implements TransactCommand {
             }
 
             Queues queueEntry = queueMapEntry.getValue();
-            Queue queue = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Queue.class);
+            Queue queue = transaction.getTypedRowWrapper(Queue.class);
 
             if (queueEntry.getDscp() != null) {
                 try {
@@ -110,8 +111,7 @@ public class QueueUpdateCommand implements TransactCommand {
                         namedUuid, operNode);
             } else {
                 UUID uuid = new UUID(operQueueUuid.getValue());
-                Queue extraQueue = TyperUtils.getTypedRowWrapper(
-                        transaction.getDatabaseSchema(), Queue.class, null);
+                Queue extraQueue = transaction.getTypedRowSchema(Queue.class);
                 extraQueue.getUuidColumn().setData(uuid);
                 transaction.add(op.update(queue)
                         .where(extraQueue.getUuidColumn().getSchema().opEqual(uuid)).build());
@@ -121,7 +121,7 @@ public class QueueUpdateCommand implements TransactCommand {
         }
     }
 
-    private Uuid getQueueEntryUuid(List<Queues> operQueues, Uri queueId) {
+    private static Uuid getQueueEntryUuid(final List<Queues> operQueues, final Uri queueId) {
         if (operQueues != null && !operQueues.isEmpty()) {
             for (Queues queueEntry : operQueues) {
                 if (queueEntry.getQueueId().equals(queueId)) {
index 48a141efd586653afc1a91d7410d1b26ebde4137..0f10c8dbbdbb175ff223404290239d9a95691c05 100644 (file)
@@ -32,7 +32,6 @@ 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.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
@@ -67,24 +66,25 @@ public class TerminationPointCreateCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(TerminationPointCreateCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractCreated(events, OvsdbTerminationPointAugmentation.class),
                 TransactUtils.extractCreatedOrUpdated(events, Node.class), instanceIdentifierCodec);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state,
                 TransactUtils.extractCreated(modifications, OvsdbTerminationPointAugmentation.class),
                 TransactUtils.extractCreatedOrUpdated(modifications, Node.class), instanceIdentifierCodec);
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Map<InstanceIdentifier<OvsdbTerminationPointAugmentation>, OvsdbTerminationPointAugmentation>
+    private void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Map<InstanceIdentifier<OvsdbTerminationPointAugmentation>, OvsdbTerminationPointAugmentation>
                     createdTerminationPoints,
-            Map<InstanceIdentifier<Node>, Node> nodes, InstanceIdentifierCodec instanceIdentifierCodec) {
+            final Map<InstanceIdentifier<Node>, Node> nodes, final InstanceIdentifierCodec instanceIdentifierCodec) {
         for (Entry<InstanceIdentifier<OvsdbTerminationPointAugmentation>, OvsdbTerminationPointAugmentation> entry :
                 createdTerminationPoints.entrySet()) {
             OvsdbTerminationPointAugmentation terminationPoint = entry.getValue();
@@ -96,8 +96,7 @@ public class TerminationPointCreateCommand implements TransactCommand {
             if (!terminationPointOptional.isPresent()) {
                 // Configure interface
                 String interfaceUuid = "Interface_" + SouthboundMapper.getRandomUuid();
-                Interface ovsInterface =
-                        TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Interface.class);
+                Interface ovsInterface = transaction.getTypedRowWrapper(Interface.class);
                 createInterface(terminationPoint, ovsInterface);
                 transaction.add(op.insert(ovsInterface).withId(interfaceUuid));
 
@@ -105,14 +104,14 @@ public class TerminationPointCreateCommand implements TransactCommand {
 
                 // Configure port with the above interface details
                 String portUuid = "Port_" + SouthboundMapper.getRandomUuid();
-                Port port = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Port.class);
+                Port port = transaction.getTypedRowWrapper(Port.class);
                 final String opendaylightIid = instanceIdentifierCodec.serialize(terminationPointIid);
                 createPort(terminationPoint, port, interfaceUuid, opendaylightIid);
                 transaction.add(op.insert(port).withId(portUuid));
                 LOG.info("Created Termination Point : {} with Uuid : {}",
                         terminationPoint.getName(),portUuid);
                 //Configure bridge with the above port details
-                Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Bridge.class);
+                Bridge bridge = transaction.getTypedRowWrapper(Bridge.class);
                 if (getBridge(entry.getKey(), nodes) != null) {
                     bridge.setName(getBridge(entry.getKey(), nodes).getBridgeName().getValue());
                     bridge.setPorts(Collections.singleton(new UUID(portUuid)));
@@ -143,9 +142,8 @@ public class TerminationPointCreateCommand implements TransactCommand {
         createInterfaceBfd(terminationPoint, ovsInterface);
     }
 
-    private void createInterfaceType(final OvsdbTerminationPointAugmentation terminationPoint,
-                                     final Interface ovsInterface) {
-
+    private static void createInterfaceType(final OvsdbTerminationPointAugmentation terminationPoint,
+            final Interface ovsInterface) {
         Class<? extends InterfaceTypeBase> mdsaltype = terminationPoint.getInterfaceType();
         if (mdsaltype != null) {
             ovsInterface.setType(SouthboundMapper.createOvsdbInterfaceType(mdsaltype));
@@ -291,7 +289,7 @@ public class TerminationPointCreateCommand implements TransactCommand {
             portExternalIds.add(SouthboundUtil.createExternalIdsForPort(
                 SouthboundConstants.IID_EXTERNAL_ID_KEY, opendaylightIid));
         } else {
-            portExternalIds = new ArrayList<PortExternalIds>();
+            portExternalIds = new ArrayList<>();
             portExternalIds.add(SouthboundUtil.createExternalIdsForPort(
                 SouthboundConstants.CREATED_BY, SouthboundConstants.ODL));
             portExternalIds.add(SouthboundUtil.createExternalIdsForPort(
@@ -360,7 +358,8 @@ public class TerminationPointCreateCommand implements TransactCommand {
         }
     }
 
-    private OvsdbBridgeAugmentation getBridge(InstanceIdentifier<?> key, Map<InstanceIdentifier<Node>, Node> nodes) {
+    private OvsdbBridgeAugmentation getBridge(final InstanceIdentifier<?> key,
+            final Map<InstanceIdentifier<Node>, Node> nodes) {
         OvsdbBridgeAugmentation bridge = null;
         InstanceIdentifier<Node> nodeIid = key.firstIdentifierOf(Node.class);
         if (nodes != null && nodes.get(nodeIid) != null) {
@@ -384,10 +383,10 @@ public class TerminationPointCreateCommand implements TransactCommand {
         return bridge;
     }
 
-    public static void stampInstanceIdentifier(TransactionBuilder transaction,
-            InstanceIdentifier<OvsdbTerminationPointAugmentation> iid, String interfaceName,
-            InstanceIdentifierCodec instanceIdentifierCodec) {
-        Port port = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Port.class);
+    public static void stampInstanceIdentifier(final TransactionBuilder transaction,
+            final InstanceIdentifier<OvsdbTerminationPointAugmentation> 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(),
@@ -396,4 +395,4 @@ public class TerminationPointCreateCommand implements TransactCommand {
                 .where(port.getNameColumn().getSchema().opEqual(interfaceName))
                 .build());
     }
-}
\ No newline at end of file
+}
index 53dc870a60ae5256848a5555d0c19955640bd4df..ce8cf610ba92d4c0e8f4d0fbcab4972a51a1521b 100644 (file)
@@ -18,7 +18,6 @@ import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
 import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
@@ -38,28 +37,28 @@ public class TerminationPointDeleteCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(TerminationPointDeleteCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state, TransactUtils.extractOriginal(events, OvsdbTerminationPointAugmentation.class),
                 TransactUtils.extractOriginal(events, Node.class),
                 TransactUtils.extractRemoved(events, OvsdbTerminationPointAugmentation.class));
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications,
-            InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state,
                 TransactUtils.extractOriginal(modifications, OvsdbTerminationPointAugmentation.class),
                 TransactUtils.extractOriginal(modifications, Node.class),
                 TransactUtils.extractRemoved(modifications, OvsdbTerminationPointAugmentation.class));
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-                         Map<InstanceIdentifier<OvsdbTerminationPointAugmentation>,
-                                 OvsdbTerminationPointAugmentation> originals,
-                         Map<InstanceIdentifier<Node>, Node> originalNodes,
-                         Set<InstanceIdentifier<OvsdbTerminationPointAugmentation>> removedTps) {
+    private static void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Map<InstanceIdentifier<OvsdbTerminationPointAugmentation>,
+                OvsdbTerminationPointAugmentation> originals,
+            final Map<InstanceIdentifier<Node>, Node> originalNodes,
+            final Set<InstanceIdentifier<OvsdbTerminationPointAugmentation>> removedTps) {
         for (InstanceIdentifier<OvsdbTerminationPointAugmentation> removedTpIid: removedTps) {
             LOG.debug("Received request to delete termination point {}", removedTpIid);
             OvsdbTerminationPointAugmentation original = originals.get(removedTpIid);
@@ -78,15 +77,14 @@ public class TerminationPointDeleteCommand implements TransactCommand {
                     LOG.error("Bridge does not exist for termination point {}", removedTpIid);
                 }
             }
-            Port port = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Port.class,null);
+            Port port = transaction.getTypedRowSchema(Port.class);
             Optional<OvsdbTerminationPointAugmentation> tpAugmentation =
                     state.getOvsdbTerminationPointAugmentation(removedTpIid);
             if (tpAugmentation.isPresent()) {
                 OvsdbTerminationPointAugmentation tp = tpAugmentation.get();
                 if (tp.getPortUuid() != null) {
                     UUID portUuid = new UUID(tp.getPortUuid().getValue());
-                    Bridge bridge = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
-                            Bridge.class,null);
+                    Bridge bridge = transaction.getTypedRowSchema(Bridge.class);
 
                     transaction.add(op.delete(port.getSchema())
                             .where(port.getUuidColumn().getSchema().opEqual(portUuid)).build());
index 303822fcb4ab0f5aed0bbc9f0876fcb5eba38f02..c880a76f4dc44eeb7aec8e65f9e1fd4e5dc2b3d7 100644 (file)
@@ -30,7 +30,6 @@ import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException;
 import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
@@ -65,25 +64,26 @@ public class TerminationPointUpdateCommand implements TransactCommand {
     private static final Logger LOG = LoggerFactory.getLogger(TerminationPointUpdateCommand.class);
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            DataChangeEvent events, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final DataChangeEvent events, final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state,
                 TransactUtils.extractCreatedOrUpdated(events, OvsdbTerminationPointAugmentation.class),
                 instanceIdentifierCodec);
     }
 
     @Override
-    public void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Collection<DataTreeModification<Node>> modifications, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Collection<DataTreeModification<Node>> modifications,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         execute(transaction, state,
                 TransactUtils.extractCreatedOrUpdated(modifications, OvsdbTerminationPointAugmentation.class),
                 instanceIdentifierCodec);
     }
 
-    private void execute(TransactionBuilder transaction, BridgeOperationalState state,
-            Map<InstanceIdentifier<OvsdbTerminationPointAugmentation>, OvsdbTerminationPointAugmentation>
+    private void execute(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final Map<InstanceIdentifier<OvsdbTerminationPointAugmentation>, OvsdbTerminationPointAugmentation>
                     createdOrUpdated,
-            InstanceIdentifierCodec instanceIdentifierCodec) {
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
         for (Entry<InstanceIdentifier<OvsdbTerminationPointAugmentation>,
                  OvsdbTerminationPointAugmentation> terminationPointEntry : createdOrUpdated.entrySet()) {
             updateTerminationPoint(transaction, state, terminationPointEntry.getKey(),
@@ -91,20 +91,19 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    public void updateTerminationPoint(TransactionBuilder transaction, BridgeOperationalState state,
-            InstanceIdentifier<OvsdbTerminationPointAugmentation> iid,
-            OvsdbTerminationPointAugmentation terminationPoint, InstanceIdentifierCodec instanceIdentifierCodec) {
+    public void updateTerminationPoint(final TransactionBuilder transaction, final BridgeOperationalState state,
+            final InstanceIdentifier<OvsdbTerminationPointAugmentation> iid,
+            final OvsdbTerminationPointAugmentation terminationPoint,
+            final InstanceIdentifierCodec instanceIdentifierCodec) {
 
         if (terminationPoint != null) {
             LOG.debug("Received request to update termination point {}",
                    terminationPoint.getName());
 
             // Update interface
-            Interface ovsInterface =
-                    TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Interface.class);
+            Interface ovsInterface = transaction.getTypedRowWrapper(Interface.class);
             updateInterface(terminationPoint, ovsInterface);
-            Interface extraInterface = TyperUtils.getTypedRowWrapper(
-                    transaction.getDatabaseSchema(), Interface.class);
+            Interface extraInterface = transaction.getTypedRowWrapper(Interface.class);
             extraInterface.setName("");
             transaction.add(op.update(ovsInterface)
                     .where(extraInterface.getNameColumn().getSchema().opEqual(terminationPoint.getName()))
@@ -120,11 +119,9 @@ public class TerminationPointUpdateCommand implements TransactCommand {
             if (ovsdbBridgeOptional != null && ovsdbBridgeOptional.isPresent()) {
                 OvsdbBridgeAugmentation operBridge = ovsdbBridgeOptional.get();
                 if (operBridge != null) {
-                    Port port = TyperUtils.getTypedRowWrapper(
-                        transaction.getDatabaseSchema(), Port.class);
+                    Port port = transaction.getTypedRowWrapper(Port.class);
                     updatePort(terminationPoint, port, operBridge, opendaylightIid);
-                    Port extraPort = TyperUtils.getTypedRowWrapper(
-                        transaction.getDatabaseSchema(), Port.class);
+                    Port extraPort = transaction.getTypedRowWrapper(Port.class);
                     extraPort.setName("");
                     transaction.add(op.update(port)
                         .where(extraPort.getNameColumn().getSchema().opEqual(terminationPoint.getName()))
@@ -138,8 +135,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateInterface(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updateInterface(final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
         updateOfPort(terminationPoint, ovsInterface);
         updateOfPortRequest(terminationPoint, ovsInterface);
@@ -151,12 +147,8 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         updateInterfacePolicing(terminationPoint, ovsInterface);
     }
 
-    private void updatePort(
-            final OvsdbTerminationPointAugmentation terminationPoint,
-            final Port port,
-            final OvsdbBridgeAugmentation operBridge,
-            final String opendaylightIid) {
-
+    private static void updatePort(final OvsdbTerminationPointAugmentation terminationPoint,
+            final Port port, final OvsdbBridgeAugmentation operBridge, final String opendaylightIid) {
         updatePortOtherConfig(terminationPoint, port);
         updatePortVlanTag(terminationPoint, port);
         updatePortVlanTrunk(terminationPoint, port);
@@ -165,10 +157,8 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         updatePortQos(terminationPoint, port, operBridge);
     }
 
-    private void updatePortQos(
-            final OvsdbTerminationPointAugmentation terminationPoint,
-            final Port port,
-            final OvsdbBridgeAugmentation operBridge) {
+    private static void updatePortQos(final OvsdbTerminationPointAugmentation terminationPoint,
+            final Port port, final OvsdbBridgeAugmentation operBridge) {
 
         Set<UUID> uuidSet = new HashSet<>();
 
@@ -193,7 +183,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         port.setQos(uuidSet);
     }
 
-    private OvsdbNodeAugmentation getOperNode(final OvsdbBridgeAugmentation operBridge) {
+    private static OvsdbNodeAugmentation getOperNode(final OvsdbBridgeAugmentation operBridge) {
         @SuppressWarnings("unchecked")
         InstanceIdentifier<Node> iidNode = (InstanceIdentifier<Node>)operBridge.getManagedBy().getValue();
         OvsdbNodeAugmentation operNode = null;
@@ -211,8 +201,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         return operNode;
     }
 
-    private void updateOfPort(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updateOfPort(final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
 
         Uint32 ofPort = terminationPoint.getOfport();
@@ -221,8 +210,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateOfPortRequest(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updateOfPortRequest(final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
 
         Uint16 ofPortRequest = terminationPoint.getOfportRequest();
@@ -231,8 +219,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateInterfaceOptions(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updateInterfaceOptions(final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
 
         //Configure optional input
@@ -246,8 +233,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateInterfaceExternalIds(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updateInterfaceExternalIds(final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
 
         List<InterfaceExternalIds> interfaceExternalIds =
@@ -267,10 +253,8 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateInterfaceLldp(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updateInterfaceLldp(final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
-
         try {
             List<InterfaceLldp> interfaceLldpList =
                     terminationPoint.getInterfaceLldp();
@@ -287,8 +271,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateInterfaceOtherConfig(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updateInterfaceOtherConfig(final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
 
         List<InterfaceOtherConfigs> interfaceOtherConfigs =
@@ -307,8 +290,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateInterfaceBfd(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updateInterfaceBfd(final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
 
         try {
@@ -327,8 +309,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updateInterfacePolicing(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updateInterfacePolicing(final OvsdbTerminationPointAugmentation terminationPoint,
             final Interface ovsInterface) {
 
         Uint32 ingressPolicingRate = terminationPoint.getIngressPolicingRate();
@@ -341,10 +322,8 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updatePortExternalIds(
-            final OvsdbTerminationPointAugmentation terminationPoint,
-            final Port port,
-            final String opendaylightIid) {
+    private static void updatePortExternalIds(final OvsdbTerminationPointAugmentation terminationPoint,
+            final Port port, final String opendaylightIid) {
 
         Map<String, String> externalIdMap = new HashMap<>();
         externalIdMap.put(SouthboundConstants.IID_EXTERNAL_ID_KEY, opendaylightIid);
@@ -358,10 +337,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         port.setExternalIds(externalIdMap);
     }
 
-    private void updatePortVlanTag(
-            final OvsdbTerminationPointAugmentation terminationPoint,
-            final Port port) {
-
+    private static void updatePortVlanTag(final OvsdbTerminationPointAugmentation terminationPoint, final Port port) {
         if (terminationPoint.getVlanTag() != null) {
             Set<Long> vlanTag = new HashSet<>();
             vlanTag.add(terminationPoint.getVlanTag().getValue().longValue());
@@ -369,10 +345,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updatePortVlanTrunk(
-            final OvsdbTerminationPointAugmentation terminationPoint,
-            final Port port) {
-
+    private static void updatePortVlanTrunk(final OvsdbTerminationPointAugmentation terminationPoint, final Port port) {
         if (terminationPoint.getTrunks() != null && terminationPoint.getTrunks().size() > 0) {
             Set<Long> portTrunks = new HashSet<>();
             List<Trunks> modelTrunks = terminationPoint.getTrunks();
@@ -385,9 +358,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updatePortVlanMode(
-            final OvsdbTerminationPointAugmentation terminationPoint,
-            final Port port) {
+    private static void updatePortVlanMode(final OvsdbTerminationPointAugmentation terminationPoint, final Port port) {
         if (terminationPoint.getVlanMode() != null) {
             Set<String> portVlanMode = new HashSet<>();
             VlanMode modelVlanMode = terminationPoint.getVlanMode();
@@ -396,8 +367,7 @@ public class TerminationPointUpdateCommand implements TransactCommand {
         }
     }
 
-    private void updatePortOtherConfig(
-            final OvsdbTerminationPointAugmentation terminationPoint,
+    private static void updatePortOtherConfig(final OvsdbTerminationPointAugmentation terminationPoint,
             final Port ovsPort) {
         List<PortOtherConfigs> portOtherConfigs =
                 terminationPoint.getPortOtherConfigs();
index 7d7412c78b7a4283225bc01091d65c3ed8dec0f5..f4691b670f96ac62430ab07f443e383896c9424d 100644 (file)
@@ -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.southbound.ovsdb.transact;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
+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.verify;
@@ -32,9 +31,7 @@ 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.DatabaseSchema;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
@@ -43,7 +40,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({TyperUtils.class, TransactUtils.class, Operations.class})
+@PrepareForTest({TransactUtils.class, Operations.class})
 public class OpenVSwitchBridgeAddCommandTest {
     private OpenVSwitchBridgeAddCommand ovsBridgeAddCommand;
 
@@ -60,10 +57,8 @@ public class OpenVSwitchBridgeAddCommandTest {
         when(transaction.getOperations()).thenReturn(operations);
 
         Bridge bridge = mock(Bridge.class);
-        when(transaction.getDatabaseSchema()).thenReturn(mock(DatabaseSchema.class));
-        PowerMockito.mockStatic(TyperUtils.class);
-        PowerMockito.when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(Bridge.class)))
-                .thenReturn(bridge);
+
+        when(transaction.getTypedRowWrapper(eq(Bridge.class))).thenReturn(bridge);
 
         List<Insert> inserts = new ArrayList<>();
         Insert insert = mock(Insert.class);
@@ -74,8 +69,7 @@ public class OpenVSwitchBridgeAddCommandTest {
                 .thenReturn(inserts);
 
         OpenVSwitch ovs = mock(OpenVSwitch.class);
-        PowerMockito.when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(OpenVSwitch.class)))
-                .thenReturn(ovs);
+        when(transaction.getTypedRowWrapper(eq(OpenVSwitch.class))).thenReturn(ovs);
         PowerMockito.when(TransactUtils.extractNamedUuid(any(Insert.class))).thenReturn(mock(UUID.class));
         doNothing().when(ovs).setBridges(any(Set.class));
 
index c867eb780049186f2978c85610db08445bc08100..5f5b6359cfbac35cfcecf818fd7bf94a04bf26b4 100644 (file)
@@ -33,9 +33,7 @@ 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.DatabaseSchema;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
@@ -51,8 +49,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({TransactUtils.class, TyperUtils.class, OvsdbNodeUpdateCommand.class, InstanceIdentifier.class,
-    Operations.class})
+@PrepareForTest({TransactUtils.class, OvsdbNodeUpdateCommand.class, InstanceIdentifier.class, Operations.class})
 public class OvsdbNodeUpdateCommandTest {
 
     private static final String EXTERNAL_ID_KEY = "external id key";
@@ -87,10 +84,7 @@ public class OvsdbNodeUpdateCommandTest {
 
         OpenVSwitch ovs = mock(OpenVSwitch.class);
         TransactionBuilder transaction = mock(TransactionBuilder.class);
-        when(transaction.getDatabaseSchema()).thenReturn(mock(DatabaseSchema.class));
-        PowerMockito.mockStatic(TyperUtils.class);
-        PowerMockito.when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(OpenVSwitch.class)))
-                .thenReturn(ovs);
+        when(transaction.getTypedRowWrapper(eq(OpenVSwitch.class))).thenReturn(ovs);
 
         List<OpenvswitchExternalIds> externalIds = new ArrayList<>();
         OpenvswitchExternalIds externalId = mock(OpenvswitchExternalIds.class);
index ff313e7e1a69a8ceca9cf10fc7cb05436b21ae6b..9391c1f566eb46b5bc7a6e32e88ce847213c9878 100644 (file)
@@ -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.southbound.ovsdb.transact;
 
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -30,9 +29,7 @@ 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.DatabaseSchema;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
@@ -47,7 +44,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({InstanceIdentifier.class, TransactUtils.class, TyperUtils.class })
+@PrepareForTest({InstanceIdentifier.class, TransactUtils.class })
 public class ProtocolRemovedCommandTest {
 
     private final Set<InstanceIdentifier<ProtocolEntry>> removed = new HashSet<>();
@@ -84,16 +81,15 @@ public class ProtocolRemovedCommandTest {
         when(column.getData()).thenReturn(new HashSet<>());
         when(mutate.addMutation(any(ColumnSchema.class), any(Mutator.class), any(Set.class))).thenReturn(mutate);
 
-        PowerMockito.mockStatic(TyperUtils.class);
-        when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), any(Class.class))).thenReturn(bridge);
-
         TransactionBuilder transaction = mock(TransactionBuilder.class);
+        when(transaction.getTypedRowWrapper(any(Class.class))).thenReturn(bridge);
+
         protocolRemovedCommand.execute(transaction, bridgeOpState, mock(DataChangeEvent.class),
                 mock(InstanceIdentifierCodec.class));
         Mockito.verify(transaction).add(any(Operation.class));
     }
 
-    private Object setField(String fieldName) throws Exception {
+    private 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));
index 3a15596c9fd8d93a8f7d2a7f4041032eacd1e985..a3b1739b3b127ee1d462944f109a59200c96aa81 100644 (file)
@@ -8,9 +8,9 @@
 
 package org.opendaylight.ovsdb.southbound.ovsdb.transact;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+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.verify;
@@ -35,7 +35,6 @@ import org.opendaylight.ovsdb.lib.operations.Operations;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
 import org.opendaylight.ovsdb.lib.operations.Where;
 import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
-import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
 import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
@@ -51,7 +50,7 @@ import org.powermock.api.support.membermodification.MemberModifier;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
-@PrepareForTest({TyperUtils.class, TransactUtils.class, TerminationPointCreateCommand.class})
+@PrepareForTest({TransactUtils.class, TerminationPointCreateCommand.class})
 @RunWith(PowerMockRunner.class)
 public class TerminationPointCreateCommandTest {
 
@@ -80,8 +79,7 @@ public class TerminationPointCreateCommandTest {
         Interface ovsInterface = mock(Interface.class);
         PowerMockito.mockStatic(TyperUtils.class);
         TransactionBuilder transaction = mock(TransactionBuilder.class);
-        when(transaction.getDatabaseSchema()).thenReturn(mock(DatabaseSchema.class));
-        when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(Interface.class))).thenReturn(ovsInterface);
+        when(transaction.getTypedRowWrapper(eq(Interface.class))).thenReturn(ovsInterface);
         //createInterface()
         Operations op = (Operations) setField("op");
         Insert<GenericTableSchema> insert = mock(Insert.class);
@@ -92,11 +90,11 @@ public class TerminationPointCreateCommandTest {
         when(ovsInterface.getName()).thenReturn(INTERFACE_NAME);
 
         Port port = mock(Port.class);
-        when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(Port.class))).thenReturn(port);
+        when(transaction.getTypedRowWrapper(eq(Port.class))).thenReturn(port);
         when(op.insert(any(Port.class))).thenReturn(insert);
 
         Bridge bridge = mock(Bridge.class);
-        when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(Bridge.class))).thenReturn(bridge);
+        when(transaction.getTypedRowWrapper(eq(Bridge.class))).thenReturn(bridge);
         doNothing().when(bridge).setName(anyString());
         PowerMockito.whenNew(UUID.class).withAnyArguments().thenReturn(mock(UUID.class));
         doNothing().when(bridge).setPorts(any(HashSet.class));
@@ -114,10 +112,8 @@ public class TerminationPointCreateCommandTest {
     public void testStampInstanceIdentifier() {
         TransactionBuilder transaction = mock(TransactionBuilder.class);
 
-        when(transaction.getDatabaseSchema()).thenReturn(mock(DatabaseSchema.class));
-        PowerMockito.mockStatic(TyperUtils.class);
         Port port = mock(Port.class);
-        PowerMockito.when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(Port.class))).thenReturn(port);
+        when(transaction.getTypedRowWrapper(eq(Port.class))).thenReturn(port);
         doNothing().when(port).setName(anyString());
         doNothing().when(port).setExternalIds(any(HashMap.class));
         when(port.getSchema()).thenReturn(mock(GenericTableSchema.class));
@@ -150,7 +146,7 @@ public class TerminationPointCreateCommandTest {
         verify(transaction).add(any(Operation.class));
     }
 
-    private Object setField(String fieldName) throws Exception {
+    private 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));
index 34274c29864e242e4342f010bc1064756b7dcaae..95d81b2cf2f92d1965ebfd3e93449eee1b02fe4e 100644 (file)
@@ -5,12 +5,11 @@
  * 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.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+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.times;
@@ -32,9 +31,7 @@ import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
 import org.opendaylight.ovsdb.lib.operations.Update;
 import org.opendaylight.ovsdb.lib.operations.Where;
 import org.opendaylight.ovsdb.lib.schema.ColumnSchema;
-import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
-import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.openvswitch.Interface;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
 import org.opendaylight.ovsdb.southbound.InstanceIdentifierCodec;
@@ -50,7 +47,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
 @RunWith(PowerMockRunner.class)
-@PrepareForTest({ TerminationPointUpdateCommand.class, TransactUtils.class, TyperUtils.class, VlanMode.class,
+@PrepareForTest({ TerminationPointUpdateCommand.class, TransactUtils.class, VlanMode.class,
         TerminationPointCreateCommand.class, InstanceIdentifier.class, Operations.class })
 public class TerminationPointUpdateCommandTest {
 
@@ -104,12 +101,10 @@ public class TerminationPointUpdateCommandTest {
 
         // Test updateInterface()
         Interface ovsInterface = mock(Interface.class);
-        when(transaction.getDatabaseSchema()).thenReturn(mock(DatabaseSchema.class));
-        PowerMockito.mockStatic(TyperUtils.class);
-        when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(Interface.class))).thenReturn(ovsInterface);
+        when(transaction.getTypedRowWrapper(eq(Interface.class))).thenReturn(ovsInterface);
 
         Interface extraInterface = mock(Interface.class);
-        when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(Interface.class))).thenReturn(extraInterface);
+        when(transaction.getTypedRowWrapper(eq(Interface.class))).thenReturn(extraInterface);
         doNothing().when(extraInterface).setName(anyString());
 
         Operations op = OvsdbNodeUpdateCommandTest.setOpField();
@@ -130,9 +125,9 @@ public class TerminationPointUpdateCommandTest {
 
         // Test updatePort()
         Port port = mock(Port.class);
-        when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(Port.class))).thenReturn(port);
+        when(transaction.getTypedRowWrapper(eq(Port.class))).thenReturn(port);
         Port extraPort = mock(Port.class);
-        when(TyperUtils.getTypedRowWrapper(any(DatabaseSchema.class), eq(Port.class))).thenReturn(extraPort);
+        when(transaction.getTypedRowWrapper(eq(Port.class))).thenReturn(extraPort);
         doNothing().when(extraPort).setName(anyString());
         when(op.update(any(Port.class))).thenReturn(update);
         when(extraPort.getNameColumn()).thenReturn(column);