use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class ElanInterfaceManager method createElanInterfacesList.
private DpnInterfaces createElanInterfacesList(String elanInstanceName, String interfaceName, BigInteger dpId, WriteTransaction tx) {
List<String> interfaceNames = new ArrayList<>();
interfaceNames.add(interfaceName);
DpnInterfaces dpnInterface = new DpnInterfacesBuilder().setDpId(dpId).setInterfaces(interfaceNames).setKey(new DpnInterfacesKey(dpId)).build();
tx.put(LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanDpnInterfaceOperationalDataPath(elanInstanceName, dpId), dpnInterface, WriteTransaction.CREATE_MISSING_PARENTS);
return dpnInterface;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class ElanInterfaceManager method updateElanDpnInterfacesList.
private DpnInterfaces updateElanDpnInterfacesList(String elanInstanceName, BigInteger dpId, List<String> interfaceNames, WriteTransaction tx) {
DpnInterfaces dpnInterface = new DpnInterfacesBuilder().setDpId(dpId).setInterfaces(interfaceNames).setKey(new DpnInterfacesKey(dpId)).build();
tx.put(LogicalDatastoreType.OPERATIONAL, ElanUtils.getElanDpnInterfaceOperationalDataPath(elanInstanceName, dpId), dpnInterface, WriteTransaction.CREATE_MISSING_PARENTS);
return dpnInterface;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class EvpnMacVrfUtils method addEvpnDmacFlow.
public void addEvpnDmacFlow(InstanceIdentifier<MacVrfEntry> instanceIdentifier, MacVrfEntry macVrfEntry) {
String elanName = getElanNameByMacvrfiid(instanceIdentifier);
if (elanName == null) {
LOG.error("Error : elanName is null for iid {}", instanceIdentifier);
return;
}
List<DpnInterfaces> dpnInterfaceLists = elanUtils.getElanDPNByName(elanName);
if (checkEvpnAttachedToNet(elanName)) {
// TODO(Riyaz) : Check if accessing first nexthop address is right solution
String nexthopIP = macVrfEntry.getRoutePaths().get(0).getNexthopAddress();
IpAddress ipAddress = new IpAddress(new Ipv4Address(nexthopIP));
Long elanTag = getElanTagByMacvrfiid(instanceIdentifier);
if (elanTag == null) {
return;
}
String dstMacAddress = macVrfEntry.getMac();
long vni = macVrfEntry.getL2vni();
jobCoordinator.enqueueJob(dstMacAddress, () -> {
List<ListenableFuture<Void>> futures = new ArrayList<>();
dpnInterfaceLists.forEach(dpnInterfaces -> {
BigInteger dpId = dpnInterfaces.getDpId();
LOG.info("ADD: Build DMAC flow with dpId {}, nexthopIP {}, elanTag {}," + "vni {}, dstMacAddress {}, elanName {} ", dpId, nexthopIP, elanTag, vni, dstMacAddress, elanName);
ElanEvpnFlowUtils.EvpnDmacFlowBuilder dmacFlowBuilder = new ElanEvpnFlowUtils.EvpnDmacFlowBuilder();
dmacFlowBuilder.setDpId(dpId).setNexthopIP(ipAddress.toString()).setElanTag(elanTag).setVni(vni).setDstMacAddress(dstMacAddress).setElanName(elanName);
Flow flow = elanEvpnFlowUtils.evpnBuildDmacFlowForExternalRemoteMac(dmacFlowBuilder.build());
futures.add(mdsalManager.installFlow(dpId, flow));
});
return futures;
}, ElanConstants.JOB_MAX_RETRIES);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class EvpnMacVrfUtils method removeEvpnDmacFlowOnDetach.
public void removeEvpnDmacFlowOnDetach(InstanceIdentifier<MacVrfEntry> instanceIdentifier, MacVrfEntry macVrfEntry, ElanInstance elanInstance) {
// String elanName = getElanNameByMacvrfiid(instanceIdentifier);
if (elanInstance == null) {
LOG.error("Error : elanInstance is null for iid {}", instanceIdentifier);
return;
}
List<DpnInterfaces> dpnInterfaceLists = elanUtils.getElanDPNByName(elanInstance.getElanInstanceName());
// if (checkEvpnAttachedToNet(elanName)) {
String nexthopIP = getRoutePathNexthopIp(macVrfEntry);
if (nexthopIP == null) {
LOG.debug("nexthopIP is null for iid {}", instanceIdentifier);
return;
}
IpAddress ipAddress = new IpAddress(new Ipv4Address(nexthopIP));
Long elanTag = elanInstance.getElanTag();
String macToRemove = macVrfEntry.getMac();
jobCoordinator.enqueueJob(macToRemove, () -> {
List<ListenableFuture<Void>> futures = new ArrayList<>();
dpnInterfaceLists.forEach(dpnInterfaces -> {
BigInteger dpId = dpnInterfaces.getDpId();
ElanEvpnFlowUtils.EvpnDmacFlowBuilder dmacFlowBuilder = new ElanEvpnFlowUtils.EvpnDmacFlowBuilder();
dmacFlowBuilder.setDpId(dpId).setNexthopIP(ipAddress.toString()).setElanTag(elanTag).setDstMacAddress(macToRemove);
LOG.info("REMOVE: Deleting DMAC Flows for external MAC. elanTag {}, dpId {}," + "nexthopIP {}, macToRemove {}", elanTag, dpId, nexthopIP, macToRemove);
elanEvpnFlowUtils.evpnDeleteDmacFlowsToExternalMac(dmacFlowBuilder.build());
});
return futures;
}, ElanConstants.JOB_MAX_RETRIES);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces in project netvirt by opendaylight.
the class EvpnMacVrfUtils method removeEvpnDmacFlow.
public void removeEvpnDmacFlow(InstanceIdentifier<MacVrfEntry> instanceIdentifier, MacVrfEntry macVrfEntry) {
String elanName = getElanNameByMacvrfiid(instanceIdentifier);
if (elanName == null) {
LOG.error("Error : elanName is null for iid {}", instanceIdentifier);
return;
}
List<DpnInterfaces> dpnInterfaceLists = elanUtils.getElanDPNByName(elanName);
// if (checkEvpnAttachedToNet(elanName)) {
// TODO(Riyaz) : Check if accessing first nexthop address is right
String nexthopIP = macVrfEntry.getRoutePaths().get(0).getNexthopAddress();
IpAddress ipAddress = new IpAddress(new Ipv4Address(nexthopIP));
Long elanTag = getElanTagByMacvrfiid(instanceIdentifier);
if (elanTag == null) {
return;
}
String macToRemove = macVrfEntry.getMac();
jobCoordinator.enqueueJob(macToRemove, () -> {
List<ListenableFuture<Void>> futures = new ArrayList<>();
dpnInterfaceLists.forEach(dpnInterfaces -> {
BigInteger dpId = dpnInterfaces.getDpId();
ElanEvpnFlowUtils.EvpnDmacFlowBuilder dmacFlowBuilder = new ElanEvpnFlowUtils.EvpnDmacFlowBuilder();
dmacFlowBuilder.setDpId(dpId).setNexthopIP(ipAddress.toString()).setElanTag(elanTag).setDstMacAddress(macToRemove);
LOG.info("REMOVE: Deleting DMAC Flows for external MAC. elanTag {}, dpId {}," + "nexthopIP {}, macToRemove {}", elanTag, dpId, nexthopIP, macToRemove);
futures.addAll(elanEvpnFlowUtils.evpnDeleteDmacFlowsToExternalMac(dmacFlowBuilder.build()));
});
return futures;
}, ElanConstants.JOB_MAX_RETRIES);
}
Aggregations