Search in sources :

Example 1 with Acquired

use of org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired in project netvirt by opendaylight.

the class ElanUtils method setupMacFlows.

/**
 * Setting SMAC, DMAC, UDMAC in this DPN and optionally in other DPNs.
 *
 * @param elanInfo
 *            the elan info
 * @param interfaceInfo
 *            the interface info
 * @param macTimeout
 *            the mac timeout
 * @param macAddress
 *            the mac address
 * @param configureRemoteFlows
 *            true if remote dmac flows should be configured as well
 * @param writeFlowGroupTx
 *            the flow group tx
 */
public void setupMacFlows(ElanInstance elanInfo, InterfaceInfo interfaceInfo, long macTimeout, String macAddress, boolean configureRemoteFlows, TypedWriteTransaction<Configuration> writeFlowGroupTx) {
    try (Acquired lock = lockElanMacDPN(elanInfo.getElanTag().toJava(), macAddress, interfaceInfo.getDpId())) {
        setupKnownSmacFlow(elanInfo, interfaceInfo, macTimeout, macAddress, mdsalManager, writeFlowGroupTx);
        setupOrigDmacFlows(elanInfo, interfaceInfo, macAddress, configureRemoteFlows, mdsalManager, writeFlowGroupTx);
    }
}
Also used : Acquired(org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired)

Example 2 with Acquired

use of org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired in project netvirt by opendaylight.

the class ElanEvpnFlowUtils method evpnDeleteDmacFlowsToExternalMac.

public List<ListenableFuture<?>> evpnDeleteDmacFlowsToExternalMac(EvpnDmacFlow evpnDmacFlow) {
    List<ListenableFuture<?>> futures = new ArrayList<>();
    try (Acquired lock = ElanUtils.lockElanMacDPN(evpnDmacFlow.getElanTag(), evpnDmacFlow.getDstMacAddress(), evpnDmacFlow.getDpId())) {
        futures.addAll(evpnRemoveFlowThatSendsThePacketOnAnExternalTunnel(evpnDmacFlow.getElanTag(), evpnDmacFlow.dpId, evpnDmacFlow.getNexthopIP(), evpnDmacFlow.getDstMacAddress()));
        futures.addAll(evpnDeleteEtreeDmacFlowsToExternalMac(evpnDmacFlow.getElanTag(), evpnDmacFlow.getDpId(), evpnDmacFlow.getNexthopIP(), evpnDmacFlow.getDstMacAddress()));
    }
    return futures;
}
Also used : Acquired(org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture)

Example 3 with Acquired

use of org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired in project netvirt by opendaylight.

the class ElanInterfaceManager method installDMacAddressTables.

// Install DMAC entry on dst DPN
public List<ListenableFuture<?>> installDMacAddressTables(ElanInstance elanInfo, InterfaceInfo interfaceInfo, Uint64 dstDpId) {
    String interfaceName = interfaceInfo.getInterfaceName();
    ElanInterfaceMac elanInterfaceMac = elanUtils.getElanInterfaceMacByInterfaceName(interfaceName);
    if (elanInterfaceMac != null && elanInterfaceMac.getMacEntry() != null) {
        Map<MacEntryKey, MacEntry> macEntries = elanInterfaceMac.nonnullMacEntry();
        return Collections.singletonList(ElanUtils.waitForTransactionToComplete(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
            for (MacEntry macEntry : macEntries.values()) {
                String macAddress = macEntry.getMacAddress().getValue();
                LOG.info("Installing remote dmac for mac address {} and interface {}", macAddress, interfaceName);
                try (Acquired lock = ElanUtils.lockElanMacDPN(elanInfo.getElanTag().toJava(), macAddress, interfaceInfo.getDpId())) {
                    LOG.info("Acquired lock for mac : {}, proceeding with remote dmac install operation", macAddress);
                    elanUtils.setupDMacFlowOnRemoteDpn(elanInfo, interfaceInfo, dstDpId, macAddress, tx);
                }
            }
        })));
    }
    return emptyList();
}
Also used : MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) Acquired(org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired) ElanInterfaceMac(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac) MacEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey)

Aggregations

Acquired (org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired)3 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 ArrayList (java.util.ArrayList)1 ElanInterfaceMac (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac)1 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)1 MacEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey)1