X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=interfacemgr%2Finterfacemgr-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fvpnservice%2Finterfacemgr%2Flisteners%2FInterfaceConfigListener.java;h=7e764aa0adbf251eb91113734a7719abfda0db3f;hb=9c0e16907ffb4d6c79ea397885f9dfed738dc848;hp=9eb7869c8e94b1e7fda5fa37b24b10fbd2989e0d;hpb=9144b0b91bbcd2fa8b8c93c5dd3db6763b2710d4;p=vpnservice.git diff --git a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/listeners/InterfaceConfigListener.java b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/listeners/InterfaceConfigListener.java index 9eb7869c..7e764aa0 100644 --- a/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/listeners/InterfaceConfigListener.java +++ b/interfacemgr/interfacemgr-impl/src/main/java/org/opendaylight/vpnservice/interfacemgr/listeners/InterfaceConfigListener.java @@ -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, @@ -39,6 +39,7 @@ public class InterfaceConfigListener extends AsyncDataTreeChangeListenerBase key, Interface interfaceOld) { LOG.debug("Received Interface Remove Event: {}, {}", key, interfaceOld); String ifName = interfaceOld.getName(); - String parentInterface = null; - ParentRefs parentRefs = interfaceOld.getAugmentation(ParentRefs.class); - if (parentRefs != null) { - parentInterface = parentRefs.getParentInterface(); - if (parentInterface != null && !parentInterface.equals(ifName)) { - return; - } - if (parentRefs.getDatapathNodeIdentifier() == null) { - return; - } - } - DataStoreJobCoordinator coordinator = DataStoreJobCoordinator.getInstance(); RendererConfigRemoveWorker configWorker = new RendererConfigRemoveWorker(key, interfaceOld, ifName, parentRefs); - coordinator.enqueueJob(ifName, configWorker); + coordinator.enqueueJob(ifName, configWorker, MAX_RETRIES); } @Override protected void update(InstanceIdentifier key, Interface interfaceOld, Interface interfaceNew) { LOG.debug("Received Interface Update Event: {}, {}, {}", key, interfaceOld, interfaceNew); String ifNameNew = interfaceNew.getName(); - String parentInterface = null; - ParentRefs parentRefs = interfaceNew.getAugmentation(ParentRefs.class); - if (parentRefs != null) { - parentInterface = parentRefs.getParentInterface(); - } - - if (parentInterface != null && !parentInterface.equals(ifNameNew)) { + if (parentRefs == null || parentRefs.getDatapathNodeIdentifier() == null && parentRefs.getParentInterface() == null) { + LOG.error("parent refs not specified for {}",interfaceNew.getName()); return; } - DataStoreJobCoordinator coordinator = DataStoreJobCoordinator.getInstance(); RendererConfigUpdateWorker worker = new RendererConfigUpdateWorker(key, interfaceOld, interfaceNew, ifNameNew); - coordinator.enqueueJob(ifNameNew, worker); + coordinator.enqueueJob(ifNameNew, worker, MAX_RETRIES); } @Override protected void add(InstanceIdentifier key, Interface interfaceNew) { LOG.debug("Received Interface Add Event: {}, {}", key, interfaceNew); String ifName = interfaceNew.getName(); - String parentInterface = null; - ParentRefs parentRefs = interfaceNew.getAugmentation(ParentRefs.class); - if (parentRefs != null) { - parentInterface = parentRefs.getParentInterface(); - } - - if (parentInterface != null && !parentInterface.equals(ifName)) { + if (parentRefs == null || parentRefs.getDatapathNodeIdentifier() == null && parentRefs.getParentInterface() == null) { + LOG.error("parent refs not specified for {}",interfaceNew.getName()); return; } - DataStoreJobCoordinator coordinator = DataStoreJobCoordinator.getInstance(); RendererConfigAddWorker configWorker = new RendererConfigAddWorker(key, interfaceNew, parentRefs, ifName); - coordinator.enqueueJob(ifName, configWorker); + coordinator.enqueueJob(ifName, configWorker, MAX_RETRIES); } private class RendererConfigAddWorker implements Callable>> { @@ -141,7 +118,7 @@ public class InterfaceConfigListener extends AsyncDataTreeChangeListenerBase