Search in sources :

Example 16 with MacEntry

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);
    }
}
Also used : MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) MacEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryBuilder) MacEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey)

Example 17 with MacEntry

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);
    }
}
Also used : MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)

Example 18 with MacEntry

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);
    }
}
Also used : MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) MacEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryBuilder) MacEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey)

Example 19 with MacEntry

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;
}
Also used : MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) ArrayList(java.util.ArrayList) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress) ElanInterfaceMac(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac)

Example 20 with MacEntry

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;
}
Also used : Elan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan) MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) ArrayList(java.util.ArrayList) ElanInterfaceMac(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac)

Aggregations

MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)22 ElanInterfaceMac (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac)10 BigInteger (java.math.BigInteger)9 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)8 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)8 MacEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryBuilder)8 MacEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey)8 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)7 ArrayList (java.util.ArrayList)6 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)6 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)6 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)4 Optional (com.google.common.base.Optional)3 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)3 Collections (java.util.Collections)3 Inject (javax.inject.Inject)3 Singleton (javax.inject.Singleton)3 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)3 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)3 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)3