use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class InterVpnLinkLocatorTest method cleanL3Vpns.
public void cleanL3Vpns(DataBroker broker, List<L3VpnComposite> vpns) throws TransactionCommitFailedException {
for (L3VpnComposite vpn : vpns) {
WriteTransaction writeTx1 = broker.newWriteOnlyTransaction();
writeTx1.delete(LogicalDatastoreType.OPERATIONAL, VpnUtil.getVpnInstanceOpDataIdentifier(vpn.vpnOpData.getVrfId()));
writeTx1.submit().checkedGet();
WriteTransaction writeTx2 = broker.newWriteOnlyTransaction();
writeTx2.delete(LogicalDatastoreType.CONFIGURATION, VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpn.vpnCfgData.getVpnInstanceName()));
writeTx2.submit().checkedGet();
}
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class InterVpnLinkTestCatalog method cleanIvpnLinks.
public static void cleanIvpnLinks(DataBroker broker2, InterVpnLinkDataComposite... ivpnLinks) throws TransactionCommitFailedException {
for (InterVpnLinkDataComposite ivpnLink : ivpnLinks) {
WriteTransaction writeTx1 = broker2.newWriteOnlyTransaction();
writeTx1.delete(LogicalDatastoreType.OPERATIONAL, InterVpnLinkUtil.getInterVpnLinkStateIid(ivpnLink.getInterVpnLinkName()));
writeTx1.submit().checkedGet();
WriteTransaction writeTx2 = broker2.newWriteOnlyTransaction();
writeTx2.delete(LogicalDatastoreType.CONFIGURATION, InterVpnLinkUtil.getInterVpnLinkPath(ivpnLink.getInterVpnLinkName()));
writeTx2.submit().checkedGet();
}
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class VpnNodeListener method processNodeAdd.
private void processNodeAdd(BigInteger dpId) {
jobCoordinator.enqueueJob("VPNNODE-" + dpId.toString(), () -> {
WriteTransaction writeFlowTx = broker.newWriteOnlyTransaction();
LOG.debug("Received notification to install TableMiss entries for dpn {} ", dpId);
makeTableMissFlow(writeFlowTx, dpId, NwConstants.ADD_FLOW);
makeL3IntfTblMissFlow(writeFlowTx, dpId, NwConstants.ADD_FLOW);
makeSubnetRouteTableMissFlow(writeFlowTx, dpId, NwConstants.ADD_FLOW);
createTableMissForVpnGwFlow(writeFlowTx, dpId);
createL3GwMacArpFlows(writeFlowTx, dpId);
programTableMissForVpnVniDemuxTable(writeFlowTx, dpId, NwConstants.ADD_FLOW);
return Collections.singletonList(writeFlowTx.submit());
}, 3);
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class InterVpnLinkCreatorTask method call.
@Override
public List<ListenableFuture<Void>> call() {
LOG.debug("Persisting InterVpnLink {} with 1stEndpoint=[ vpn={}, ipAddr={} ] and 2ndEndpoint=[ vpn={}, ipAddr={} ]", interVpnLinkToPersist.getName(), interVpnLinkToPersist.getFirstEndpoint().getVpnUuid(), interVpnLinkToPersist.getFirstEndpoint().getIpAddress(), interVpnLinkToPersist.getSecondEndpoint().getVpnUuid(), interVpnLinkToPersist.getSecondEndpoint().getIpAddress());
List<ListenableFuture<Void>> result = new ArrayList<>();
WriteTransaction writeTx = dataBroker.newWriteOnlyTransaction();
writeTx.merge(LogicalDatastoreType.CONFIGURATION, InterVpnLinkUtil.getInterVpnLinkPath(interVpnLinkToPersist.getName()), interVpnLinkToPersist, true);
result.add(writeTx.submit());
return result;
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class NeutronvpnUtils method updateVpnInstanceOpWithType.
public void updateVpnInstanceOpWithType(VpnInstanceOpDataEntry.BgpvpnType choice, @Nonnull Uuid vpn) {
String primaryRd = getVpnRd(vpn.getValue());
if (primaryRd == null) {
LOG.debug("updateVpnInstanceOpWithType: Update BgpvpnType {} for {}." + "Primary RD not found", choice, vpn.getValue());
return;
}
InstanceIdentifier<VpnInstanceOpDataEntry> id = InstanceIdentifier.builder(VpnInstanceOpData.class).child(VpnInstanceOpDataEntry.class, new VpnInstanceOpDataEntryKey(primaryRd)).build();
Optional<VpnInstanceOpDataEntry> vpnInstanceOpDataEntryOptional = read(LogicalDatastoreType.OPERATIONAL, id);
if (!vpnInstanceOpDataEntryOptional.isPresent()) {
LOG.debug("updateVpnInstanceOpWithType: Update BgpvpnType {} for {}." + "VpnInstanceOpDataEntry not found", choice, vpn.getValue());
return;
}
VpnInstanceOpDataEntry vpnInstanceOpDataEntry = vpnInstanceOpDataEntryOptional.get();
if (vpnInstanceOpDataEntry.getBgpvpnType().equals(choice)) {
LOG.debug("updateVpnInstanceOpWithType: Update BgpvpnType {} for {}." + "VpnInstanceOpDataEntry already set", choice, vpn.getValue());
return;
}
VpnInstanceOpDataEntryBuilder builder = new VpnInstanceOpDataEntryBuilder(vpnInstanceOpDataEntry);
builder.setBgpvpnType(choice);
WriteTransaction writeTxn = dataBroker.newWriteOnlyTransaction();
writeTxn.merge(LogicalDatastoreType.OPERATIONAL, id, builder.build(), false);
LOG.debug("updateVpnInstanceOpWithType: sent merge to operDS BgpvpnType {} for {}", choice, vpn.getValue());
try {
writeTxn.submit().get();
} catch (InterruptedException | ExecutionException e) {
LOG.error("updateVpnInstanceOpWithType: on merge execution, error: {}", e);
}
return;
}
Aggregations