Search in sources :

Example 1 with ElanInterfaceKey

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

the class ElanServiceProvider method updateElanInterface.

@Override
public void updateElanInterface(String elanInstanceName, String interfaceName, List<String> updatedStaticMacAddresses, String newDescription) {
    Optional<ElanInterface> existingElanInterface = elanInterfaceCache.get(interfaceName);
    if (!existingElanInterface.isPresent()) {
        return;
    }
    List<StaticMacEntries> updatedStaticMacEntries = ElanUtils.getStaticMacEntries(updatedStaticMacAddresses);
    LOG.debug("updating the ElanInterface with new Mac Entries {}", updatedStaticMacAddresses);
    ElanInterface elanInterface = new ElanInterfaceBuilder().setElanInstanceName(elanInstanceName).setName(interfaceName).setDescription(newDescription).setStaticMacEntries(updatedStaticMacEntries).setKey(new ElanInterfaceKey(interfaceName)).build();
    MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanUtils.getElanInterfaceConfigurationDataPathId(interfaceName), elanInterface);
}
Also used : ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) 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) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)

Example 2 with ElanInterfaceKey

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

the class ElanServiceProvider method addElanInterface.

@Override
public void addElanInterface(String elanInstanceName, String interfaceName, List<String> staticMacAddresses, String description) {
    Optional<ElanInstance> existingElanInstance = elanInstanceCache.get(elanInstanceName);
    if (existingElanInstance.isPresent()) {
        ElanInterfaceBuilder elanInterfaceBuilder = new ElanInterfaceBuilder().setElanInstanceName(elanInstanceName).setDescription(description).setName(interfaceName).setKey(new ElanInterfaceKey(interfaceName));
        if (staticMacAddresses != null) {
            List<StaticMacEntries> staticMacEntries = ElanUtils.getStaticMacEntries(staticMacAddresses);
            elanInterfaceBuilder.setStaticMacEntries(staticMacEntries);
        }
        ElanInterface elanInterface = elanInterfaceBuilder.build();
        MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanUtils.getElanInterfaceConfigurationDataPathId(interfaceName), elanInterface);
        LOG.debug("Created the new ELan Interface {}", elanInterface);
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) 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) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)

Example 3 with ElanInterfaceKey

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

the class ElanServiceProvider method addEtreeInterface.

@Override
public void addEtreeInterface(String etreeInstanceName, String interfaceName, EtreeInterfaceType interfaceType, List<String> staticMacAddresses, String description) {
    Optional<ElanInstance> existingElanInstance = elanInstanceCache.get(etreeInstanceName);
    if (existingElanInstance.isPresent() && existingElanInstance.get().getAugmentation(EtreeInstance.class) != null) {
        EtreeInterface etreeInterface = new EtreeInterfaceBuilder().setEtreeInterfaceType(interfaceType).build();
        ElanInterface elanInterface;
        if (staticMacAddresses == null) {
            elanInterface = new ElanInterfaceBuilder().setElanInstanceName(etreeInstanceName).setDescription(description).setName(interfaceName).setKey(new ElanInterfaceKey(interfaceName)).addAugmentation(EtreeInterface.class, etreeInterface).build();
        } else {
            List<StaticMacEntries> staticMacEntries = ElanUtils.getStaticMacEntries(staticMacAddresses);
            elanInterface = new ElanInterfaceBuilder().setElanInstanceName(etreeInstanceName).setDescription(description).setName(interfaceName).setStaticMacEntries(staticMacEntries).setKey(new ElanInterfaceKey(interfaceName)).addAugmentation(EtreeInterface.class, etreeInterface).build();
        }
        MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanUtils.getElanInterfaceConfigurationDataPathId(interfaceName), elanInterface);
        LOG.debug("Creating the new Etree Interface {}", elanInterface);
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface) ElanInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder) EtreeInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterfaceBuilder) 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)

Example 4 with ElanInterfaceKey

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

the class DhcpAllocationPoolManager method getNetworkByPort.

public String getNetworkByPort(String portUuid) throws ReadFailedException {
    InstanceIdentifier<ElanInterface> elanInterfaceName = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface.class, new ElanInterfaceKey(portUuid)).build();
    Optional<ElanInterface> optionalElanInterface = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, elanInterfaceName);
    if (!optionalElanInterface.isPresent()) {
        LOG.info("No elan interface data for port {}", portUuid);
        return null;
    }
    ElanInterface elanInterface = optionalElanInterface.get();
    return elanInterface.getElanInstanceName();
}
Also used : ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)

Example 5 with ElanInterfaceKey

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

the class CoeUtils method createElanInterface.

public static void createElanInterface(String elanInterfaceName, String elanInstanceName, WriteTransaction wrtConfigTxn) {
    InstanceIdentifier<ElanInterface> id = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface.class, new ElanInterfaceKey(elanInterfaceName)).build();
    ElanInterface elanInterface = new ElanInterfaceBuilder().setElanInstanceName(elanInstanceName).setName(elanInterfaceName).setKey(new ElanInterfaceKey(elanInterfaceName)).build();
    wrtConfigTxn.put(LogicalDatastoreType.CONFIGURATION, id, elanInterface);
    LOG.debug("Creating new ELAN Interface {}", elanInterface);
}
Also used : ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ElanInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder) ElanInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)

Aggregations

ElanInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)8 ElanInterfaceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)8 ElanInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder)7 StaticMacEntries (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries)6 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)3 ArrayList (java.util.ArrayList)2 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)2 StaticMacEntriesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesBuilder)2 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)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