Search in sources :

Example 71 with ElanInstance

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

Example 72 with ElanInstance

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

the class ElanL2GatewayUtils method unInstallL2GwUcastMacFromElanDpns.

/**
 * Uninstall l2gw macs from other DPNs in the elan instance provided.
 * @param elan - Elan Instance for which other DPNs will be scanned.
 * @param l2GwDevice - l2gwDevice whose macs are required to be cleared from other devices.
 * @param macAddresses - Mac address to be cleared.
 */
public void unInstallL2GwUcastMacFromElanDpns(final ElanInstance elan, final L2GatewayDevice l2GwDevice, final Collection<MacAddress> macAddresses) {
    if (macAddresses == null || macAddresses.isEmpty()) {
        return;
    }
    if (elan == null || elan.getElanInstanceName() == null) {
        LOG.error("Could not delete l2gw ucast macs, Failed to find the elan for device {}", l2GwDevice.getHwvtepNodeId());
        return;
    }
    final Collection<DpnInterfaces> elanDpns = getElanDpns(elan.getElanInstanceName());
    // Retrieve all participating DPNs in this Elan. Populate this MAC in
    // DMAC table. Looping through all DPNs in order to add/remove mac flows
    // in their DMAC table
    List<ListenableFuture<Void>> result = new ArrayList<>();
    for (final MacAddress mac : macAddresses) {
        elanClusterUtils.runOnlyInOwnerNode(elan.getElanInstanceName() + ":" + mac.getValue(), "delete remote ucast macs in elan DPNs", () -> {
            for (DpnInterfaces elanDpn : elanDpns) {
                BigInteger dpnId = elanDpn.getDpId();
                result.addAll(elanDmacUtils.deleteDmacFlowsToExternalMac(elan.getElanTag(), dpnId, l2GwDevice.getHwvtepNodeId(), mac.getValue().toLowerCase(Locale.getDefault())));
            }
            return result;
        });
    }
}
Also used : DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) BigInteger(java.math.BigInteger) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)

Example 73 with ElanInstance

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

the class ElanL2GatewayUtils method getElanInstanceForUcastLocalMac.

public ElanInstance getElanInstanceForUcastLocalMac(LocalUcastMacs localUcastMac) {
    Optional<LogicalSwitches> lsOpc = ElanUtils.read(broker, LogicalDatastoreType.OPERATIONAL, (InstanceIdentifier<LogicalSwitches>) localUcastMac.getLogicalSwitchRef().getValue());
    if (lsOpc.isPresent()) {
        LogicalSwitches ls = lsOpc.get();
        // Logical switch name is Elan name
        String elanName = getElanFromLogicalSwitch(ls.getHwvtepNodeName().getValue());
        return elanInstanceCache.get(elanName).orNull();
    }
    return null;
}
Also used : LogicalSwitches(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches)

Example 74 with ElanInstance

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

the class L2GatewayConnectionUtils method addL2GatewayConnection.

public void addL2GatewayConnection(final L2gatewayConnection input, final String l2GwDeviceName, L2gateway l2Gateway) {
    LOG.info("Adding L2gateway Connection with ID: {}", input.getKey().getUuid());
    Uuid networkUuid = input.getNetworkId();
    // Taking cluster reboot scenario , if Elan instance is not available when l2GatewayConnection add events
    // comes we need to wait for elaninstance to resolve. Hence updating the map with the runnable .
    // When elanInstance add comes , it look in to the map and run the associated runnable associated with it.
    ElanInstance elanInstance = elanInstanceCache.get(networkUuid.getValue(), () -> addL2GatewayConnection(input, l2GwDeviceName)).orNull();
    if (elanInstance == null) {
        return;
    }
    if (!isVxlanNetworkOrVxlanSegment(elanInstance)) {
        LOG.error("Neutron network with id {} is not VxlanNetwork", networkUuid.getValue());
    } else {
        Uuid l2GatewayId = input.getL2gatewayId();
        if (l2Gateway == null) {
            l2Gateway = getNeutronL2gateway(broker, l2GatewayId);
        }
        if (l2Gateway == null) {
            LOG.error("L2Gateway with id {} is not present", l2GatewayId.getValue());
        } else {
            associateHwvtepsToElan(elanInstance, l2Gateway, input, l2GwDeviceName);
        }
    }
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)

Example 75 with ElanInstance

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

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