summaryrefslogtreecommitdiffstats
path: root/v3po
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-05-09 10:13:24 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-05-09 12:44:43 +0200
commit50df3ef61f342f265222c289497c3143212d2c12 (patch)
tree77cd48117dd159003127372727b53b8843af93d4 /v3po
parentac5c0256f9b96deda69da1d250d55c5d00b83046 (diff)
Comment out equality check in AbstractCompositeWriter.updateCurrent
There is a bug in ODL when checking auguments for equality: https://git.opendaylight.org/gerrit/#/c/37719 Until the bug is fixed, updateCurrentAttributes will be invoked even if there was no data change. It is customizer responsibility to perform equality check if invoking update without actual data change can cause side-effects in VPP. Change-Id: Id72ec55ea7179330a4ebb1df49c29195908c5461 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po')
-rw-r--r--v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/AbstractCompositeWriter.java14
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java7
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java12
3 files changed, 22 insertions, 11 deletions
diff --git a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/AbstractCompositeWriter.java b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/AbstractCompositeWriter.java
index b71200fc9..580910e8c 100644
--- a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/AbstractCompositeWriter.java
+++ b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/AbstractCompositeWriter.java
@@ -98,12 +98,14 @@ public abstract class AbstractCompositeWriter<D extends DataObject> implements W
final WriteContext ctx) throws WriteFailedException {
LOG.debug("{}: Updating current: {} dataBefore: {}, datAfter: {}", this, id, dataBefore, dataAfter);
- /* FIXME: Equals does not work properly with augments: https://git.opendaylight.org/gerrit/#/c/37719 */
- if (dataBefore.equals(dataAfter)) {
- LOG.debug("{}: Skipping current(no update): {}", this, id);
- // No change, ignore
- return;
- }
+ // FIXME: Equals does not work properly with augments: https://git.opendaylight.org/gerrit/#/c/37719
+ // Solution: update mdsal-binding-dom-codec to 0.8.2-Beryllium-SR2 when it will be published in
+ // ODL release repository
+ //if (dataBefore.equals(dataAfter)) {
+ // LOG.debug("{}: Skipping current(no update): {}", this, id);
+ // // No change, ignore
+ // return;
+ //}
switch (traversalType) {
case PREORDER: {
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java
index 4b4d7b3c1..a3e2f7340 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizer.java
@@ -142,6 +142,13 @@ public class BridgeDomainCustomizer
LOG.debug("updateCurrentAttributes: id={}, dataBefore={}, dataAfter={}, ctx={}", id, dataBefore, dataAfter,
ctx);
+ // FIXME can be removed after updating mdsal-binding-dom-codec to 0.8.2-Beryllium-SR2
+ // and restoring equality check in AbstractCompositeWriter
+ if (dataBefore.equals(dataAfter)) {
+ LOG.debug("dataBefore equals dataAfter, update will not be performed");
+ return;
+ }
+
final String bdName = checkNotNull(dataAfter.getName());
checkArgument(bdName.equals(dataBefore.getName()),
"BridgeDomain name changed. It should be deleted and then created.");
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java
index 5d5781adb..6e449070f 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java
@@ -239,10 +239,11 @@ public class BridgeDomainCustomizerTest {
@Test
public void testUpdateUnknownBridgeDomain() throws Exception {
final String bdName = "bd1";
- final BridgeDomain bd = generateBridgeDomain("bd1");
+ final BridgeDomain bdBefore = generateBridgeDomain(bdName, 0, 1, 0 ,1, 0);
+ final BridgeDomain bdAfter = generateBridgeDomain(bdName, 1, 1, 0 ,1, 0);
try {
- customizer.updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bd, bd, ctx);
+ customizer.updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx);
} catch (IllegalArgumentException e) {
verify(api, never()).bridgeDomainAddDel(any(BridgeDomainAddDel.class));
return;
@@ -254,15 +255,16 @@ public class BridgeDomainCustomizerTest {
public void testUpdateBridgeDomainFailed() throws Exception {
final int bdId = 1;
final String bdName = "bd1";
- final BridgeDomain bd = generateBridgeDomain(bdName);
+ final BridgeDomain bdBefore = generateBridgeDomain(bdName, 0, 1, 0 ,1, 0);
+ final BridgeDomain bdAfter = generateBridgeDomain(bdName, 1, 1, 0 ,1, 0);
namingContext.addName(bdId, bdName);
whenBridgeDomainAddDelThenFailure();
try {
- customizer.updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bd, bd, ctx);
+ customizer.updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx);
} catch (WriteFailedException.UpdateFailedException e) {
- verifyBridgeDomainAddOrUpdateWasInvoked(bd, bdId);
+ verifyBridgeDomainAddOrUpdateWasInvoked(bdAfter, bdId);
return;
}
fail("IllegalStateException was expected");