use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.evpn.rd.to.networks.EvpnRdToNetwork in project netvirt by opendaylight.
the class EvpnMacVrfUtils method getElanNameByMacvrfiid.
public String getElanNameByMacvrfiid(InstanceIdentifier<MacVrfEntry> instanceIdentifier) {
try (ReadOnlyTransaction tx = dataBroker.newReadOnlyTransaction()) {
String rd = instanceIdentifier.firstKeyOf(VrfTables.class).getRouteDistinguisher();
String elanName = null;
InstanceIdentifier<EvpnRdToNetwork> iidEvpnRdToNet = InstanceIdentifier.builder(EvpnRdToNetworks.class).child(EvpnRdToNetwork.class, new EvpnRdToNetworkKey(rd)).build();
try {
Optional<EvpnRdToNetwork> evpnRdToNetwork = tx.read(LogicalDatastoreType.CONFIGURATION, iidEvpnRdToNet).checkedGet();
if (evpnRdToNetwork.isPresent()) {
elanName = evpnRdToNetwork.get().getNetworkId();
}
} catch (ReadFailedException e) {
LOG.error("getElanName: unable to read elanName, exception ", e);
}
return elanName;
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.evpn.rd.to.networks.EvpnRdToNetwork in project netvirt by opendaylight.
the class NeutronEvpnUtils method updateVpnWithElanInfo.
public void updateVpnWithElanInfo(VpnInstance vpnInstance, String elanInstanceName, Operation operation) {
String rd = vpnManager.getPrimaryRdFromVpnInstance(vpnInstance);
InstanceIdentifier<EvpnRdToNetwork> rdToNetworkIdentifier = getRdToNetworkIdentifier(rd);
jobCoordinator.enqueueJob("EVPN_ASSOCIATE-" + rd, () -> {
ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction();
List<ListenableFuture<Void>> futures = new ArrayList<>();
if (operation == Operation.DELETE) {
LOG.debug("Deleting Evpn-Network with key {}", rd);
transaction.delete(LogicalDatastoreType.CONFIGURATION, rdToNetworkIdentifier);
} else {
EvpnRdToNetworkBuilder evpnRdToNetworkBuilder = new EvpnRdToNetworkBuilder().setKey(new EvpnRdToNetworkKey(rd));
evpnRdToNetworkBuilder.setRd(rd);
evpnRdToNetworkBuilder.setNetworkId(elanInstanceName);
LOG.info("updating Evpn {} with elaninstance {} and rd {}", vpnInstance.getVpnInstanceName(), elanInstanceName, rd);
transaction.put(LogicalDatastoreType.CONFIGURATION, rdToNetworkIdentifier, evpnRdToNetworkBuilder.build(), WriteTransaction.CREATE_MISSING_PARENTS);
}
futures.add(transaction.submit());
return futures;
});
}
Aggregations