Search in sources :

Example 61 with Elan

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

the class ElanL2GatewayMulticastUtils method handleMcastForElanL2GwDeviceDelete.

/**
 * Handle mcast for elan l2 gw device delete.
 *
 * @param elanName
 *            the elan instance name
 * @param l2GatewayDevice
 *            the l2 gateway device
 * @return the listenable future
 */
public List<ListenableFuture<Void>> handleMcastForElanL2GwDeviceDelete(String elanName, L2GatewayDevice l2GatewayDevice) {
    ListenableFuture<Void> deleteTepFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
        tx.delete(LogicalDatastoreType.CONFIGURATION, buildExternalTepPath(elanName, l2GatewayDevice.getTunnelIp()));
    });
    ListenableFuture<Void> updateMcastMacsFuture = updateMcastMacsForAllElanDevices(elanName, l2GatewayDevice, false);
    ListenableFuture<Void> deleteRemoteMcastMacFuture = deleteRemoteMcastMac(new NodeId(l2GatewayDevice.getHwvtepNodeId()), elanName);
    return Arrays.asList(updateMcastMacsFuture, deleteRemoteMcastMacFuture, deleteTepFuture);
}
Also used : NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)

Example 62 with Elan

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

the class ElanL2GatewayMulticastUtils method getRemoteBCGroupBucketsOfElanExternalTeps.

public List<Bucket> getRemoteBCGroupBucketsOfElanExternalTeps(ElanInstance elanInfo, BigInteger dpnId, int bucketId) {
    ElanInstance operElanInstance = null;
    try {
        operElanInstance = new SingleTransactionDataBroker(broker).syncReadOptional(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, elanInfo.getKey()).build()).orNull();
    } catch (ReadFailedException e) {
        LOG.error("Failed to read elan instance operational path {}", elanInfo, e);
        return emptyList();
    }
    if (operElanInstance == null) {
        return emptyList();
    }
    List<ExternalTeps> teps = operElanInstance.getExternalTeps();
    if (teps == null || teps.isEmpty()) {
        return emptyList();
    }
    List<Bucket> listBucketInfo = new ArrayList<>();
    for (ExternalTeps tep : teps) {
        String externalTep = tep.getNodeid() != null ? tep.getNodeid() : tep.getTepIp().toString();
        String interfaceName = elanItmUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId), externalTep);
        if (interfaceName == null) {
            LOG.error("Could not get interface name to ext tunnel {} {}", dpnId, tep.getTepIp());
            continue;
        }
        List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName, elanUtils.getVxlanSegmentationId(elanInfo));
        listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
        bucketId++;
    }
    return listBucketInfo;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ExternalTeps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ArrayList(java.util.ArrayList) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) ElanInstances(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances)

Example 63 with Elan

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

the class ElanL2GatewayUtils method getOtherDevicesMacs.

/**
 * Gets the l2 gateway devices ucast local macs as remote ucast macs.
 *
 * @param elanName
 *            the elan name
 * @param l2GatewayDeviceToBeConfigured
 *            the l2 gateway device to be configured
 * @param hwVtepNodeId
 *            the hw vtep node Id to be configured
 * @param logicalSwitchName
 *            the logical switch name
 * @return the l2 gateway devices macs as remote ucast macs
 */
public static List<RemoteUcastMacs> getOtherDevicesMacs(String elanName, L2GatewayDevice l2GatewayDeviceToBeConfigured, NodeId hwVtepNodeId, String logicalSwitchName) {
    List<RemoteUcastMacs> lstRemoteUcastMacs = new ArrayList<>();
    ConcurrentMap<String, L2GatewayDevice> elanL2GwDevicesFromCache = ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanName);
    if (elanL2GwDevicesFromCache != null) {
        for (L2GatewayDevice otherDevice : elanL2GwDevicesFromCache.values()) {
            if (l2GatewayDeviceToBeConfigured.getHwvtepNodeId().equals(otherDevice.getHwvtepNodeId())) {
                continue;
            }
            if (!areMLAGDevices(l2GatewayDeviceToBeConfigured, otherDevice)) {
                for (LocalUcastMacs localUcastMac : otherDevice.getUcastLocalMacs()) {
                    HwvtepPhysicalLocatorAugmentation physLocatorAug = HwvtepSouthboundUtils.createHwvtepPhysicalLocatorAugmentation(String.valueOf(otherDevice.getTunnelIp().getValue()));
                    RemoteUcastMacs remoteUcastMac = HwvtepSouthboundUtils.createRemoteUcastMac(hwVtepNodeId, localUcastMac.getMacEntryKey().getValue().toLowerCase(Locale.getDefault()), localUcastMac.getIpaddr(), logicalSwitchName, physLocatorAug);
                    lstRemoteUcastMacs.add(remoteUcastMac);
                }
            }
        }
    }
    return lstRemoteUcastMacs;
}
Also used : LocalUcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs) RemoteUcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs) HwvtepPhysicalLocatorAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation) ArrayList(java.util.ArrayList) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)

Example 64 with Elan

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

the class ElanL2GatewayUtils method deleteElanL2GwDevicesUcastLocalMacsFromDpn.

/**
 * Delete elan l2 gateway devices ucast local macs from dpn.
 *
 * @param elanName
 *            the elan name
 * @param dpnId
 *            the dpn id
 */
public void deleteElanL2GwDevicesUcastLocalMacsFromDpn(final String elanName, final BigInteger dpnId) {
    ConcurrentMap<String, L2GatewayDevice> elanL2GwDevices = ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanName);
    if (elanL2GwDevices == null || elanL2GwDevices.isEmpty()) {
        LOG.trace("No L2 gateway devices in Elan [{}] cache.", elanName);
        return;
    }
    final ElanInstance elan = elanInstanceCache.get(elanName).orNull();
    if (elan == null) {
        LOG.error("Could not find Elan by name: {}", elanName);
        return;
    }
    LOG.info("Deleting Elan [{}] L2GatewayDevices UcastLocalMacs from Dpn [{}]", elanName, dpnId);
    final Long elanTag = elan.getElanTag();
    for (final L2GatewayDevice l2GwDevice : elanL2GwDevices.values()) {
        getL2GwDeviceLocalMacsAndRunCallback(elan.getElanInstanceName(), l2GwDevice, (localMacs) -> {
            for (MacAddress mac : localMacs) {
                String jobKey = elanName + ":" + mac.getValue();
                elanClusterUtils.runOnlyInOwnerNode(jobKey, () -> elanDmacUtils.deleteDmacFlowsToExternalMac(elanTag, dpnId, l2GwDevice.getHwvtepNodeId(), mac.getValue()));
            }
            return null;
        });
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)

Example 65 with Elan

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

the class ElanL2GatewayUtils method deleteL2GwDeviceUcastLocalMacsFromElan.

/**
 * Delete l2 gateway device ucast local macs from elan.<br>
 * Deletes macs from internal ELAN nodes and also on rest of external l2
 * gateway devices which are part of the ELAN.
 *
 * @param l2GatewayDevice
 *            the l2 gateway device whose ucast local macs to be deleted
 *            from elan
 * @param elanName
 *            the elan name
 */
public void deleteL2GwDeviceUcastLocalMacsFromElan(L2GatewayDevice l2GatewayDevice, String elanName) {
    LOG.info("Deleting L2GatewayDevice [{}] UcastLocalMacs from elan [{}]", l2GatewayDevice.getHwvtepNodeId(), elanName);
    ElanInstance elan = elanInstanceCache.get(elanName).orNull();
    if (elan == null) {
        LOG.error("Could not find Elan by name: {}", elanName);
        return;
    }
    Collection<MacAddress> localMacs = getL2GwDeviceLocalMacs(elanName, l2GatewayDevice);
    unInstallL2GwUcastMacFromL2gwDevices(elanName, l2GatewayDevice, localMacs);
    unInstallL2GwUcastMacFromElanDpns(elan, l2GatewayDevice, localMacs);
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)

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