import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;\r
import org.opendaylight.controller.md.sal.binding.api.DataBroker;\r
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;\r
-import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;\r
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;\r
import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;\r
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;\r
import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;\r
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;\r
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;\r
import org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.SocketInfo;\r
import org.opendaylight.groupbasedpolicy.util.DataStoreHelper;\r
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortKey;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;\r
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;\r
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;\r
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;\r
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;\r
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;\r
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;\r
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;\r
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;\r
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;\r
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
}\r
\r
void processCreated(Port port) {\r
- ReadTransaction rTx = dataBroker.newReadOnlyTransaction();\r
+ ReadOnlyTransaction rTx = transactionChain.newReadOnlyTransaction();\r
Optional<BaseEndpointByPort> optBaseEpByPort = DataStoreHelper.readFromDs(LogicalDatastoreType.OPERATIONAL,\r
createBaseEpByPortIid(port.getUuid()), rTx);\r
+ rTx.close();\r
if (!optBaseEpByPort.isPresent()) {\r
return;\r
}\r
}\r
\r
void processCreated(BaseEndpointByPort bebp) {\r
- ReadTransaction rTx = dataBroker.newReadOnlyTransaction();\r
+ ReadOnlyTransaction rTx = transactionChain.newReadOnlyTransaction();\r
Optional<Port> optPort = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION,\r
createPortIid(bebp.getPortId()), rTx);\r
+ rTx.close();\r
if (!optPort.isPresent()) {\r
return;\r
}\r
\r
void processUpdated(Port original, Port delta) {\r
if (isValidVhostUser(original)) {\r
- ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction();\r
+ ReadOnlyTransaction rTx = transactionChain.newReadOnlyTransaction();\r
Optional<BaseEndpointByPort> optBebp = DataStoreHelper.readFromDs(LogicalDatastoreType.OPERATIONAL,\r
createBaseEpByPortIid(original.getUuid()), rTx);\r
rTx.close();\r
}\r
}\r
\r
- private void writeVppEndpoint(InstanceIdentifier<VppEndpoint> vppEpIid, VppEndpoint vppEp) {\r
+ private synchronized void writeVppEndpoint(InstanceIdentifier<VppEndpoint> vppEpIid, VppEndpoint vppEp) {\r
WriteTransaction wTx = transactionChain.newWriteOnlyTransaction();\r
if (vppEp != null) {\r
wTx.put(LogicalDatastoreType.CONFIGURATION, vppEpIid, vppEp, true);\r
} else {\r
wTx.delete(LogicalDatastoreType.CONFIGURATION, vppEpIid);\r
}\r
- try {\r
- wTx.submit().checkedGet();\r
- } catch (TransactionCommitFailedException e) {\r
- LOG.error("Transaction chain commit failed. {}", e);\r
- transactionChain.close();\r
- transactionChain = dataBroker.createTransactionChain(this);\r
- }\r
+ wTx.submit();\r
}\r
\r
@VisibleForTesting\r
@Override\r
public void onTransactionChainFailed(TransactionChain<?, ?> chain, AsyncTransaction<?, ?> transaction,\r
Throwable cause) {\r
- LOG.error("Transaction chain failed. {}", cause.getMessage());\r
+ LOG.error("Transaction chain failed. {} \nTransaction which caused the chain to fail {}", cause.getMessage(),\r
+ transaction, cause);\r
transactionChain.close();\r
transactionChain = dataBroker.createTransactionChain(this);\r
}\r
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.any;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.junit.Before;
ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction();
Optional<VppEndpoint> optVppEp = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION,
TestUtils.createVppEpIid(TestUtils.createVppEndpointKey(bebp)), rTx);
- verify(transactionChain).newReadOnlyTransaction();
- verify(transactionChain, times(2)).newWriteOnlyTransaction();
assertTrue(optVppEp.isPresent());
}
ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction();
Optional<VppEndpoint> optVppEp = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION,
TestUtils.createVppEpIid(TestUtils.createVppEndpointKey(bebp)), rTx);
- // looks for existing Vpp endpoint
- verify(transactionChain).newReadOnlyTransaction();
- // only removes former valid vpp endpoint
- verify(transactionChain).newWriteOnlyTransaction();
assertFalse(optVppEp.isPresent());
}
Optional<VppEndpoint> optVppEp = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION,
TestUtils.createVppEpIid(TestUtils.createVppEndpointKey(bebp)), rTx);
assertFalse(optVppEp.isPresent());
- verify(transactionChain).newReadOnlyTransaction();
- verify(transactionChain).newWriteOnlyTransaction();
}
private void putVppEp(Port port, BaseEndpointByPort bebp, WriteTransaction rwTx) {
package org.opendaylight.groupbasedpolicy.renderer.vpp.iface;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import javax.annotation.Nonnull;
import org.opendaylight.groupbasedpolicy.renderer.vpp.event.VppEndpointConfEvent;
import org.opendaylight.groupbasedpolicy.renderer.vpp.util.General.Operations;
import org.opendaylight.groupbasedpolicy.renderer.vpp.util.MountedDataBrokerProvider;
+import org.opendaylight.groupbasedpolicy.util.DataStoreHelper;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.absolute.location.absolute.location.LocationType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.base_endpoint.rev160427.has.absolute.location.absolute.location.location.type.ExternalLocationCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.eventbus.Subscribe;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
@Subscribe
public synchronized void vppEndpointChanged(VppEndpointConfEvent event) {
- switch (event.getDtoModificationType()) {
- case CREATED:
- vppEndpointCreated(event.getAfter().get());
- break;
- case UPDATED:
- vppEndpointDeleted(event.getBefore().get());
- vppEndpointCreated(event.getAfter().get());
- break;
- case DELETED:
- vppEndpointDeleted(event.getBefore().get());
- break;
+ try {
+ switch (event.getDtoModificationType()) {
+ case CREATED:
+ vppEndpointCreated(event.getAfter().get()).get();
+ break;
+ case UPDATED:
+ vppEndpointDeleted(event.getBefore().get()).get();
+ vppEndpointCreated(event.getAfter().get()).get();
+ break;
+ case DELETED:
+ vppEndpointDeleted(event.getBefore().get()).get();
+ break;
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Failed to update Vpp Endpoint. {}", e);
+ e.printStackTrace();
}
}
- private void vppEndpointCreated(VppEndpoint vppEndpoint) {
+ private ListenableFuture<Void> vppEndpointCreated(VppEndpoint vppEndpoint) {
Optional<ConfigCommand> potentialIfaceCommand = createInterfaceWithoutBdCommand(vppEndpoint, Operations.PUT);
if (!potentialIfaceCommand.isPresent()) {
- return;
+ return Futures.immediateFuture(null);
}
ConfigCommand ifaceWithoutBdCommand = potentialIfaceCommand.get();
InstanceIdentifier<?> vppNodeIid = vppEndpoint.getVppNodePath();
Optional<DataBroker> potentialVppDataProvider = mountDataProvider.getDataBrokerForMountPoint(vppNodeIid);
if (!potentialVppDataProvider.isPresent()) {
LOG.debug("Cannot get data broker for mount point {}", vppNodeIid);
- return;
+ Futures.immediateFuture(null);
}
DataBroker vppDataBroker = potentialVppDataProvider.get();
- createIfaceOnVpp(ifaceWithoutBdCommand, vppDataBroker, vppEndpoint, vppNodeIid);
+ return createIfaceOnVpp(ifaceWithoutBdCommand, vppDataBroker, vppEndpoint, vppNodeIid);
}
- private void createIfaceOnVpp(ConfigCommand createIfaceWithoutBdCommand, DataBroker vppDataBroker,
- VppEndpoint vppEndpoint, InstanceIdentifier<?> vppNodeIid) {
+ private ListenableFuture<Void> createIfaceOnVpp(ConfigCommand createIfaceWithoutBdCommand,
+ DataBroker vppDataBroker, VppEndpoint vppEndpoint, InstanceIdentifier<?> vppNodeIid) {
ReadWriteTransaction rwTx = vppDataBroker.newReadWriteTransaction();
createIfaceWithoutBdCommand.execute(rwTx);
- Futures.addCallback(rwTx.submit(), new FutureCallback<Void>() {
+ return Futures.transform(rwTx.submit(), new AsyncFunction<Void, Void>() {
@Override
- public void onSuccess(Void result) {
+ public ListenableFuture<Void> apply(Void input) {
LOG.debug("Create interface on VPP command was successful:\nVPP: {}\nCommand: {}", vppNodeIid,
createIfaceWithoutBdCommand);
- vppEndpointLocationProvider.createLocationForVppEndpoint(vppEndpoint);
- }
-
- @Override
- public void onFailure(Throwable t) {
- LOG.error("Create interface on VPP command was NOT successful:\nVPP: {}\nCommand: {}", vppNodeIid,
- createIfaceWithoutBdCommand, t);
+ return vppEndpointLocationProvider.createLocationForVppEndpoint(vppEndpoint);
}
}, netconfWorker);
}
- private void vppEndpointDeleted(VppEndpoint vppEndpoint) {
+ private ListenableFuture<Void> vppEndpointDeleted(VppEndpoint vppEndpoint) {
Optional<ConfigCommand> potentialIfaceCommand = createInterfaceWithoutBdCommand(vppEndpoint, Operations.DELETE);
if (!potentialIfaceCommand.isPresent()) {
- return;
+ return Futures.immediateFuture(null);
}
ConfigCommand ifaceWithoutBdCommand = potentialIfaceCommand.get();
InstanceIdentifier<?> vppNodeIid = vppEndpoint.getVppNodePath();
Optional<DataBroker> potentialVppDataProvider = mountDataProvider.getDataBrokerForMountPoint(vppNodeIid);
if (!potentialVppDataProvider.isPresent()) {
LOG.debug("Cannot get data broker for mount point {}", vppNodeIid);
- return;
+ return Futures.immediateFuture(null);
}
DataBroker vppDataBroker = potentialVppDataProvider.get();
- deleteIfaceOnVpp(ifaceWithoutBdCommand, vppDataBroker, vppEndpoint, vppNodeIid);
+ return deleteIfaceOnVpp(ifaceWithoutBdCommand, vppDataBroker, vppEndpoint, vppNodeIid);
}
- private void deleteIfaceOnVpp(ConfigCommand deleteIfaceWithoutBdCommand, DataBroker vppDataBroker,
- VppEndpoint vppEndpoint, InstanceIdentifier<?> vppNodeIid) {
+ private ListenableFuture<Void> deleteIfaceOnVpp(ConfigCommand deleteIfaceWithoutBdCommand,
+ DataBroker vppDataBroker, VppEndpoint vppEndpoint, InstanceIdentifier<?> vppNodeIid) {
ReadWriteTransaction rwTx = vppDataBroker.newReadWriteTransaction();
deleteIfaceWithoutBdCommand.execute(rwTx);
- Futures.addCallback(rwTx.submit(), new FutureCallback<Void>() {
+
+ return Futures.transform(rwTx.submit(), new AsyncFunction<Void, Void>() {
@Override
- public void onSuccess(Void result) {
+ public ListenableFuture<Void> apply(Void input) {
LOG.debug("Delete interface on VPP command was successful:\nVPP: {}\nCommand: {}", vppNodeIid,
deleteIfaceWithoutBdCommand);
- vppEndpointLocationProvider.deleteLocationForVppEndpoint(vppEndpoint);
- }
-
- @Override
- public void onFailure(Throwable t) {
- LOG.error("Delete interface on VPP command was NOT successful:\nVPP: {}\nCommand: {}", vppNodeIid,
- deleteIfaceWithoutBdCommand, t);
+ return vppEndpointLocationProvider.deleteLocationForVppEndpoint(vppEndpoint);
}
}, netconfWorker);
}
LOG.debug("Bridge domain {} already exists on interface {}", bridgeDomainName, interfacePath);
String bridgeDomainPath = VppPathMapper.bridgeDomainToRestPath(bridgeDomainName);
if (!bridgeDomainPath.equals(epLoc.getExternalNode())) {
- vppEndpointLocationProvider.replaceLocationForEndpoint(new ExternalLocationCaseBuilder()
+ return vppEndpointLocationProvider.replaceLocationForEndpoint(new ExternalLocationCaseBuilder()
.setExternalNode(bridgeDomainPath)
.setExternalNodeMountPoint(vppNodeIid)
.setExternalNodeConnector(interfacePath)
InstanceIdentifier<L2> l2Iid =
interfaceIid.builder().augmentation(VppInterfaceAugmentation.class).child(L2.class).build();
- L2 l2 = new L2Builder()
- .setInterconnection(new BridgeBasedBuilder().setBridgeDomain(bridgeDomainName).build()).build();
- rwTx.merge(LogicalDatastoreType.CONFIGURATION, l2Iid, l2);
+ Optional<L2> optL2 = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, l2Iid, rwTx);
+ L2Builder l2Builder = (optL2.isPresent()) ? new L2Builder(optL2.get()) : new L2Builder();
+ L2 l2 = l2Builder.setInterconnection(new BridgeBasedBuilder().setBridgeDomain(bridgeDomainName).build()).build();
+ rwTx.put(LogicalDatastoreType.CONFIGURATION, l2Iid, l2);
LOG.debug("Adding bridge domain {} to interface {}", bridgeDomainName, interfacePath);
- return Futures.transform(rwTx.submit(), new Function<Void, Void>() {
+ return Futures.transform(rwTx.submit(), new AsyncFunction<Void, Void>() {
@Override
- public Void apply(Void input) {
+ public ListenableFuture<Void> apply(Void input) {
String bridgeDomainPath = VppPathMapper.bridgeDomainToRestPath(bridgeDomainName);
- vppEndpointLocationProvider.replaceLocationForEndpoint(new ExternalLocationCaseBuilder()
+ return vppEndpointLocationProvider.replaceLocationForEndpoint(new ExternalLocationCaseBuilder()
.setExternalNode(bridgeDomainPath)
.setExternalNodeMountPoint(vppNodeIid)
.setExternalNodeConnector(interfacePath)
.build(), addrEpWithLoc.getKey());
- return null;
}
}, netconfWorker);
}
LOG.debug("Bridge domain does not exist therefore it is cosidered as"
+ "deleted for interface {}", interfacePath);
// bridge domain does not exist on interface so we consider job done
- vppEndpointLocationProvider.replaceLocationForEndpoint(new ExternalLocationCaseBuilder()
+ return vppEndpointLocationProvider.replaceLocationForEndpoint(new ExternalLocationCaseBuilder()
.setExternalNode(null)
.setExternalNodeMountPoint(vppNodeIid)
.setExternalNodeConnector(interfacePath)
.build(), addrEpWithLoc.getKey());
- return Futures.immediateFuture(null);
}
InstanceIdentifier<L2> l2Iid =
interfaceIid.builder().augmentation(VppInterfaceAugmentation.class).child(L2.class).build();
rwTx.delete(LogicalDatastoreType.CONFIGURATION, l2Iid);
LOG.debug("Deleting bridge domain from interface {}", interfacePath);
- return Futures.transform(rwTx.submit(), new Function<Void, Void>() {
+ return Futures.transform(rwTx.submit(), new AsyncFunction<Void, Void>() {
@Override
- public Void apply(Void input) {
- vppEndpointLocationProvider.replaceLocationForEndpoint(new ExternalLocationCaseBuilder()
+ public ListenableFuture<Void> apply(Void input) {
+ return vppEndpointLocationProvider.replaceLocationForEndpoint(new ExternalLocationCaseBuilder()
.setExternalNode(null)
.setExternalNodeMountPoint(vppNodeIid)
.setExternalNodeConnector(interfacePath)
.build(), addrEpWithLoc.getKey());
- return null;
}
}, netconfWorker);
}
private static boolean hasNodeAndInterface(VppEndpoint vppEp) {
if (vppEp.getVppNodePath() == null) {
- LOG.trace("vpp-node is missing. {}", vppEp);
+ LOG.debug("vpp-node is missing. {}", vppEp);
return false;
}
if (Strings.isNullOrEmpty(vppEp.getVppInterfaceName())) {
- LOG.trace("vpp-interface-name is missing. {}", vppEp);
+ LOG.debug("vpp-interface-name is missing. {}", vppEp);
return false;
}
return true;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Function;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
public class VppEndpointLocationProvider implements AutoCloseable {
});
}
- public void createLocationForVppEndpoint(VppEndpoint vppEndpoint) {
- ProviderAddressEndpointLocation providerAddressEndpointLocation =
- createProviderAddressEndpointLocation(vppEndpoint);
+ public ListenableFuture<Void> createLocationForVppEndpoint(VppEndpoint vppEndpoint) {
+ ProviderAddressEndpointLocation providerAddressEndpointLocation = createProviderAddressEndpointLocation(vppEndpoint);
WriteTransaction wTx = txChain.newWriteOnlyTransaction();
- wTx.put(LogicalDatastoreType.CONFIGURATION,
- IidFactory.providerAddressEndpointLocationIid(VPP_ENDPOINT_LOCATION_PROVIDER,
- providerAddressEndpointLocation.getKey()),
+ wTx.put(LogicalDatastoreType.CONFIGURATION, IidFactory.providerAddressEndpointLocationIid(
+ VPP_ENDPOINT_LOCATION_PROVIDER, providerAddressEndpointLocation.getKey()),
providerAddressEndpointLocation);
LOG.debug("Creating location for {}", providerAddressEndpointLocation.getKey());
- Futures.addCallback(wTx.submit(), new FutureCallback<Void>() {
+ return Futures.transform(wTx.submit(), new Function<Void, Void>() {
@Override
- public void onSuccess(Void result) {
+ public Void apply(Void input) {
LOG.debug("{} provided location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(),
providerAddressEndpointLocation);
- }
-
- @Override
- public void onFailure(Throwable t) {
- LOG.error("{} failed to provide location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(),
- providerAddressEndpointLocation, t);
+ return null;
}
});
}
.build();
}
- public void deleteLocationForVppEndpoint(VppEndpoint vppEndpoint) {
+ public ListenableFuture<Void> deleteLocationForVppEndpoint(VppEndpoint vppEndpoint) {
ProviderAddressEndpointLocationKey provAddrEpLocKey = createProviderAddressEndpointLocationKey(vppEndpoint);
WriteTransaction wTx = txChain.newWriteOnlyTransaction();
wTx.delete(LogicalDatastoreType.CONFIGURATION,
IidFactory.providerAddressEndpointLocationIid(VPP_ENDPOINT_LOCATION_PROVIDER, provAddrEpLocKey));
LOG.debug("Deleting location for {}", provAddrEpLocKey);
- Futures.addCallback(wTx.submit(), new FutureCallback<Void>() {
+ return Futures.transform(wTx.submit(), new Function<Void, Void>() {
@Override
- public void onSuccess(Void result) {
+ public Void apply(Void input) {
LOG.debug("{} removed location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(), provAddrEpLocKey);
- }
-
- @Override
- public void onFailure(Throwable t) {
- LOG.error("{} failed to remove location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(),
- provAddrEpLocKey, t);
+ return null;
}
});
}
vppEndpoint.getContextId(), vppEndpoint.getContextType());
}
- public void replaceLocationForEndpoint(@Nonnull ExternalLocationCase location, @Nonnull AddressEndpointWithLocationKey addrEpWithLocKey) {
+ public ListenableFuture<Void> replaceLocationForEndpoint(@Nonnull ExternalLocationCase location, @Nonnull AddressEndpointWithLocationKey addrEpWithLocKey) {
ProviderAddressEndpointLocationKey provAddrEpLocKey =
KeyFactory.providerAddressEndpointLocationKey(addrEpWithLocKey);
AbsoluteLocation absoluteLocation =
providerAddressEndpointLocation.getKey()),
providerAddressEndpointLocation);
LOG.debug("Updating location for {}", provAddrEpLocKey);
- Futures.addCallback(wTx.submit(), new FutureCallback<Void>() {
+ return Futures.transform(wTx.submit(), new Function<Void, Void>() {
@Override
- public void onSuccess(Void result) {
+ public Void apply(Void input) {
LOG.debug("{} replaced location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(),
providerAddressEndpointLocation);
- }
-
- @Override
- public void onFailure(Throwable t) {
- LOG.error("{} failed to replace location: {}", VPP_ENDPOINT_LOCATION_PROVIDER.getValue(),
- providerAddressEndpointLocation, t);
+ return null;
}
});
}
this.modificationForFutureSet = Preconditions.checkNotNull(modificationForFutureSet);
this.iid = Preconditions.checkNotNull(iid);
registeredListener = dataProvider.registerDataTreeChangeListener(iid, this);
- LOG.trace("Registered listener for path {}", iid.getRootIdentifier());
+ LOG.debug("Registered listener for path {}", iid.getRootIdentifier());
}
@Override
private void unregisterOnTrue(boolean _true) {
if (_true) {
- LOG.trace("Unregistering listener for path {}", iid.getRootIdentifier());
+ LOG.debug("Unregistering listener for path {}", iid.getRootIdentifier());
if (registeredListener != null) {
registeredListener.close();
}
private void createVxlanBridgeDomains(String bd, VxlanVni vni, Set<NodeId> vppNodes) {
for (NodeId vppNode : vppNodes) {
try {
- LOG.trace("Creating VXLAN bridge-domain {} on node {} with VNI {}", bd, vppNode.getValue(),
+ LOG.debug("Creating VXLAN bridge-domain {} on node {} with VNI {}", bd, vppNode.getValue(),
vni);
// TODO think about propagating ListenableFuture - timeout set as workaround
bdManager.createVxlanBridgeDomainOnVppNode(bd, vni, vppNode).get(WAIT_FOR_BD_CREATION,
private void createVlanBridgeDomains(String bd, VlanId vlanId, Set<NodeId> vppNodes) {
for (NodeId vppNode : vppNodes) {
try {
- LOG.trace("Creating VLAN bridge-domain {} on node {} with VLAN ID {}", bd, vppNode.getValue(),
+ LOG.debug("Creating VLAN bridge-domain {} on node {} with VLAN ID {}", bd, vppNode.getValue(),
vlanId.getValue());
// TODO think about propagating ListenableFuture - timeout set as workaround
bdManager.createVlanBridgeDomainOnVppNode(bd, vlanId, vppNode).get(WAIT_FOR_BD_CREATION,
RendererPolicyBuilder responseBuilder = new RendererPolicyBuilder();
switch (event.getDtoModificationType()) {
case CREATED:
- LOG.trace("CREATED : {}", event.getIid());
+ LOG.debug("CREATED : {}", event.getIid());
responseBuilder.setVersion(event.getAfter().get().getVersion());
rendererPolicyCreated(event.getAfter().get());
break;
case UPDATED:
- LOG.trace("UPDATED: {}", event.getIid());
+ LOG.debug("UPDATED: {}", event.getIid());
RendererPolicy rPolicyBefore = event.getBefore().get();
RendererPolicy rPolicyAfter = event.getAfter().get();
responseBuilder.setVersion(rPolicyAfter.getVersion());
}
break;
case DELETED:
- LOG.trace("DELETED: {}", event.getIid());
+ LOG.debug("DELETED: {}", event.getIid());
responseBuilder.setVersion(event.getBefore().get().getVersion());
rendererPolicyDeleted(event.getBefore().get());
break;
ImmutableSet<RendererEndpointKey> rendEpsAfter = policyCtxAfter.getPolicyTable().rowKeySet();
SetView<RendererEndpointKey> removedRendEps = Sets.difference(rendEpsBefore, rendEpsAfter);
- LOG.trace("Removed renderer endpoints {}", removedRendEps);
+ LOG.debug("Removed renderer endpoints {}", removedRendEps);
removedRendEps.forEach(rEpKey -> fwManager.removeForwardingForEndpoint(rEpKey, policyCtxBefore));
- LOG.trace("Removed bridge domains on nodes {}", removedVppNodesByL2Fd);
- LOG.trace("Created bridge domains on nodes {}", createdVppNodesByL2Fd);
+ LOG.debug("Removed bridge domains on nodes {}", removedVppNodesByL2Fd);
+ LOG.debug("Created bridge domains on nodes {}", createdVppNodesByL2Fd);
fwManager.removeBridgeDomainOnNodes(removedVppNodesByL2Fd);
fwManager.createBridgeDomainOnNodes(createdVppNodesByL2Fd);
SetView<RendererEndpointKey> createdRendEps = Sets.difference(rendEpsAfter, rendEpsBefore);
- LOG.trace("Created renderer endpoints {}", createdRendEps);
+ LOG.debug("Created renderer endpoints {}", createdRendEps);
createdRendEps.forEach(rEpKey -> fwManager.createForwardingForEndpoint(rEpKey, policyCtxAfter));
SetView<RendererEndpointKey> updatedRendEps = Sets.intersection(rendEpsBefore, rendEpsAfter);
- LOG.trace("Updated renderer endpoints {}", updatedRendEps);
+ LOG.debug("Updated renderer endpoints {}", updatedRendEps);
// update forwarding for endpoint
updatedRendEps.forEach(rEpKey -> {
AddressEndpointWithLocation addrEpWithLocBefore =
policyCtxAfter.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey));
if (isLocationChanged(addrEpWithLocBefore, addrEpWithLocAfter)) {
LOG.debug("Location is changed in endpoint {}", rEpKey);
- LOG.trace("\nLocation before: {}\nLocation after: {}", addrEpWithLocBefore.getAbsoluteLocation(),
+ LOG.debug("\nLocation before: {}\nLocation after: {}", addrEpWithLocBefore.getAbsoluteLocation(),
addrEpWithLocAfter.getAbsoluteLocation());
fwManager.removeForwardingForEndpoint(rEpKey, policyCtxBefore);
fwManager.createForwardingForEndpoint(rEpKey, policyCtxAfter);