use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ElanForwardingEntriesHandler method createElanInterfaceForwardingTablesList.
public void createElanInterfaceForwardingTablesList(String interfaceName, MacEntry mac, WriteTransaction tx) {
InstanceIdentifier<MacEntry> existingMacEntryId = ElanUtils.getInterfaceMacEntriesIdentifierOperationalDataPath(interfaceName, mac.getMacAddress());
MacEntry existingInterfaceMacEntry = elanUtils.getInterfaceMacEntriesOperationalDataPathFromId(existingMacEntryId);
if (existingInterfaceMacEntry == null) {
MacEntry macEntry = new MacEntryBuilder().setMacAddress(mac.getMacAddress()).setIpPrefix(mac.getIpPrefix()).setInterface(interfaceName).setIsStaticAddress(true).setKey(new MacEntryKey(mac.getMacAddress())).build();
tx.put(LogicalDatastoreType.OPERATIONAL, existingMacEntryId, macEntry, WriteTransaction.CREATE_MISSING_PARENTS);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ElanForwardingEntriesHandler method deleteElanInterfaceForwardingTablesList.
public void deleteElanInterfaceForwardingTablesList(String interfaceName, MacEntry mac, WriteTransaction tx) {
InstanceIdentifier<MacEntry> existingMacEntryId = ElanUtils.getInterfaceMacEntriesIdentifierOperationalDataPath(interfaceName, mac.getMacAddress());
MacEntry existingInterfaceMacEntry = elanUtils.getInterfaceMacEntriesOperationalDataPathFromId(existingMacEntryId);
if (existingInterfaceMacEntry != null) {
tx.delete(LogicalDatastoreType.OPERATIONAL, existingMacEntryId);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ElanForwardingEntriesHandler method updateElanForwardingTablesList.
public void updateElanForwardingTablesList(String elanName, String interfaceName, MacEntry mac, WriteTransaction tx) {
InstanceIdentifier<MacEntry> macEntryId = ElanUtils.getMacEntryOperationalDataPath(elanName, mac.getMacAddress());
MacEntry existingMacEntry = elanUtils.getMacEntryFromElanMacId(macEntryId);
if (existingMacEntry != null && elanUtils.getElanMacTable(elanName) != null) {
MacEntry newMacEntry = new MacEntryBuilder().setInterface(interfaceName).setIsStaticAddress(true).setMacAddress(mac.getMacAddress()).setIpPrefix(mac.getIpPrefix()).setKey(new MacEntryKey(mac.getMacAddress())).build();
tx.put(LogicalDatastoreType.OPERATIONAL, macEntryId, newMacEntry);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ElanUtils method getElanInterfaceMacAddresses.
/**
* Gets the elan interface mac addresses.
*
* @param interfaceName
* the interface name
* @return the elan interface mac addresses
*/
public List<PhysAddress> getElanInterfaceMacAddresses(String interfaceName) {
List<PhysAddress> macAddresses = new ArrayList<>();
ElanInterfaceMac elanInterfaceMac = getElanInterfaceMacByInterfaceName(interfaceName);
if (elanInterfaceMac != null && elanInterfaceMac.getMacEntry() != null) {
List<MacEntry> macEntries = elanInterfaceMac.getMacEntry();
for (MacEntry macEntry : macEntries) {
macAddresses.add(macEntry.getMacAddress());
}
}
return macAddresses;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry in project netvirt by opendaylight.
the class ElanServiceProvider method getElanMacTable.
@Override
public Collection<MacEntry> getElanMacTable(String elanInstanceName) {
Elan elanInfo = ElanUtils.getElanByName(broker, elanInstanceName);
List<MacEntry> macAddress = new ArrayList<>();
if (elanInfo == null) {
return macAddress;
}
List<String> elanInterfaces = elanInfo.getElanInterfaces();
if (elanInterfaces != null && elanInterfaces.size() > 0) {
for (String elanInterface : elanInterfaces) {
ElanInterfaceMac elanInterfaceMac = elanUtils.getElanInterfaceMacByInterfaceName(elanInterface);
if (elanInterfaceMac != null && elanInterfaceMac.getMacEntry() != null && elanInterfaceMac.getMacEntry().size() > 0) {
macAddress.addAll(elanInterfaceMac.getMacEntry());
}
}
}
return macAddress;
}
Aggregations