use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.vpn.instances.VpnInstanceBuilder in project netvirt by opendaylight.
the class NeutronvpnManager method updateVpnInstanceWithRDs.
public void updateVpnInstanceWithRDs(String vpnInstanceId, final List<String> rds) {
InstanceIdentifier<VpnInstance> vpnIdentifier = InstanceIdentifier.builder(VpnInstances.class).child(VpnInstance.class, new VpnInstanceKey(vpnInstanceId)).build();
try {
Optional<VpnInstance> vpnInstanceConfig = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, vpnIdentifier);
if (!vpnInstanceConfig.isPresent()) {
LOG.debug("updateVpnInstanceWithRDs: " + "No VpnInstance present under config vpnInstance:{}", vpnInstanceId);
return;
}
VpnInstance vpnInstance = vpnInstanceConfig.get();
VpnInstanceBuilder updateVpnInstanceBuilder = new VpnInstanceBuilder(vpnInstance);
updateVpnInstanceBuilder.setRouteDistinguisher(rds);
LOG.debug("updateVpnInstanceWithRDs: " + "Updating Config vpn-instance: {} with the list of RDs: {}", vpnInstanceId, rds);
SingleTransactionDataBroker.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, vpnIdentifier, updateVpnInstanceBuilder.build());
} catch (TransactionCommitFailedException | ExecutionException | InterruptedException ex) {
LOG.warn("updateVpnInstanceWithRDs: Error configuring vpn-instance: {} with " + "the list of RDs: {}", vpnInstanceId, rds, ex);
}
}
Aggregations