Search in sources :

Example 6 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 setupEtreeRemoteDmacFlow.

private void setupEtreeRemoteDmacFlow(BigInteger srcDpId, BigInteger destDpId, long lportTagOrVni, long elanTag, String macAddress, String displayName, String interfaceName, WriteTransaction writeFlowGroupTx, ElanInstance elanInstance) {
    Flow flowEntity;
    EtreeInterface etreeInterface = elanInterfaceCache.getEtreeInterface(interfaceName).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.", interfaceName, elanTag);
        } else {
            flowEntity = buildRemoteDmacFlowEntry(srcDpId, destDpId, lportTagOrVni, etreeTagName.getEtreeLeafTag().getValue(), macAddress, displayName, elanInstance);
            mdsalManager.addFlowToTx(srcDpId, 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 7 with EtreeInterface

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

the class EtreeInterfaceAdd method doExecute.

@Override
protected Object doExecute() {
    EtreeInterfaceType inputType = null;
    for (EtreeInterfaceType type : EtreeInterfaceType.values()) {
        if (interfaceType.equals(type.getName())) {
            inputType = type;
            break;
        }
    }
    if (inputType == null) {
        session.getConsole().println("interfaceType must be one of: leaf/root, but was: " + interfaceType);
        return null;
    }
    ElanInstance elanInstance = elanProvider.getElanInstance(elanName);
    if (elanInstance == null) {
        session.getConsole().println("Etree instance " + elanName + " does not exist.");
        return null;
    } else {
        if (elanInstance.getAugmentation(EtreeInstance.class) == null) {
            session.getConsole().println("Etree instance " + elanName + " exists but isn't configured as Etree.");
            return null;
        }
    }
    LOG.debug("Executing create EtreeInterface command elanName:{}, interfaceName:{}, interfaceType:{}," + "staticMacAddresses:{}, elanInterfaceDescr:{}", elanName, interfaceName, interfaceType, staticMacAddresses, elanInterfaceDescr);
    elanProvider.addEtreeInterface(elanName, interfaceName, inputType, staticMacAddresses, elanInterfaceDescr);
    session.getConsole().println("Created etree interface successfully");
    return null;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) EtreeInterfaceType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface.EtreeInterfaceType) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)

Example 8 with EtreeInterface

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

the class EtreeInterfaceDelete method doExecute.

@Override
protected Object doExecute() {
    LOG.debug("Deleting EtreeInterface command etreeName:{}, interfaceName:{}", etreeName, interfaceName);
    ElanInterface existingInterface = elanProvider.getElanInterfaceByElanInterfaceName(interfaceName);
    if (existingInterface == null || existingInterface.getAugmentation(EtreeInterface.class) == null) {
        session.getConsole().println("Etree interface doesn't exist or isn't configured as etree: " + interfaceName);
    }
    elanProvider.deleteEtreeInterface(interfaceName);
    session.getConsole().println("Deleted the Etree interface succesfully");
    return null;
}
Also used : ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)

Example 9 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 displayInterfaces.

private void displayInterfaces(ElanInstance elanInstance, List<String> interfaceList) {
    if (!interfaceList.isEmpty()) {
        for (String elanInterface : interfaceList) {
            InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(elanInterface);
            EtreeInterface etreeInterface = elanProvider.getEtreeInterfaceByElanInterfaceName(elanInterface);
            if (interfaceInfo != null) {
                session.getConsole().println(String.format(ElanCLIUtils.ETREE_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName() + "/" + elanInstance.getElanTag(), elanInterface + "/" + interfaceInfo.getInterfaceTag(), interfaceInfo.getOpState(), interfaceInfo.getAdminState(), etreeInterface.getEtreeInterfaceType().getName()));
            }
        }
    }
}
Also used : InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface)

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