Search in sources :

Example 36 with Tunnels

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels in project netvirt by opendaylight.

the class TunnelInterfaceStateListener method isTunnelInLogicalGroup.

private boolean isTunnelInLogicalGroup(StateTunnelList stateTunnelList) {
    String ifaceName = stateTunnelList.getTunnelInterfaceName();
    if (getTunnelType(stateTunnelList) == VpnConstants.ITMTunnelLocType.Internal.getValue()) {
        Interface configIface = InterfaceUtils.getInterface(dataBroker, stateTunnelList.getTunnelInterfaceName());
        IfTunnel ifTunnel = configIface != null ? configIface.getAugmentation(IfTunnel.class) : null;
        if (ifTunnel != null && ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
            ParentRefs refs = configIface.getAugmentation(ParentRefs.class);
            if (refs != null && !Strings.isNullOrEmpty(refs.getParentInterface())) {
                // multiple VxLAN tunnels enabled, i.e. only logical tunnel should be treated
                return true;
            }
        }
    }
    LOG.trace("isTunnelInLogicalGroup: MULTIPLE_VxLAN_TUNNELS: ignoring the tunnel event for {}", ifaceName);
    return false;
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) VpnInterface(org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface)

Example 37 with Tunnels

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels in project netvirt by opendaylight.

the class NatTunnelInterfaceStateListener method isTunnelInLogicalGroup.

protected boolean isTunnelInLogicalGroup(StateTunnelList stateTunnelList) {
    String ifaceName = stateTunnelList.getTunnelInterfaceName();
    if (getTunnelType(stateTunnelList) == NatConstants.ITMTunnelLocType.Internal.getValue()) {
        Interface configIface = interfaceManager.getInterfaceInfoFromConfigDataStore(ifaceName);
        IfTunnel ifTunnel = configIface != null ? configIface.getAugmentation(IfTunnel.class) : null;
        if (ifTunnel != null && ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
            ParentRefs refs = configIface.getAugmentation(ParentRefs.class);
            if (refs != null && !Strings.isNullOrEmpty(refs.getParentInterface())) {
                // multiple VxLAN tunnels enabled, i.e. only logical tunnel should be treated
                return true;
            }
        }
    }
    LOG.trace("isTunnelInLogicalGroup: ignoring the tunnel event for {}", ifaceName);
    return false;
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 38 with Tunnels

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels in project netvirt by opendaylight.

the class L2GatewayListener method removeL2Device.

private void removeL2Device(Devices l2Device, L2gateway input) {
    final String l2DeviceName = l2Device.getDeviceName();
    L2GatewayDevice l2GwDevice = l2GatewayCache.get(l2DeviceName);
    if (l2GwDevice != null) {
        // Also, do not delete device from cache if it's connected
        if (L2GatewayUtils.isLastL2GatewayBeingDeleted(l2GwDevice)) {
            if (l2GwDevice.isConnected()) {
                l2GwDevice.removeL2GatewayId(input.getUuid());
                // Delete ITM tunnels
                final String hwvtepId = l2GwDevice.getHwvtepNodeId();
                final Set<IpAddress> tunnelIps = l2GwDevice.getTunnelIps();
                jobCoordinator.enqueueJob(hwvtepId, () -> {
                    if (entityOwnershipUtils.isEntityOwner(HwvtepSouthboundConstants.ELAN_ENTITY_TYPE, HwvtepSouthboundConstants.ELAN_ENTITY_NAME)) {
                        LOG.info("Deleting ITM Tunnels for {} connected to cluster node owner", l2DeviceName);
                        for (IpAddress tunnelIp : tunnelIps) {
                            L2GatewayUtils.deleteItmTunnels(itmRpcService, hwvtepId, l2DeviceName, tunnelIp);
                        }
                    } else {
                        LOG.info("ITM Tunnels are not deleted on the cluster node as this is not owner for {}", l2DeviceName);
                    }
                    return null;
                });
            } else {
                l2GatewayCache.remove(l2DeviceName);
                // Cleaning up the config DS
                NodeId nodeId = new NodeId(l2GwDevice.getHwvtepNodeId());
                NodeId psNodeId = HwvtepSouthboundUtils.createManagedNodeId(nodeId, l2DeviceName);
                // FIXME: These should be removed
                MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, HwvtepSouthboundUtils.createInstanceIdentifier(nodeId));
                MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, HwvtepSouthboundUtils.createInstanceIdentifier(psNodeId));
            }
        } else {
            l2GwDevice.removeL2GatewayId(input.getUuid());
            LOG.trace("ITM tunnels are not deleted for {} as this device has other L2gateway associations", l2DeviceName);
        }
    } else {
        LOG.error("Unable to find L2 Gateway details for {}", l2DeviceName);
    }
}
Also used : NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)

Example 39 with Tunnels

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels in project netvirt by opendaylight.

the class L2GatewayUtils method deleteItmTunnels.

protected static void deleteItmTunnels(ItmRpcService itmRpcService, String hwvtepId, String psName, IpAddress tunnelIp) {
    DeleteL2GwDeviceInputBuilder builder = new DeleteL2GwDeviceInputBuilder();
    builder.setTopologyId(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID.getValue());
    builder.setNodeId(HwvtepSouthboundUtils.createManagedNodeId(new NodeId(hwvtepId), psName).getValue());
    builder.setIpAddress(tunnelIp);
    try {
        Future<RpcResult<Void>> result = itmRpcService.deleteL2GwDevice(builder.build());
        RpcResult<Void> rpcResult = result.get();
        if (rpcResult.isSuccessful()) {
            LOG.info("Deleted ITM tunnels for {}", hwvtepId);
        } else {
            LOG.error("Failed to delete ITM Tunnels: {}", rpcResult.getErrors());
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("RPC to delete ITM tunnels failed", e);
    }
}
Also used : DeleteL2GwDeviceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.DeleteL2GwDeviceInputBuilder) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ExecutionException(java.util.concurrent.ExecutionException)

Example 40 with Tunnels

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels in project netvirt by opendaylight.

the class UnderlayNetworkDpnListener method update.

@Override
protected void update(InstanceIdentifier<DpnToInterface> key, DpnToInterface origDpnToInterface, DpnToInterface updatedDpnToInterface) {
    String underlayNetwork = key.firstKeyOf(UnderlayNetwork.class).getNetworkName();
    BigInteger dpId = updatedDpnToInterface.getDpId();
    LOG.info("DPN {} updated to underlay network {} with tunnels {}", dpId, underlayNetwork, updatedDpnToInterface.getTunnelInterface());
    List<PolicyProfile> profiles = policyServiceUtil.getUnderlayNetworkPolicyProfiles(underlayNetwork);
    if (profiles == null || profiles.isEmpty()) {
        LOG.debug("No policy profiles found for underlay network {}", underlayNetwork);
        return;
    }
    List<TunnelInterface> origTunnelInterfaces = origDpnToInterface.getTunnelInterface();
    if (origTunnelInterfaces == null) {
        origTunnelInterfaces = Collections.emptyList();
    }
    List<TunnelInterface> updatedTunnelInterfaces = updatedDpnToInterface.getTunnelInterface();
    if (updatedTunnelInterfaces == null) {
        updatedTunnelInterfaces = Collections.emptyList();
    }
    List<TunnelInterface> removedTunnelInterfaces = new ArrayList<>(origTunnelInterfaces);
    removedTunnelInterfaces.removeAll(updatedTunnelInterfaces);
    List<TunnelInterface> addedTunnelInterfaces = new ArrayList<>(updatedTunnelInterfaces);
    addedTunnelInterfaces.removeAll(origTunnelInterfaces);
    populatePolicyGroupBucketsToDpn(underlayNetwork, profiles, removedTunnelInterfaces, dpId, NwConstants.DEL_FLOW);
    populatePolicyGroupsToDpn(profiles, addedTunnelInterfaces, dpId, NwConstants.ADD_FLOW);
    populatePolicyGroupBucketsToDpn(underlayNetwork, profiles, addedTunnelInterfaces, dpId, NwConstants.ADD_FLOW);
}
Also used : UnderlayNetwork(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.UnderlayNetwork) PolicyProfile(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.PolicyProfile) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) TunnelInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.dpn.to._interface.TunnelInterface)

Aggregations

ArrayList (java.util.ArrayList)14 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)9 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)8 TunnelsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey)8 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)8 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)7 BigInteger (java.math.BigInteger)7 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)7 ExecutionException (java.util.concurrent.ExecutionException)6 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)6 DPNTEPsInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)6 Tunnels (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels)6 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)6 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)6 ExternalTunnelList (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList)5 TunnelEndPoints (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints)5 ExternalTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel)5 TunnelsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsBuilder)5 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)4 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)4