Search in sources :

Example 86 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device in project netvirt by opendaylight.

the class L2GatewayConnectionListener method addL2DeviceToCache.

void addL2DeviceToCache(InstanceIdentifier<Node> psIid, Node globalNode, Node psNode) {
    LOG.trace("Adding device to cache {}", psNode.getNodeId().getValue());
    String deviceName = HwvtepHAUtil.getPsName(psIid);
    L2GatewayDevice l2GwDevice = l2GatewayCache.addOrGet(deviceName);
    l2GwDevice.setConnected(true);
    l2GwDevice.setHwvtepNodeId(globalNode.getNodeId().getValue());
    List<TunnelIps> tunnelIps = psNode.getAugmentation(PhysicalSwitchAugmentation.class) != null ? psNode.getAugmentation(PhysicalSwitchAugmentation.class).getTunnelIps() : null;
    if (tunnelIps != null) {
        for (TunnelIps tunnelIp : tunnelIps) {
            IpAddress tunnelIpAddr = tunnelIp.getTunnelIpsKey();
            l2GwDevice.addTunnelIp(tunnelIpAddr);
        }
    }
}
Also used : TunnelIps(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps) 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 87 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device in project netvirt by opendaylight.

the class DhcpExternalTunnelManager method putRemoteMcastMac.

private WriteTransaction putRemoteMcastMac(WriteTransaction transaction, String elanName, L2GatewayDevice device, IpAddress internalTunnelIp) {
    Optional<Node> optionalNode = getNode(broker, device.getHwvtepNodeId());
    Node dstNode = optionalNode.get();
    if (dstNode == null) {
        LOG.trace("could not get device node {} ", device.getHwvtepNodeId());
        return null;
    }
    RemoteMcastMacs macs = createRemoteMcastMac(dstNode, elanName, internalTunnelIp);
    HwvtepUtils.putRemoteMcastMac(transaction, dstNode.getNodeId(), macs);
    return transaction;
}
Also used : RemoteMcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)

Example 88 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device in project netvirt by opendaylight.

the class DhcpExternalTunnelManager method configureDhcpArpRequestResponseFlow.

public void configureDhcpArpRequestResponseFlow(BigInteger dpnId, String elanInstanceName, boolean addFlow, IpAddress tunnelIp, String dhcpIpAddress, String dhcpMacAddress) {
    L2GatewayDevice device = getDeviceFromTunnelIp(tunnelIp);
    if (device == null) {
        LOG.error("Unable to get L2Device for tunnelIp {} and elanInstanceName {}", tunnelIp, elanInstanceName);
    }
    jobCoordinator.enqueueJob(getJobKey(elanInstanceName), () -> {
        if (entityOwnershipUtils.isEntityOwner(HwvtepSouthboundConstants.ELAN_ENTITY_TYPE, HwvtepSouthboundConstants.ELAN_ENTITY_NAME)) {
            String tunnelInterfaceName = getExternalTunnelInterfaceName(String.valueOf(dpnId), device.getHwvtepNodeId());
            int lportTag = interfaceManager.getInterfaceInfo(tunnelInterfaceName).getInterfaceTag();
            InstanceIdentifier<ElanInstance> elanIdentifier = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(elanInstanceName)).build();
            Optional<ElanInstance> optElan = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, elanIdentifier);
            if (optElan.isPresent()) {
                LOG.trace("Configuring the SR-IOV Arp request/response flows for LPort {} ElanTag {}.", lportTag, optElan.get().getElanTag());
                Uuid nwUuid = new Uuid(elanInstanceName);
                String strVni = DhcpServiceUtils.getSegmentationId(nwUuid, broker);
                BigInteger vni = strVni != null ? new BigInteger(strVni) : BigInteger.ZERO;
                if (!vni.equals(BigInteger.ZERO)) {
                    if (addFlow) {
                        LOG.trace("Installing the SR-IOV DHCP Arp flow for DPN {} Port Ip {}, Lport {}.", dpnId, dhcpIpAddress, lportTag);
                        installDhcpArpRequestFlows(dpnId, vni, dhcpIpAddress, lportTag, optElan.get().getElanTag());
                        installDhcpArpResponderFlows(dpnId, tunnelInterfaceName, lportTag, elanInstanceName, dhcpIpAddress, dhcpMacAddress);
                    } else {
                        LOG.trace("Uninstalling the SR-IOV DHCP Arp flows for DPN {} Port Ip {}, Lport {}.", dpnId, dhcpIpAddress, lportTag);
                        uninstallDhcpArpRequestFlows(dpnId, vni, dhcpIpAddress, lportTag);
                        uninstallDhcpArpResponderFlows(dpnId, tunnelInterfaceName, lportTag, dhcpIpAddress);
                    }
                }
            }
        }
        return null;
    });
}
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) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) BigInteger(java.math.BigInteger) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 89 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device 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 90 with Device

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.Device in project netvirt by opendaylight.

the class L2GatewayListener method add.

@Override
protected void add(final InstanceIdentifier<L2gateway> identifier, final L2gateway input) {
    LOG.info("Adding L2gateway with ID: {}", input.getUuid());
    List<Devices> l2Devices = input.getDevices();
    for (Devices l2Device : l2Devices) {
        LOG.trace("Adding L2gateway device: {}", l2Device);
        addL2Device(l2Device, input);
    }
}
Also used : Devices(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.Devices)

Aggregations

ArrayList (java.util.ArrayList)50 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)34 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)30 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)29 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)25 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)24 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)24 List (java.util.List)21 ExecutionException (java.util.concurrent.ExecutionException)18 Collection (java.util.Collection)16 Map (java.util.Map)16 Collections (java.util.Collections)15 HashMap (java.util.HashMap)15 Test (org.junit.Test)14 BigInteger (java.math.BigInteger)13 Set (java.util.Set)13 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)13 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)12 Logger (org.slf4j.Logger)12 LoggerFactory (org.slf4j.LoggerFactory)12