Search in sources :

Example 61 with ElanInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.

the class CoeUtils method createElanInstanceForTheFirstPodInTheNetwork.

public static ElanInstance createElanInstanceForTheFirstPodInTheNetwork(String networkNS, String nodeIp, org.opendaylight.yang.gen.v1.urn.opendaylight.coe.northbound.pod.rev170611.pod_attributes.Interface podInterface, ReadWriteTransaction wrtConfigTxn) throws ReadFailedException {
    String elanInstanceName = buildElanInstanceName(nodeIp, networkNS);
    InstanceIdentifier<ElanInstance> id = createElanInstanceIdentifier(elanInstanceName);
    ElanInstance existingElanInstance = wrtConfigTxn.read(LogicalDatastoreType.CONFIGURATION, id).checkedGet().orNull();
    if (existingElanInstance != null) {
        return existingElanInstance;
    }
    Class<? extends SegmentTypeBase> segmentType = getSegmentTypeFromNetwork(podInterface);
    String segmentationId = String.valueOf(podInterface.getSegmentationId());
    // FIXME String physicalNetworkName = ??
    // TODO external network support not added currently
    Boolean isExternal = false;
    ElanInstance elanInstance = CoeUtils.buildElanInstance(elanInstanceName, segmentType, segmentationId, isExternal);
    wrtConfigTxn.put(LogicalDatastoreType.CONFIGURATION, id, elanInstance);
    LOG.info("ELAN instance created for the first pod in the network {}", podInterface.getUid());
    return elanInstance;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)

Example 62 with ElanInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.

the class EtreeGet method doExecute.

@Override
protected Object doExecute() {
    LOG.debug("Executing Get EtreeInstance command for {}", etreeName);
    if (etreeName != null) {
        ElanInstance elanInstance = elanProvider.getElanInstance(etreeName);
        if (elanInstance == null || elanInstance.getAugmentation(EtreeInstance.class) == null) {
            session.getConsole().println("No Etree Instance present with name:" + etreeName);
        } else {
            session.getConsole().println(getEtreeHeaderOutput());
            session.getConsole().println(String.format(ElanCLIUtils.ETREE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getDescription()));
        }
    } else {
        List<ElanInstance> elanInstanceList = elanProvider.getElanInstances();
        if (elanInstanceList != null && !elanInstanceList.isEmpty()) {
            session.getConsole().println(getEtreeHeaderOutput());
            for (ElanInstance elanInstance : elanInstanceList) {
                if (elanInstance.getAugmentation(EtreeInstance.class) != null) {
                    session.getConsole().println(String.format(ElanCLIUtils.ETREE_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getAugmentation(EtreeInstance.class).getEtreeLeafTagVal().getValue(), elanInstance.getDescription()));
                }
            }
        } else {
            session.getConsole().println("No Etree Instances are present");
        }
    }
    return null;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)

Example 63 with ElanInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance 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 64 with ElanInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.

the class ElanGet method doExecute.

@Override
protected Object doExecute() {
    LOG.debug("Executing Get ElanInstance command for elanName: {}", elanName);
    if (elanName != null) {
        ElanInstance elanInstance = elanProvider.getElanInstance(elanName);
        if (elanInstance == null) {
            session.getConsole().println("No Elan Instance present with name:" + elanName);
        } else {
            session.getConsole().println(getElanHeaderOutput());
            session.getConsole().println(String.format(ElanCLIUtils.ELAN_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getDescription()));
        }
    } else {
        List<ElanInstance> elanInstanceList = elanProvider.getElanInstances();
        if (elanInstanceList != null && !elanInstanceList.isEmpty()) {
            session.getConsole().println(getElanHeaderOutput());
            for (ElanInstance elanInstance : elanInstanceList) {
                session.getConsole().println(String.format(ElanCLIUtils.ELAN_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getDescription()));
            }
        } else {
            session.getConsole().println("No Elan Instances are present");
        }
    }
    return null;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)

Example 65 with ElanInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance 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)

Aggregations

ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)75 BigInteger (java.math.BigInteger)36 ArrayList (java.util.ArrayList)33 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)18 DpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces)16 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)14 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)14 ElanInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)13 ElanDpnInterfacesList (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList)12 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)11 EtreeInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)11 ElanDpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces)11 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)10 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)10 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)10 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)10 ElanInstanceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)10 ElanInstanceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey)10 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)9 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)9