Add uuid for mac-entries, improved logging 46/36046/1
authorVishal Thapar <vishal.thapar@ericsson.com>
Sat, 5 Mar 2016 11:09:59 +0000 (16:39 +0530)
committerSam Hague <shague@redhat.com>
Thu, 10 Mar 2016 13:38:55 +0000 (13:38 +0000)
1. Store and use uuid for entries in mac-tables
2. Fix and improve logging for easier troubleshooting
3. A workaround in PhysicalSwitchUpdate

Change-Id: I6da68e59bcacdeef43a3e353f934bd8097a44253
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
17 files changed:
hwvtepsouthbound/hwvtepsouthbound-api/src/main/yang/hwvtep.yang
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/PhysicalPortUpdateCommand.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/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
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/McastMacsLocalUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/McastMacsRemoteUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/PhysicalSwitchUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/UcastMacsLocalUpdateCommand.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/UcastMacsRemoteUpdateCommand.java

index 4496ae3baa43b950722c491112aadb3d85d50c9b..766588ad88f83497ddc3b361bec27532a00df113 100644 (file)
@@ -53,6 +53,10 @@ module hwvtep {
             description "MAC address entry";
             type yang:mac-address;
         }
+        leaf mac-entry-uuid {
+            description "The unique identifier of the mac-entry";
+            type yang:uuid;
+        }
         leaf logical-switch-ref {
             description "The logical switch to which this mapping applies";
             type hwvtep-logical-switch-ref;
index 2ae002d6ce472a3b4997ab7fe2e3835b0ebe3b3a..905a788dcf3a8147ed40fe7d220ecaf2dab60dc9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -71,16 +71,20 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand {
             setTunnelKey(logicalSwitch, lswitch);
             if (!operationalSwitchOptional.isPresent()) {
                 setName(logicalSwitch, lswitch, operationalSwitchOptional);
+                LOG.trace("execute: creating LogicalSwitch entry: {}", logicalSwitch);
                 transaction.add(op.insert(logicalSwitch));
+                transaction.add(op.comment("Logical Switch: Creating " + lswitch.getHwvtepNodeName().getValue()));
             } else {
                 LogicalSwitches updatedLSwitch = operationalSwitchOptional.get();
                 String existingLogicalSwitchName = updatedLSwitch.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);
                 extraLogicalSwitch.setName("");
+                LOG.trace("execute: updating LogicalSwitch entry: {}", logicalSwitch);
                 transaction.add(op.update(logicalSwitch)
                         .where(extraLogicalSwitch.getNameColumn().getSchema().opEqual(existingLogicalSwitchName))
                         .build());
+                transaction.add(op.comment("Logical Switch: Updating " + existingLogicalSwitchName));
             }
         }
     }
index fd5d5030fcdaee2047a6a61fd47df2d89793eaf0..25e04a31abb09016535a37bd24c158e1cfc5ea67 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -20,6 +20,7 @@ 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.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;
@@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.base.Optional;
 
 public class McastMacsLocalRemoveCommand extends AbstractTransactCommand {
-    private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+    private static final Logger LOG = LoggerFactory.getLogger(McastMacsLocalRemoveCommand.class);
 
     public McastMacsLocalRemoveCommand(HwvtepOperationalState state,
             Collection<DataTreeModification<Node>> changes) {
@@ -60,18 +61,13 @@ public class McastMacsLocalRemoveCommand extends AbstractTransactCommand {
                     getOperationalState().getLocalMcastMacs(instanceIdentifier, mac.getKey());
             McastMacsLocal mcastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
                     McastMacsLocal.class, null);
-            if (operationalMacOptional.isPresent()) {
+            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
-                String macString = null;
-                if (mac.getMacEntryKey().equals(HwvtepSouthboundConstants.UNKNOWN_DST_MAC)) {
-                    macString = HwvtepSouthboundConstants.UNKNOWN_DST_STRING;
-                } else {
-                    macString = mac.getMacEntryKey().getValue();
-                }
-                transaction.add(op.delete(mcastMacsLocal.getSchema())
-                        .where(mcastMacsLocal.getMacColumn().getSchema().opEqual(macString)).build());
-                transaction.add(op.comment("Local McastMacLocal: Deleting " + mac.getMacEntryKey().getValue()));
+                UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
+                transaction.add(op.delete(mcastMacsLocal.getSchema()).
+                        where(mcastMacsLocal.getUuidColumn().getSchema().opEqual(macEntryUUID)).build());
+                transaction.add(op.comment("McastMacLocal: Deleting " + mac.getMacEntryKey().getValue()));
             } else {
                 LOG.warn("Unable to delete localMcastMacs {} because it was not found in the operational store",
                         mac.getMacEntryKey().getValue());
index f735ae0e1a3cdcece5719db4d6c25f0257e4b0c5..f9b2871d8271399728cab1376deefd850b28ed6b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.base.Optional;
 
 public class McastMacsLocalUpdateCommand extends AbstractTransactCommand {
-    private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+    private static final Logger LOG = LoggerFactory.getLogger(McastMacsLocalUpdateCommand.class);
 
     public McastMacsLocalUpdateCommand(HwvtepOperationalState state,
             Collection<DataTreeModification<Node>> changes) {
@@ -74,15 +74,19 @@ public class McastMacsLocalUpdateCommand extends AbstractTransactCommand {
             setLogicalSwitch(mcastMacsLocal, localMcastMac);
             if (!operationalMacOptional.isPresent()) {
                 setMac(mcastMacsLocal, localMcastMac, operationalMacOptional);
+                LOG.trace("execute: create LocalMcastMac entry: {}", mcastMacsLocal);
                 transaction.add(op.insert(mcastMacsLocal));
+                transaction.add(op.comment("McastMacLocal: Creating " + localMcastMac.getMacEntryKey().getValue()));
             } else {
                 LocalMcastMacs updatedMac = operationalMacOptional.get();
                 String existingMac = updatedMac.getMacEntryKey().getValue();
                 McastMacsLocal extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), McastMacsLocal.class);
-                extraMac.setMac("");;
+                extraMac.setMac("");
+                LOG.trace("execute: update LocalMcastMac entry: {}", mcastMacsLocal);
                 transaction.add(op.update(mcastMacsLocal)
                         .where(extraMac.getMacColumn().getSchema().opEqual(existingMac))
                         .build());
+                transaction.add(op.comment("McastMacLocal: Updating " + localMcastMac.getMacEntryKey().getValue()));
             }
         }
     }
index 2c0e8d55de7f23a589ba3a1e0bbc5426be20796b..65dc3ee5fc00538e1d41cf780c0f5d4a0e21b45e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -20,6 +20,7 @@ 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.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.McastMacsRemote;
@@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.base.Optional;
 
 public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand {
-    private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+    private static final Logger LOG = LoggerFactory.getLogger(McastMacsRemoteRemoveCommand.class);
 
     public McastMacsRemoteRemoveCommand(HwvtepOperationalState state,
             Collection<DataTreeModification<Node>> changes) {
@@ -60,18 +61,13 @@ public class McastMacsRemoteRemoveCommand extends AbstractTransactCommand {
                     getOperationalState().getRemoteMcastMacs(instanceIdentifier, mac.getKey());
             McastMacsRemote mcastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
                     McastMacsRemote.class, null);
-            if (operationalMacOptional.isPresent()) {
+            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
-                String macString = null;
-                if (mac.getMacEntryKey().equals(HwvtepSouthboundConstants.UNKNOWN_DST_MAC)) {
-                    macString = HwvtepSouthboundConstants.UNKNOWN_DST_STRING;
-                } else {
-                    macString = mac.getMacEntryKey().getValue();
-                }
-                transaction.add(op.delete(mcastMacsRemote.getSchema())
-                        .where(mcastMacsRemote.getMacColumn().getSchema().opEqual(macString)).build());
-                transaction.add(op.comment("Remote McastMacRemote: Deleting " + mac.getMacEntryKey().getValue()));
+                UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
+                transaction.add(op.delete(mcastMacsRemote.getSchema()).
+                        where(mcastMacsRemote.getUuidColumn().getSchema().opEqual(macEntryUUID)).build());
+                transaction.add(op.comment("McastMacRemote: Deleting " + mac.getMacEntryKey().getValue()));
             } else {
                 LOG.warn("Unable to delete remoteMcastMacs {} because it was not found in the operational store",
                         mac.getMacEntryKey().getValue());
index 23938eaffd41ff9c7190312a87bc990a9468df76..fdeab3d0ec6cf623e3410d179d778f6aa6f14aa7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.base.Optional;
 
 public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand {
-    private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+    private static final Logger LOG = LoggerFactory.getLogger(McastMacsRemoteUpdateCommand.class);
 
     public McastMacsRemoteUpdateCommand(HwvtepOperationalState state,
             Collection<DataTreeModification<Node>> changes) {
@@ -74,15 +74,19 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactCommand {
             setLogicalSwitch(mcastMacsRemote, mac);
             if (!operationalMacOptional.isPresent()) {
                 setMac(mcastMacsRemote, mac, operationalMacOptional);
+                LOG.trace("execute: create RemoteMcastMac entry: {}", mcastMacsRemote);
                 transaction.add(op.insert(mcastMacsRemote));
+                transaction.add(op.comment("McastMacRemote: Creating " + mac.getMacEntryKey().getValue()));
             } else {
                 RemoteMcastMacs updatedMac = operationalMacOptional.get();
                 String existingMac = updatedMac.getMacEntryKey().getValue();
                 McastMacsRemote extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), McastMacsRemote.class);
-                extraMac.setMac("");;
+                extraMac.setMac("");
+                LOG.trace("execute: update RemoteMcastMac entry: {}", mcastMacsRemote);
                 transaction.add(op.update(mcastMacsRemote)
                         .where(extraMac.getMacColumn().getSchema().opEqual(existingMac))
                         .build());
+                transaction.add(op.comment("McastMacRemote: Updating " + mac.getMacEntryKey().getValue()));
             }
         }
     }
index 00376a46bf11f35d0dfe2de8890870ba902fc928..053c5cfc588142d44815a22a892e9bb0b8647460 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -89,17 +89,21 @@ public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
                 //create a physical port
                 setName(physicalPort, port, operationalPhysicalPortOptional);
                 String portUuid = "PhysicalPort_" + HwvtepSouthboundMapper.getRandomUUID();
+                LOG.trace("execute: creating physical port: {}", physicalPort);
                 transaction.add(op.insert(physicalPort).withId(portUuid));
+                transaction.add(op.comment("Physical Port: Creating " + port.getHwvtepNodeName().getValue()));
                 //update physical switch table
                 PhysicalSwitch physicalSwitch = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), PhysicalSwitch.class);
                 physicalSwitch.setName(physicalSwitchBelong.getHwvtepNodeName().getValue());
                 physicalSwitch.setPorts(Sets.newHashSet(new UUID(portUuid)));
-                LOG.info("execute: physical switch: {}", physicalSwitch);
+                LOG.trace("execute: mutating physical switch: {}", physicalSwitch);
                 transaction.add(op.mutate(physicalSwitch)
                         .addMutation(physicalSwitch.getPortsColumn().getSchema(), Mutator.INSERT,
                                 physicalSwitch.getPortsColumn().getData())
                         .where(physicalSwitch.getNameColumn().getSchema().opEqual(physicalSwitch.getNameColumn().getData()))
                         .build());
+                transaction.add(op.comment("Physical Switch: Mutating " +
+                                port.getHwvtepNodeName().getValue() + " " + portUuid));
             } else {
                 //updated physical port only
                 HwvtepPhysicalPortAugmentation updatedPhysicalPort = operationalPhysicalPortOptional.get();
@@ -107,9 +111,11 @@ public class PhysicalPortUpdateCommand extends AbstractTransactCommand {
                 PhysicalPort extraPhyscialPort =
                         TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), PhysicalPort.class);
                 extraPhyscialPort.setName("");
+                LOG.trace("execute: updating physical port: {}", physicalPort);
                 transaction.add(op.update(physicalPort)
                         .where(extraPhyscialPort.getNameColumn().getSchema().opEqual(existingPhysicalPortName))
                         .build());
+                transaction.add(op.comment("Physical Port: Updating " + existingPhysicalPortName));
             }
         }
     }
index c639ec1ad4d984328929082c712326539666ec23..838ae9c8dac610a3cddd4b24fa0ce681bc894b26 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -84,29 +84,44 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
         setDescription(physicalSwitch, physicalSwitchAugmentation);
         setManagementIps(physicalSwitch, physicalSwitchAugmentation);
         setTunnuleIps(physicalSwitch, physicalSwitchAugmentation);
-        setTunnels(transaction, iid, physicalSwitch, physicalSwitchAugmentation);
+        setTunnels(transaction, iid, physicalSwitch, physicalSwitchAugmentation,
+                        operationalPhysicalSwitchOptional.isPresent());
         if (!operationalPhysicalSwitchOptional.isPresent()) {
             //create a physical switch
             setName(physicalSwitch, physicalSwitchAugmentation, operationalPhysicalSwitchOptional);
             String pswitchUuid = "PhysicalSwitch_" + HwvtepSouthboundMapper.getRandomUUID();
             transaction.add(op.insert(physicalSwitch).withId(pswitchUuid));
+            transaction.add(op.comment("Physical Switch: Creating " +
+                            physicalSwitchAugmentation.getHwvtepNodeName().getValue()));
             //update global table
             Global global = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Global.class);
             global.setSwitches(Sets.newHashSet(new UUID(pswitchUuid)));
 
-            LOG.debug("execute: physical switch: {}", physicalSwitch);
+            LOG.trace("execute: create physical switch: {}", physicalSwitch);
             transaction.add(op.mutate(global)
                     .addMutation(global.getSwitchesColumn().getSchema(), Mutator.INSERT,
                             global.getSwitchesColumn().getData()));
+            transaction.add(op.comment("Global: Mutating " +
+                            physicalSwitchAugmentation.getHwvtepNodeName().getValue() + " " + pswitchUuid));
         } else {
             PhysicalSwitchAugmentation updatedPhysicalSwitch = operationalPhysicalSwitchOptional.get();
             String existingPhysicalSwitchName = updatedPhysicalSwitch.getHwvtepNodeName().getValue();
+            /* In case TOR devices don't allow creation of PhysicalSwitch name might be null
+             * as user is only adding configurable parameters to MDSAL like BFD params
+             * 
+             * TODO Note: Consider handling tunnel udpate/remove in separate command
+             */
+            if(existingPhysicalSwitchName == null) {
+                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);
             extraPhysicalSwitch.setName("");
+            LOG.trace("execute: updating physical switch: {}", physicalSwitch);
             transaction.add(op.update(physicalSwitch)
                     .where(extraPhysicalSwitch.getNameColumn().getSchema().opEqual(existingPhysicalSwitchName))
                     .build());
+            transaction.add(op.comment("Physical Switch: Updating " + existingPhysicalSwitchName));
         }
     }
 
@@ -147,36 +162,62 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactCommand {
 
     @SuppressWarnings("unchecked")
     private void setTunnels(TransactionBuilder transaction, InstanceIdentifier<Node> iid,
-                    PhysicalSwitch physicalSwitch, PhysicalSwitchAugmentation physicalSwitchAugmentation) {
+                    PhysicalSwitch physicalSwitch, PhysicalSwitchAugmentation physicalSwitchAugmentation,
+                    boolean pSwitchExists) {
         //TODO: revisit this code for optimizations
         //TODO: needs more testing
         if(physicalSwitchAugmentation.getTunnels() != null) {
-            Set<UUID> tunnels = Sets.newHashSet();
             for(Tunnels tunnel: physicalSwitchAugmentation.getTunnels()) {
                 Optional<Tunnels> opTunnelOpt = getOperationalState().getTunnels(iid, tunnel.getKey());
                 Tunnel newTunnel = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Tunnel.class);
-                String tunnelUuid = null;
-                if(!opTunnelOpt.isPresent()) {
-                    tunnelUuid = "Tunnel_" + HwvtepSouthboundMapper.getRandomUUID();
-                } else {
-                    tunnelUuid = opTunnelOpt.get().getTunnelUuid().getValue();
-                }
+
                 UUID localUUID = getLocatorUUID(transaction,
                                 (InstanceIdentifier<TerminationPoint>) tunnel.getLocalLocatorRef().getValue());
                 UUID remoteUUID = getLocatorUUID(transaction,
                                 (InstanceIdentifier<TerminationPoint>) tunnel.getRemoteLocatorRef().getValue());
                 if(localUUID != null && remoteUUID != null) {
+                    UUID uuid;
                     // local and remote must exist
                     newTunnel.setLocal(localUUID);
                     newTunnel.setRemote(remoteUUID);
                     setBfdParams(newTunnel, tunnel);
                     setBfdLocalConfigs(newTunnel, tunnel);
                     setBfdRemoteConfigs(newTunnel, tunnel);
-                    transaction.add(op.insert(newTunnel).withId(tunnelUuid));
-                    tunnels.add(new UUID(tunnelUuid));
+                    if(!opTunnelOpt.isPresent()) {
+                        String tunnelUuid = "Tunnel_" + HwvtepSouthboundMapper.getRandomUUID();
+                        transaction.add(op.insert(newTunnel).withId(tunnelUuid));
+                        transaction.add(op.comment("Tunnel: Creating " + tunnelUuid));
+                        if(!pSwitchExists) {
+                            //TODO: Figure out a way to handle this
+                            LOG.warn("Tunnel configuration requires pre-existing physicalSwitch");
+                        } else {
+                            // TODO: Can we reuse physicalSwitch instead?
+                            PhysicalSwitch pSwitch =
+                                            TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
+                                                            PhysicalSwitch.class);
+                            pSwitch.setTunnels(Sets.newHashSet(new UUID(tunnelUuid)));
+                            pSwitch.setName(physicalSwitchAugmentation.getHwvtepNodeName().getValue());
+                            transaction.add(op.mutate(pSwitch)
+                                            .addMutation(pSwitch.getTunnels().getSchema(), Mutator.INSERT,
+                                                    pSwitch.getTunnels().getData())
+                                            .where(pSwitch.getNameColumn().getSchema().
+                                                            opEqual(pSwitch.getNameColumn().getData()))
+                                            .build());
+                            transaction.add(op.comment("PhysicalSwitch: Mutating " + tunnelUuid));
+                        }
+                        uuid = new UUID(tunnelUuid);
+                    } else {
+                        uuid = new UUID (opTunnelOpt.get().getTunnelUuid().getValue());
+                        Tunnel extraTunnel =
+                                TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Tunnel.class, null);
+                        extraTunnel.getUuidColumn().setData(uuid);
+                        transaction.add(op.update(newTunnel)
+                                        .where(extraTunnel.getUuidColumn().getSchema().opEqual(uuid))
+                                        .build());
+                        transaction.add(op.comment("Tunnel: Updating " + uuid));
+                    }
                 }
             }
-            physicalSwitch.setTunnels(tunnels);
         }
     }
 
index fb6f7d244d220a545df92032df7b4a9bc37fd329..a333450bc5a8b808948ce7d5560e48c623a1952c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -19,6 +19,7 @@ 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.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
 import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsLocal;
@@ -32,7 +33,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.base.Optional;
 
 public class UcastMacsLocalRemoveCommand extends AbstractTransactCommand {
-    private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+    private static final Logger LOG = LoggerFactory.getLogger(UcastMacsLocalRemoveCommand.class);
 
     public UcastMacsLocalRemoveCommand(HwvtepOperationalState state,
             Collection<DataTreeModification<Node>> changes) {
@@ -57,14 +58,15 @@ public class UcastMacsLocalRemoveCommand extends AbstractTransactCommand {
             LOG.debug("Removing remoteUcastMacs, mac address: {}", mac.getMacEntryKey().getValue());
             Optional<LocalUcastMacs> operationalMacOptional =
                     getOperationalState().getLocalUcastMacs(instanceIdentifier, mac.getKey());
-            UcastMacsLocal mcastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
+            UcastMacsLocal ucastMacsLocal = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
                     UcastMacsLocal.class, null);
-            if (operationalMacOptional.isPresent()) {
+            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.
-                transaction.add(op.delete(mcastMacsLocal.getSchema())
-                        .where(mcastMacsLocal.getMacColumn().getSchema().opEqual(mac.getMacEntryKey().getValue())).build());
-                transaction.add(op.comment("Local UcastMacLocal: Deleting " + mac.getMacEntryKey().getValue()));
+                UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
+                transaction.add(op.delete(ucastMacsLocal.getSchema()).
+                        where(ucastMacsLocal.getUuidColumn().getSchema().opEqual(macEntryUUID)).build());
+                transaction.add(op.comment("UcastMacLocal: Deleting " + mac.getMacEntryKey().getValue()));
             } else {
                 LOG.warn("Unable to delete remoteUcastMacs {} because it was not found in the operational store",
                         mac.getMacEntryKey().getValue());
index 52d212c21d02db9e08aea7e41c3f8439c2e885bc..bd9ba06413b81014acb3c54a2e62e688e24bb2f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.base.Optional;
 
 public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand {
-    private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+    private static final Logger LOG = LoggerFactory.getLogger(UcastMacsLocalUpdateCommand.class);
 
     public UcastMacsLocalUpdateCommand(HwvtepOperationalState state,
             Collection<DataTreeModification<Node>> changes) {
@@ -77,15 +77,19 @@ public class UcastMacsLocalUpdateCommand extends AbstractTransactCommand {
             setLogicalSwitch(ucastMacsLocal, localUcastMac);
             if (!operationalMacOptional.isPresent()) {
                 setMac(ucastMacsLocal, localUcastMac, operationalMacOptional);
+                LOG.trace("execute: creating LocalUcastMac entry: {}", ucastMacsLocal);
                 transaction.add(op.insert(ucastMacsLocal));
+                transaction.add(op.comment("UcastMacLocal: Creating " + localUcastMac.getMacEntryKey().getValue()));
             } else {
                 LocalUcastMacs updatedMac = operationalMacOptional.get();
                 String existingMac = updatedMac.getMacEntryKey().getValue();
                 UcastMacsLocal extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), UcastMacsLocal.class);
-                extraMac.setMac("");;
+                extraMac.setMac("");
+                LOG.trace("execute: updating LocalUcastMac entry: {}", ucastMacsLocal);
                 transaction.add(op.update(ucastMacsLocal)
                         .where(extraMac.getMacColumn().getSchema().opEqual(existingMac))
                         .build());
+                transaction.add(op.comment("UcastMacLocal: Updating " + localUcastMac.getMacEntryKey().getValue()));
             }
         }
     }
index e9a43c7344b2145cc4c8b37a263b39cded1a2919..fed83dc72cad2fd1fdf520add06612109049f5fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -19,6 +19,7 @@ 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.notation.UUID;
 import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
 import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsRemote;
@@ -32,7 +33,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.base.Optional;
 
 public class UcastMacsRemoteRemoveCommand extends AbstractTransactCommand {
-    private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+    private static final Logger LOG = LoggerFactory.getLogger(UcastMacsRemoteRemoveCommand.class);
 
     public UcastMacsRemoteRemoveCommand(HwvtepOperationalState state,
             Collection<DataTreeModification<Node>> changes) {
@@ -57,14 +58,15 @@ public class UcastMacsRemoteRemoveCommand extends AbstractTransactCommand {
             LOG.debug("Removing remoteUcastMacs, mac address: {}", mac.getMacEntryKey().getValue());
             Optional<RemoteUcastMacs> operationalMacOptional =
                     getOperationalState().getRemoteUcastMacs(instanceIdentifier, mac.getKey());
-            UcastMacsRemote mcastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
+            UcastMacsRemote ucastMacsRemote = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(),
                     UcastMacsRemote.class, null);
-            if (operationalMacOptional.isPresent()) {
+            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 need to be removed explicitly by user.
-                transaction.add(op.delete(mcastMacsRemote.getSchema())
-                        .where(mcastMacsRemote.getMacColumn().getSchema().opEqual(mac.getMacEntryKey().getValue())).build());
-                transaction.add(op.comment("Remote UcastMacRemote: Deleting " + mac.getMacEntryKey().getValue()));
+                UUID macEntryUUID = new UUID(operationalMacOptional.get().getMacEntryUuid().getValue());
+                transaction.add(op.delete(ucastMacsRemote.getSchema()).
+                        where(ucastMacsRemote.getUuidColumn().getSchema().opEqual(macEntryUUID)).build());
+                transaction.add(op.comment("UcastMacRemote: Deleting " + mac.getMacEntryKey().getValue()));
             } else {
                 LOG.warn("Unable to delete remoteUcastMacs {} because it was not found in the operational store",
                         mac.getMacEntryKey().getValue());
index 227608c2c6c6f395cb42856371688eacd573344d..de841c184d5e73b6cb2220cbe213e6361a3488d0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 China Telecom Beijing Research Institute and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 China Telecom Beijing Research Institute and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -24,10 +24,8 @@ import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
 import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsRemote;
 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;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
@@ -38,7 +36,7 @@ import org.slf4j.LoggerFactory;
 import com.google.common.base.Optional;
 
 public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand {
-    private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+    private static final Logger LOG = LoggerFactory.getLogger(UcastMacsRemoteUpdateCommand.class);
 
     public UcastMacsRemoteUpdateCommand(HwvtepOperationalState state,
             Collection<DataTreeModification<Node>> changes) {
@@ -77,15 +75,19 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactCommand {
             setLogicalSwitch(ucastMacsRemote, remoteUcastMac);
             if (!operationalMacOptional.isPresent()) {
                 setMac(ucastMacsRemote, remoteUcastMac, operationalMacOptional);
+                LOG.trace("execute: creating RemotUcastMac entry: {}", ucastMacsRemote);
                 transaction.add(op.insert(ucastMacsRemote));
+                transaction.add(op.comment("UcastMacRemote: Creating " + remoteUcastMac.getMacEntryKey().getValue()));
             } else {
                 RemoteUcastMacs updatedMac = operationalMacOptional.get();
                 String existingMac = updatedMac.getMacEntryKey().getValue();
                 UcastMacsRemote extraMac = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), UcastMacsRemote.class);
-                extraMac.setMac("");;
+                extraMac.setMac("");
+                LOG.trace("execute: updating RemotUcastMac entry: {}", ucastMacsRemote);
                 transaction.add(op.update(ucastMacsRemote)
                         .where(extraMac.getMacColumn().getSchema().opEqual(existingMac))
                         .build());
+                transaction.add(op.comment("UcastMacRemote: Updating " + remoteUcastMac.getMacEntryKey().getValue()));
             }
         }
     }
index 252047ba05eeadd067723ea28a3b61b3c065b71e..4ff016658a2780a61c46a05ab521ec9473ac8e00 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -31,6 +31,7 @@ import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocatorSet;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
@@ -88,6 +89,7 @@ public class McastMacsLocalUpdateCommand extends AbstractTransactionCommand {
         } else {
             mMacLocalBuilder.setMacEntryKey(new MacAddress(mMacLocal.getMac()));
         }
+        mMacLocalBuilder.setMacEntryUuid(new Uuid(mMacLocal.getUuid().toString()));
         setIpAddress(mMacLocalBuilder, mMacLocal);
         setLocatorSet(mMacLocalBuilder, mMacLocal);
         setLogicalSwitch(mMacLocalBuilder, mMacLocal);
index 631f1c7be509e8a5fcf94349dd4e650d5b71bbd6..ed5ed5cd83a4fcccd4035da696350ce5101a316c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -31,6 +31,7 @@ import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocatorSet;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
@@ -88,6 +89,7 @@ public class McastMacsRemoteUpdateCommand extends AbstractTransactionCommand {
         } else {
             mMacRemoteBuilder.setMacEntryKey(new MacAddress(mMacRemote.getMac()));
         }
+        mMacRemoteBuilder.setMacEntryUuid(new Uuid(mMacRemote.getUuid().toString()));
         setIpAddress(mMacRemoteBuilder, mMacRemote);
         setLocatorSet(mMacRemoteBuilder, mMacRemote);
         setLogicalSwitch(mMacRemoteBuilder, mMacRemote);
index 696bc8a737d8322e7800b86880e5d89f25c4d4b2..f474c8131093829498f51bb13921b2ca6f350d9e 100644 (file)
@@ -138,7 +138,7 @@ public class PhysicalSwitchUpdateCommand extends AbstractTransactionCommand {
                                     HwvtepSouthboundMapper.createInstanceIdentifier(node.getNodeId()), pLoc);
                     tBuilder.setLocalLocatorRef(new HwvtepPhysicalLocatorRef(tpPath));
                 }
-
+                tBuilder.setTunnelUuid(new Uuid(uuid.toString()));
                 setBfdLocalConfigs(tBuilder, tunnel);
                 setBfdRemoteConfigs(tBuilder, tunnel);
                 setBfdParams(tBuilder, tunnel);
index 73dbfdc05ab726953f9ad3e4f87cde3950833d20..cc4ae95048e787c333c9a1d68d4e7a9103c8b43e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -9,9 +9,11 @@
 package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
 
 import com.google.common.base.Optional;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
@@ -26,6 +28,7 @@ import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
 import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsLocal;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
@@ -80,6 +83,7 @@ public class UcastMacsLocalUpdateCommand extends AbstractTransactionCommand {
             ucmlBuilder.setIpaddr(new IpAddress(ucml.getIpAddr().toCharArray()));
         }
         ucmlBuilder.setMacEntryKey(new MacAddress(ucml.getMac()));
+        ucmlBuilder.setMacEntryUuid(new Uuid(ucml.getUuid().toString()));
         if (ucml.getLocatorColumn() != null && ucml.getLocatorColumn().getData() != null) {
             UUID plocUUID = ucml.getLocatorColumn().getData();
             PhysicalLocator physicalLocator = updatedPLocRows.get(plocUUID);
index 7ebe81a2e471954db211a982373308059e618fb7..e26d6670f153d7b6c50a38ece5d87c27f98d2007 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
+ * Copyright (c) 2015, 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -26,6 +26,7 @@ import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
 import org.opendaylight.ovsdb.schema.hardwarevtep.UcastMacsRemote;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+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;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
@@ -78,6 +79,7 @@ public class UcastMacsRemoteUpdateCommand extends AbstractTransactionCommand {
         List<RemoteUcastMacs> remoteUMacs = new ArrayList<>();
         RemoteUcastMacsBuilder rumBuilder = new RemoteUcastMacsBuilder();
         rumBuilder.setMacEntryKey(new MacAddress(uMacRemote.getMac()));
+        rumBuilder.setMacEntryUuid(new Uuid(uMacRemote.getUuid().toString()));
         if (uMacRemote.getIpAddr() != null && !uMacRemote.getIpAddr().isEmpty()) {
             rumBuilder.setIpaddr(new IpAddress(uMacRemote.getIpAddr().toCharArray()));
         }