X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=hwvtepsouthbound%2Fhwvtepsouthbound-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fovsdb%2Fhwvtepsouthbound%2Ftransact%2FLogicalSwitchUpdateCommand.java;h=905a788dcf3a8147ed40fe7d220ecaf2dab60dc9;hb=c4c8855d4a7abfb7680c13b904e564e380188d8b;hp=e8498c7f7ea876f40b9452b149c21527e44dd10a;hpb=4805b929bd14445da3188e56988ef4120ed0f55a;p=ovsdb.git diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java index e8498c7f7..905a788dc 100644 --- a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java +++ b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalSwitchUpdateCommand.java @@ -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)); } } } @@ -118,7 +122,10 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand { final DataObjectModification mod = change.getRootNode(); Node created = TransactUtils.getCreated(mod); if (created != null) { - List lswitchListUpdated = created.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches(); + List lswitchListUpdated = null; + if (created.getAugmentation(HwvtepGlobalAugmentation.class) != null) { + lswitchListUpdated = created.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches(); + } if (lswitchListUpdated != null) { result.put(key, lswitchListUpdated); } @@ -139,8 +146,14 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand { Node updated = TransactUtils.getUpdated(mod); Node before = mod.getDataBefore(); if (updated != null && before != null) { - List lswitchListUpdated = updated.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches(); - List lswitchListBefore = before.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches(); + List lswitchListUpdated = null; + List lswitchListBefore = null; + if (updated.getAugmentation(HwvtepGlobalAugmentation.class) != null) { + lswitchListUpdated = updated.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches(); + } + if (before.getAugmentation(HwvtepGlobalAugmentation.class) != null) { + lswitchListBefore = before.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches(); + } if (lswitchListUpdated != null) { if (lswitchListBefore != null) { lswitchListUpdated.removeAll(lswitchListBefore);