Search in sources :

Example 91 with Mac

use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.

the class ElanDmacUtils method installDmacFlowsToExternalRemoteMac.

/**
 * Installs a Flow in the specified DPN's DMAC table. The flow is for a MAC
 * that is connected remotely in an External Device (TOR) and that is
 * accessible through an external tunnel. It also installs the flow for
 * dropping the packet if it came over an ITM tunnel (that is, if the
 * Split-Horizon flag is set)
 *
 * @param dpnId
 *            Id of the DPN where the flow must be installed
 * @param extDeviceNodeId
 *            the ext device node id
 * @param elanTag
 *            the elan tag
 * @param vni
 *            the vni
 * @param macAddress
 *            the mac address
 * @param displayName
 *            the display name
 * @param interfaceName
 *            the interface name
 *
 * @return the dmac flows
 * @throws ElanException in case of issues creating the flow objects
 */
public List<ListenableFuture<Void>> installDmacFlowsToExternalRemoteMac(BigInteger dpnId, String extDeviceNodeId, Long elanTag, Long vni, String macAddress, String displayName, String interfaceName) throws ElanException {
    synchronized (ElanUtils.getElanMacDPNKey(elanTag, macAddress, dpnId)) {
        Flow flow = buildDmacFlowForExternalRemoteMac(dpnId, extDeviceNodeId, elanTag, vni, macAddress, displayName);
        ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flow, dpnId), flow);
        Flow dropFlow = buildDmacFlowDropIfPacketComingFromTunnel(dpnId, extDeviceNodeId, elanTag, macAddress);
        ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(dropFlow, dpnId), dropFlow);
        installEtreeDmacFlowsToExternalRemoteMac(dpnId, extDeviceNodeId, elanTag, vni, macAddress, displayName, interfaceName);
    }
    return Collections.emptyList();
}
Also used : Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 92 with Mac

use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.

the class ElanForwardingEntriesHandler method createElanInterfaceForwardingTablesList.

public void createElanInterfaceForwardingTablesList(String interfaceName, MacEntry mac, WriteTransaction tx) {
    InstanceIdentifier<MacEntry> existingMacEntryId = ElanUtils.getInterfaceMacEntriesIdentifierOperationalDataPath(interfaceName, mac.getMacAddress());
    MacEntry existingInterfaceMacEntry = elanUtils.getInterfaceMacEntriesOperationalDataPathFromId(existingMacEntryId);
    if (existingInterfaceMacEntry == null) {
        MacEntry macEntry = new MacEntryBuilder().setMacAddress(mac.getMacAddress()).setIpPrefix(mac.getIpPrefix()).setInterface(interfaceName).setIsStaticAddress(true).setKey(new MacEntryKey(mac.getMacAddress())).build();
        tx.put(LogicalDatastoreType.OPERATIONAL, existingMacEntryId, macEntry, WriteTransaction.CREATE_MISSING_PARENTS);
    }
}
Also used : MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) MacEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryBuilder) MacEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey)

Example 93 with Mac

use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.

the class ElanForwardingEntriesHandler method deleteElanInterfaceForwardingTablesList.

public void deleteElanInterfaceForwardingTablesList(String interfaceName, MacEntry mac, WriteTransaction tx) {
    InstanceIdentifier<MacEntry> existingMacEntryId = ElanUtils.getInterfaceMacEntriesIdentifierOperationalDataPath(interfaceName, mac.getMacAddress());
    MacEntry existingInterfaceMacEntry = elanUtils.getInterfaceMacEntriesOperationalDataPathFromId(existingMacEntryId);
    if (existingInterfaceMacEntry != null) {
        tx.delete(LogicalDatastoreType.OPERATIONAL, existingMacEntryId);
    }
}
Also used : MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)

Example 94 with Mac

use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.

the class ElanForwardingEntriesHandler method updateElanForwardingTablesList.

public void updateElanForwardingTablesList(String elanName, String interfaceName, MacEntry mac, WriteTransaction tx) {
    InstanceIdentifier<MacEntry> macEntryId = ElanUtils.getMacEntryOperationalDataPath(elanName, mac.getMacAddress());
    MacEntry existingMacEntry = elanUtils.getMacEntryFromElanMacId(macEntryId);
    if (existingMacEntry != null && elanUtils.getElanMacTable(elanName) != null) {
        MacEntry newMacEntry = new MacEntryBuilder().setInterface(interfaceName).setIsStaticAddress(true).setMacAddress(mac.getMacAddress()).setIpPrefix(mac.getIpPrefix()).setKey(new MacEntryKey(mac.getMacAddress())).build();
        tx.put(LogicalDatastoreType.OPERATIONAL, macEntryId, newMacEntry);
    }
}
Also used : MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) MacEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryBuilder) MacEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey)

Example 95 with Mac

use of org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sl.rev140701.Mac in project netvirt by opendaylight.

the class ElanUtils method setupOrigDmacFlows.

private void setupOrigDmacFlows(ElanInstance elanInfo, InterfaceInfo interfaceInfo, String macAddress, boolean configureRemoteFlows, IMdsalApiManager mdsalApiManager, WriteTransaction writeFlowGroupTx) throws ElanException {
    BigInteger dpId = interfaceInfo.getDpId();
    String ifName = interfaceInfo.getInterfaceName();
    long ifTag = interfaceInfo.getInterfaceTag();
    String elanInstanceName = elanInfo.getElanInstanceName();
    Long elanTag = elanInfo.getElanTag();
    setupLocalDmacFlow(elanTag, dpId, ifName, macAddress, elanInfo, mdsalApiManager, ifTag, writeFlowGroupTx);
    LOG.debug("Dmac flow entry created for elan Name:{}, logical port Name:{} mand mac address:{} " + "on dpn:{}", elanInstanceName, interfaceInfo.getPortName(), macAddress, dpId);
    if (!configureRemoteFlows) {
        return;
    }
    List<DpnInterfaces> elanDpns = getInvolvedDpnsInElan(elanInstanceName);
    for (DpnInterfaces elanDpn : elanDpns) {
        if (elanDpn.getDpId().equals(dpId)) {
            continue;
        }
        // Check for the Remote DPN present in Inventory Manager
        if (!isDpnPresent(elanDpn.getDpId())) {
            continue;
        }
        // For remote DPNs a flow is needed to indicate that packets of this ELAN going to this MAC need to be
        // forwarded through the appropriate ITM tunnel
        setupRemoteDmacFlow(// srcDpn (the remote DPN in this case)
        elanDpn.getDpId(), // dstDpn (the local DPN)
        dpId, // lportTag of the local interface
        interfaceInfo.getInterfaceTag(), // identifier of the Elan
        elanTag, // MAC to be programmed in remote DPN
        macAddress, elanInstanceName, writeFlowGroupTx, ifName, elanInfo);
        LOG.debug("Remote Dmac flow entry created for elan Name:{}, logical port Name:{} and mac address:{} on" + " dpn:{}", elanInstanceName, interfaceInfo.getPortName(), macAddress, elanDpn.getDpId());
    }
// TODO: Make sure that the same is performed against the ElanDevices.
}
Also used : DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) BigInteger(java.math.BigInteger)

Aggregations

ArrayList (java.util.ArrayList)57 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)50 BigInteger (java.math.BigInteger)36 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)34 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)21 Test (org.junit.Test)20 PhysAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)19 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)18 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)18 Collections (java.util.Collections)17 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)17 List (java.util.List)16 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)16 Logger (org.slf4j.Logger)16 LoggerFactory (org.slf4j.LoggerFactory)16 ExecutionException (java.util.concurrent.ExecutionException)15 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)15 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)15 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)15 Inject (javax.inject.Inject)14