Search in sources :

Example 1 with EtreeInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface 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 2 with EtreeInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface in project netvirt by opendaylight.

the class ElanDmacUtils method buildEtreeDmacFlowForExternalRemoteMac.

private ListenableFuture<Void> buildEtreeDmacFlowForExternalRemoteMac(BigInteger dpnId, String extDeviceNodeId, Long vni, String macAddress, String displayName, String interfaceName, EtreeLeafTagName etreeLeafTag) {
    boolean isRoot;
    if (interfaceName == null) {
        isRoot = true;
    } else {
        Optional<EtreeInterface> etreeInterface = elanInterfaceCache.getEtreeInterface(interfaceName);
        isRoot = etreeInterface.isPresent() ? etreeInterface.get().getEtreeInterfaceType() == EtreeInterface.EtreeInterfaceType.Root : false;
    }
    if (isRoot) {
        Flow flow = buildDmacFlowForExternalRemoteMac(dpnId, extDeviceNodeId, etreeLeafTag.getEtreeLeafTag().getValue(), vni, macAddress, displayName);
        return ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flow, dpnId), flow);
    }
    return Futures.immediateFuture(null);
}
Also used : EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 3 with EtreeInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface in project netvirt by opendaylight.

the class ElanUtils method installEtreeLocalDmacFlow.

private void installEtreeLocalDmacFlow(long elanTag, BigInteger dpId, String ifName, String macAddress, ElanInstance elanInfo, long ifTag, WriteTransaction writeFlowGroupTx) {
    EtreeInterface etreeInterface = elanInterfaceCache.getEtreeInterface(ifName).orNull();
    if (etreeInterface != null && etreeInterface.getEtreeInterfaceType() == EtreeInterfaceType.Root) {
        EtreeLeafTagName etreeTagName = elanEtreeUtils.getEtreeLeafTagByElanTag(elanTag);
        if (etreeTagName == null) {
            LOG.warn("Interface {} seems like it belongs to Etree but etreeTagName from elanTag {} is null", ifName, elanTag);
        } else {
            Flow flowEntity = buildLocalDmacFlowEntry(etreeTagName.getEtreeLeafTag().getValue(), dpId, ifName, macAddress, elanInfo, ifTag);
            mdsalManager.addFlowToTx(dpId, flowEntity, writeFlowGroupTx);
        }
    }
}
Also used : EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface) EtreeLeafTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 4 with EtreeInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface in project netvirt by opendaylight.

the class EtreeInterfaceGet method doExecute.

@Override
protected Object doExecute() {
    LOG.debug("Executing Get EtreeInterface command for the corresponding Etree Instance {}", etreeName);
    if (etreeName != null) {
        ElanInstance elanInstance = elanProvider.getElanInstance(etreeName);
        if (elanInstance == null || elanInstance.getAugmentation(EtreeInstance.class) == null) {
            session.getConsole().println("Etree instance doesn't exist or isn't configured as etree: " + etreeName);
            return null;
        }
        List<String> elanInterfaces = elanProvider.getElanInterfaces(etreeName);
        if (elanInterfaces == null) {
            session.getConsole().println("No Etree Interfaces present for ELan Instance:" + etreeName);
            return null;
        }
        session.getConsole().println(getEtreeInterfaceHeaderOutput());
        displayInterfaces(elanInstance, elanInterfaces);
    } else {
        List<ElanInstance> elanInstances = elanProvider.getElanInstances();
        if (!elanInstances.isEmpty()) {
            session.getConsole().println(getEtreeInterfaceHeaderOutput());
            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 5 with EtreeInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface in project netvirt by opendaylight.

the class ElanDmacUtils method buildEtreeDmacFlowForExternalRemoteMacWithBatch.

private ListenableFuture<Void> buildEtreeDmacFlowForExternalRemoteMacWithBatch(BigInteger dpnId, String extDeviceNodeId, Long vni, String macAddress, String displayName, String interfaceName, EtreeLeafTagName etreeLeafTag) {
    boolean isRoot;
    if (interfaceName == null) {
        isRoot = true;
    } else {
        Optional<EtreeInterface> etreeInterface = elanInterfaceCache.getEtreeInterface(interfaceName);
        isRoot = etreeInterface.isPresent() ? etreeInterface.get().getEtreeInterfaceType() == EtreeInterface.EtreeInterfaceType.Root : false;
    }
    if (isRoot) {
        Flow flow = buildDmacFlowForExternalRemoteMac(dpnId, extDeviceNodeId, etreeLeafTag.getEtreeLeafTag().getValue(), vni, macAddress, displayName);
        return ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flow, dpnId), flow);
    }
    return Futures.immediateFuture(null);
}
Also used : EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Aggregations

EtreeInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface)6 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)4 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)3 EtreeLeafTagName (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName)2 ElanInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)2 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)1 EtreeInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)1 EtreeInterfaceType (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface.EtreeInterfaceType)1 EtreeInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterfaceBuilder)1 ElanInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceBuilder)1 ElanInterfaceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterfaceKey)1 StaticMacEntries (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries)1