Search in sources :

Example 11 with ElanInterface

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

the class AclServiceTestBase method newElanInterface.

protected void newElanInterface(String elanName, String portName, boolean isWrite) throws TransactionCommitFailedException {
    ElanInterface elanInterface = new ElanInterfaceBuilder().setName(portName).setElanInstanceName(elanName).build();
    InstanceIdentifier<ElanInterface> id = AclServiceUtils.getElanInterfaceConfigurationDataPathId(portName);
    if (isWrite) {
        singleTransactionDataBroker.syncWrite(CONFIGURATION, id, elanInterface);
    } else {
        singleTransactionDataBroker.syncDelete(CONFIGURATION, id);
    }
}
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)

Example 12 with ElanInterface

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

the class TransportZoneNotificationUtil method shouldCreateVtep.

public boolean shouldCreateVtep(List<VpnInterfaces> vpnInterfaces) {
    if (vpnInterfaces == null || vpnInterfaces.isEmpty()) {
        return false;
    }
    for (VpnInterfaces vpnInterface : vpnInterfaces) {
        String interfaceName = vpnInterface.getInterfaceName();
        ElanInterface elanInt = elanService.getElanInterfaceByElanInterfaceName(interfaceName);
        if (elanInt == null) {
            continue;
        }
        if (ElanUtils.isVxlanNetworkOrVxlanSegment(elanInstanceCache.get(elanInt.getElanInstanceName()).orNull())) {
            return true;
        } else {
            LOG.debug("Non-VXLAN elanInstance: {}", elanInt.getElanInstanceName());
        }
    }
    return false;
}
Also used : VpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.vpn.to.dpn.list.VpnInterfaces) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)

Example 13 with ElanInterface

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

the class VpnUtil method isVlan.

public static boolean isVlan(DataBroker databroker, String interfaceName) {
    ElanInterface elanInterface = getElanInterfaceByElanInterfaceName(databroker, interfaceName);
    if (elanInterface == null) {
        return false;
    }
    ElanInstance elanInstance = getElanInstanceByName(databroker, elanInterface.getElanInstanceName());
    return isVlan(elanInstance);
}
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)

Example 14 with ElanInterface

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

the class ElanInterfaceGet method doExecute.

@Override
protected Object doExecute() {
    LOG.debug("Executing Get ElanInterface command for the corresponding Elan Instance for {}", elanName);
    if (elanName != null) {
        ElanInstance elanInstance = elanProvider.getElanInstance(elanName);
        List<String> elanInterfaces = elanProvider.getElanInterfaces(elanName);
        if (elanInterfaces == null) {
            session.getConsole().println("No Elan Interfaces present for ELan Instance:" + elanName);
            return null;
        }
        session.getConsole().println(getElanInterfaceHeaderOutput());
        displayInterfaces(elanInstance, elanInterfaces);
    } else {
        List<ElanInstance> elanInstances = elanProvider.getElanInstances();
        if (!elanInstances.isEmpty()) {
            session.getConsole().println(getElanInterfaceHeaderOutput());
            for (ElanInstance elanInstance : elanInstances) {
                List<String> elanInterfaces = elanProvider.getElanInterfaces(elanInstance.getElanInstanceName());
                displayInterfaces(elanInstance, elanInterfaces);
                session.getConsole().println("\n");
            }
        }
    }
    return null;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)

Example 15 with ElanInterface

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

the class NeutronvpnManager method removeExternalVpnInterfaces.

// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
protected void removeExternalVpnInterfaces(Uuid extNetId) {
    Collection<String> extElanInterfaces = elanService.getExternalElanInterfaces(extNetId.getValue());
    if (extElanInterfaces == null || extElanInterfaces.isEmpty()) {
        LOG.error("No external ports attached for external network {}", extNetId.getValue());
        return;
    }
    try {
        WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
        for (String elanInterface : extElanInterfaces) {
            InstanceIdentifier<VpnInterface> vpnIfIdentifier = NeutronvpnUtils.buildVpnInterfaceIdentifier(elanInterface);
            LOG.info("Removing vpn interface {}", elanInterface);
            wrtConfigTxn.delete(LogicalDatastoreType.CONFIGURATION, vpnIfIdentifier);
        }
        wrtConfigTxn.submit();
    } catch (Exception ex) {
        LOG.error("Removal of vpninterfaces {} failed", extElanInterfaces, ex);
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) VpnInterface(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface) TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) ExecutionException(java.util.concurrent.ExecutionException) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)

Aggregations

ElanInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)21 ArrayList (java.util.ArrayList)11 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)11 StaticMacEntries (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries)10 ElanInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder)9 ElanInterfaceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)8 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)7 BigInteger (java.math.BigInteger)6 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)6 Elan (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan)5 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)4 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)4 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)4 ElanDpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces)4 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)3 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)3 ElanException (org.opendaylight.netvirt.elan.ElanException)3 ElanInterfaceMac (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac)3 StaticMacEntriesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesBuilder)3 Optional (com.google.common.base.Optional)2