Search in sources :

Example 51 with Elan

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan in project netvirt by opendaylight.

the class ElanServiceChainHandler method programElanScfPipeline.

/**
 * Programs the needed flows for sending traffic to the SCF pipeline when
 * it is comming from an L2-GW (ELAN) and also for handing over that
 * traffic from SCF to ELAN when the packets does not match any Service
 * Chain.
 *
 * @param elanName Name of the ELAN to be considered
 * @param tableId Table id, in the SCF Pipeline, to which the traffic must
 *        go to.
 * @param scfTag Tag of the ServiceChain
 * @param elanLportTag LPortTag of the ElanPseudoPort that participates in
 *        the ServiceChain
 * @param addOrRemove States if the flows must be created or removed
 */
public void programElanScfPipeline(String elanName, short tableId, long scfTag, int elanLportTag, int addOrRemove) {
    LOG.info("programElanScfPipeline:  elanName={}   scfTag={}   elanLportTag={}    addOrRemove={}", elanName, scfTag, elanLportTag, addOrRemove);
    // There are 3 rules to be considered:
    // 1. LportDispatcher To Scf. Matches on elanPseudoPort + SI=1. Goes to DL Subscriber table
    // 2. LportDispatcher From Scf. Matches on elanPseudoPort + SI=3. Goes to ELAN DMAC
    // 3. ExtTunnelTable From L2GwDevice. Matches on VNI + SI=1. Sets ElanPseudoPort tag and goes
    // to LportDispatcher table.
    // And these rules must be programmed in all the Elan footprint
    // Find the ElanInstance
    Optional<ElanInstance> elanInstance = ElanServiceChainUtils.getElanInstanceByName(broker, elanName);
    if (!elanInstance.isPresent()) {
        LOG.debug("Could not find an Elan Instance with name={}", elanName);
        return;
    }
    Collection<BigInteger> elanDpnsOpc = ElanServiceChainUtils.getElanDpnsByName(broker, elanName);
    if (elanDpnsOpc.isEmpty()) {
        LOG.debug("Could not find any DPN related to Elan {}", elanName);
        return;
    }
    // updates map which stores relationship between elan and elanLPortTag and scfTag
    ElanServiceChainUtils.updateElanToLportTagMap(broker, elanName, elanLportTag, scfTag, addOrRemove);
    Long vni = elanInstance.get().getSegmentationId();
    if (vni == null) {
        LOG.warn("There is no VNI for elan {}. VNI is mandatory. Returning", elanName);
        return;
    }
    int elanTag = elanInstance.get().getElanTag().intValue();
    LOG.debug("elanName={}  ->  vni={}  elanTag={}", elanName, vni, elanTag);
    // Program ExtTunnelTable.
    for (BigInteger dpnId : elanDpnsOpc) {
        ElanServiceChainUtils.programLPortDispatcherToScf(mdsalManager, dpnId, elanTag, elanLportTag, tableId, scfTag, addOrRemove);
        ElanServiceChainUtils.programLPortDispatcherFromScf(mdsalManager, dpnId, elanLportTag, elanTag, addOrRemove);
        ElanServiceChainUtils.programExternalTunnelTable(mdsalManager, dpnId, elanLportTag, vni, elanTag, addOrRemove);
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) BigInteger(java.math.BigInteger)

Example 52 with Elan

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan in project netvirt by opendaylight.

the class ElanDpnInterfacesListener method add.

@Override
protected void add(InstanceIdentifier<DpnInterfaces> identifier, final DpnInterfaces dpnInterfaces) {
    final String elanName = getElanName(identifier);
    BigInteger addDpnId = dpnInterfaces.getDpId();
    LOG.debug("ELAN interfaces {} added on DPN {} for Elan {}", dpnInterfaces.getInterfaces(), addDpnId, elanName);
    Optional<ElanServiceChainState> elanServiceChainState = ElanServiceChainUtils.getElanServiceChainState(broker, elanName);
    if (elanServiceChainState.isPresent()) {
        List<ElanToPseudoPortData> elanToPseudoPortDataList = elanServiceChainState.get().getElanToPseudoPortData();
        for (ElanToPseudoPortData elanToPseudoPortData : elanToPseudoPortDataList) {
            Long scfTag = elanToPseudoPortData.getScfTag();
            Long elanLportTag = elanToPseudoPortData.getElanLportTag();
            if (elanLportTag != null && scfTag != null) {
                short tableId = NwConstants.SCF_DOWN_SUB_FILTER_TCP_BASED_TABLE;
                handleUpdate(addDpnId, elanName, tableId, elanLportTag.intValue(), /*21 bit*/
                scfTag, NwConstants.ADD_FLOW);
            } else {
                LOG.debug("Could not find lportTag for ELAN={}", elanName);
            }
        }
    }
}
Also used : BigInteger(java.math.BigInteger) ElanToPseudoPortData(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.elan.to.pseudo.port.data.list.ElanToPseudoPortData) ElanServiceChainState(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.cloud.servicechain.state.rev160711.ElanServiceChainState)

Example 53 with Elan

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan 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 54 with Elan

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan 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 55 with Elan

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

Aggregations

ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)52 BigInteger (java.math.BigInteger)36 ArrayList (java.util.ArrayList)31 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)18 DpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces)18 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)14 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)14 ElanInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)14 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)13 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)13 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)13 ElanDpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces)12 ElanDpnInterfacesList (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList)12 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)10 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)9 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)9 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)9 FlowId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId)9 Elan (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan)9 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)8