Search in sources :

Example 6 with StaticMacEntries

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries in project netvirt by opendaylight.

the class ElanForwardingEntriesHandler method addElanInterfaceForwardingTableList.

public void addElanInterfaceForwardingTableList(String elanInstanceName, String interfaceName, StaticMacEntries staticMacEntries, WriteTransaction tx) {
    MacEntry macEntry = new MacEntryBuilder().setIsStaticAddress(true).setMacAddress(staticMacEntries.getMacAddress()).setIpPrefix(staticMacEntries.getIpPrefix()).setInterface(interfaceName).setKey(new MacEntryKey(staticMacEntries.getMacAddress())).build();
    createElanForwardingTablesList(elanInstanceName, macEntry, tx);
    createElanInterfaceForwardingTablesList(interfaceName, macEntry, tx);
}
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 7 with StaticMacEntries

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries in project netvirt by opendaylight.

the class ElanUtils method getStaticMacEntries.

public static List<StaticMacEntries> getStaticMacEntries(List<String> staticMacAddresses) {
    if (isEmpty(staticMacAddresses)) {
        return Collections.EMPTY_LIST;
    }
    StaticMacEntriesBuilder staticMacEntriesBuilder = new StaticMacEntriesBuilder();
    List<StaticMacEntries> staticMacEntries = new ArrayList<>();
    List<PhysAddress> physAddressList = getPhysAddress(staticMacAddresses);
    for (PhysAddress physAddress : physAddressList) {
        staticMacEntries.add(staticMacEntriesBuilder.setMacAddress(physAddress).build());
    }
    return staticMacEntries;
}
Also used : StaticMacEntriesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesBuilder) ArrayList(java.util.ArrayList) StaticMacEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Example 8 with StaticMacEntries

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries in project netvirt by opendaylight.

the class ElanServiceProvider method addStaticMacAddress.

@Override
public void addStaticMacAddress(String interfaceName, String macAddress) {
    Optional<ElanInterface> existingElanInterface = elanInterfaceCache.get(interfaceName);
    if (existingElanInterface.isPresent()) {
        StaticMacEntriesBuilder staticMacEntriesBuilder = new StaticMacEntriesBuilder();
        StaticMacEntries staticMacEntry = staticMacEntriesBuilder.setMacAddress(new PhysAddress(macAddress)).build();
        InstanceIdentifier<StaticMacEntries> staticMacEntriesIdentifier = ElanUtils.getStaticMacEntriesCfgDataPathIdentifier(interfaceName, macAddress);
        MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, staticMacEntriesIdentifier, staticMacEntry);
    }
}
Also used : StaticMacEntriesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesBuilder) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) StaticMacEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Example 9 with StaticMacEntries

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries in project netvirt by opendaylight.

the class CoeUtils method updateElanInterfaceWithStaticMac.

public static void updateElanInterfaceWithStaticMac(String macAddress, IpAddress ipAddress, String elanInterfaceName, WriteTransaction wrtConfigTxn) {
    InstanceIdentifier<ElanInterface> id = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface.class, new ElanInterfaceKey(elanInterfaceName)).build();
    PhysAddress physAddress = PhysAddress.getDefaultInstance(macAddress);
    List<StaticMacEntries> staticMacEntriesList = new ArrayList<>();
    StaticMacEntries staticMacEntries = new StaticMacEntriesBuilder().setKey(new StaticMacEntriesKey(physAddress)).setMacAddress(physAddress).setIpPrefix(ipAddress).build();
    staticMacEntriesList.add(staticMacEntries);
    ElanInterface elanInterface = new ElanInterfaceBuilder().setName(elanInterfaceName).setKey(new ElanInterfaceKey(elanInterfaceName)).setStaticMacEntries(staticMacEntriesList).build();
    wrtConfigTxn.merge(LogicalDatastoreType.CONFIGURATION, id, elanInterface);
    LOG.debug("Updating ELAN Interface with static mac {}", elanInterface);
}
Also used : StaticMacEntriesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesBuilder) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ArrayList(java.util.ArrayList) ElanInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder) StaticMacEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries) StaticMacEntriesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesKey) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Example 10 with StaticMacEntries

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries in project netvirt by opendaylight.

the class ElanServiceTestBase method addElanInterface.

public void addElanInterface(String elanInstanceName, InterfaceInfo interfaceInfo, String prefix) {
    ElanInstance existingElanInstance = elanInstanceCache.get(elanInstanceName).orNull();
    String interfaceName = interfaceInfo.getInterfaceName();
    if (existingElanInstance != null) {
        ElanInterfaceBuilder elanInterfaceBuilder = new ElanInterfaceBuilder().setElanInstanceName(elanInstanceName).setName(interfaceName).setKey(new ElanInterfaceKey(interfaceName));
        StaticMacEntriesBuilder staticMacEntriesBuilder = new StaticMacEntriesBuilder();
        List<StaticMacEntries> staticMacEntries = new ArrayList<>();
        List<PhysAddress> physAddressList = Collections.singletonList(new PhysAddress(interfaceInfo.getMacAddress()));
        for (PhysAddress physAddress : physAddressList) {
            staticMacEntries.add(staticMacEntriesBuilder.setMacAddress(physAddress).setIpPrefix(new IpAddress(new Ipv4Address(prefix))).build());
        }
        elanInterfaceBuilder.setStaticMacEntries(staticMacEntries);
        ElanInterface elanInterface = elanInterfaceBuilder.build();
        MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, ElanUtils.getElanInterfaceConfigurationDataPathId(interfaceName), elanInterface);
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) StaticMacEntriesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesBuilder) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ArrayList(java.util.ArrayList) StaticMacEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) ElanInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Aggregations

StaticMacEntries (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries)11 ElanInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)7 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)6 ElanInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder)6 ElanInterfaceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)6 ArrayList (java.util.ArrayList)5 StaticMacEntriesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesBuilder)5 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)3 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)3 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)2 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 BigInteger (java.math.BigInteger)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 EtreeInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface)1 EtreeInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterfaceBuilder)1 StaticMacEntriesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesKey)1 MacEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryBuilder)1 MacEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey)1