Search in sources :

Example 11 with DeviceVteps

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps in project genius by opendaylight.

the class ItmExternalTunnelAddWorker method tunnelsFromhWVtep.

private void tunnelsFromhWVtep(List<HwVtep> cfgdHwVteps, WriteTransaction transaction, Integer monitorInterval, Class<? extends TunnelMonitoringTypeBase> monitorProtocol) {
    for (HwVtep hwTep : cfgdHwVteps) {
        InstanceIdentifier<TransportZone> tzonePath = InstanceIdentifier.builder(TransportZones.class).child(TransportZone.class, new TransportZoneKey(hwTep.getTransportZone())).build();
        Optional<TransportZone> transportZoneOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, tzonePath, dataBroker);
        Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
        if (transportZoneOptional.isPresent()) {
            TransportZone tzone = transportZoneOptional.get();
            // do we need to check tunnel type?
            if (tzone.getSubnets() != null && !tzone.getSubnets().isEmpty()) {
                for (Subnets sub : tzone.getSubnets()) {
                    if (sub.getDeviceVteps() != null && !sub.getDeviceVteps().isEmpty()) {
                        for (DeviceVteps hwVtepDS : sub.getDeviceVteps()) {
                            if (hwVtepDS.getIpAddress().equals(hwTep.getHwIp())) {
                                // dont mesh with self
                                continue;
                            }
                            LOG.trace("wire up {} and {}", hwTep, hwVtepDS);
                            if (!wireUp(hwTep.getTopoId(), hwTep.getNodeId(), hwTep.getHwIp(), hwVtepDS.getNodeId(), hwVtepDS.getIpAddress(), hwTep.getIpPrefix(), hwTep.getGatewayIP(), sub.getPrefix(), tunType, false, monitorInterval, monitorProtocol, transaction)) {
                                LOG.error("Unable to build tunnel {} -- {}", hwTep.getHwIp(), hwVtepDS.getIpAddress());
                            }
                            // TOR2-TOR1
                            LOG.trace("wire up {} and {}", hwVtepDS, hwTep);
                            if (!wireUp(hwTep.getTopoId(), hwVtepDS.getNodeId(), hwVtepDS.getIpAddress(), hwTep.getNodeId(), hwTep.getHwIp(), sub.getPrefix(), sub.getGatewayIp(), hwTep.getIpPrefix(), tunType, false, monitorInterval, monitorProtocol, transaction)) {
                                LOG.error("Unable to build tunnel {} -- {}", hwVtepDS.getIpAddress(), hwTep.getHwIp());
                            }
                        }
                    }
                    if (sub.getVteps() != null && !sub.getVteps().isEmpty()) {
                        for (Vteps vtep : sub.getVteps()) {
                            if (vtep.getIpAddress().equals(hwTep.getHwIp())) {
                                continue;
                            }
                            // TOR-OVS
                            String cssID = vtep.getDpnId().toString();
                            LOG.trace("wire up {} and {}", hwTep, vtep);
                            if (!wireUp(hwTep.getTopoId(), hwTep.getNodeId(), hwTep.getHwIp(), cssID, vtep.getIpAddress(), hwTep.getIpPrefix(), hwTep.getGatewayIP(), sub.getPrefix(), tunType, false, monitorInterval, monitorProtocol, transaction)) {
                                LOG.error("Unable to build tunnel {} -- {}", hwTep.getHwIp(), vtep.getIpAddress());
                            }
                            // OVS-TOR
                            LOG.trace("wire up {} and {}", vtep, hwTep);
                            boolean useOfTunnel = ItmUtils.falseIfNull(vtep.isOptionOfTunnel());
                            if (!wireUp(vtep.getDpnId(), vtep.getPortname(), sub.getVlanId(), vtep.getIpAddress(), useOfTunnel, hwTep.getNodeId(), hwTep.getHwIp(), sub.getPrefix(), sub.getGatewayIp(), hwTep.getIpPrefix(), tunType, false, monitorInterval, monitorProtocol, transaction)) {
                                LOG.debug("wireUp returned false");
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : DeviceVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps) Subnets(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps) DeviceVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)

Example 12 with DeviceVteps

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps in project genius by opendaylight.

the class ItmExternalTunnelDeleteWorker method deleteTunnelsInTransportZone.

private static void deleteTunnelsInTransportZone(String zoneName, DPNTEPsInfo dpn, TunnelEndPoints srcTep, List<HwVtep> cfgdhwVteps, DataBroker dataBroker, WriteTransaction writeTransaction) {
    InstanceIdentifier<TransportZone> tzonePath = InstanceIdentifier.builder(TransportZones.class).child(TransportZone.class, new TransportZoneKey(zoneName)).build();
    Optional<TransportZone> transportZoneOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, tzonePath, dataBroker);
    if (transportZoneOptional.isPresent()) {
        TransportZone tzone = transportZoneOptional.get();
        // do we need to check tunnel type?
        if (tzone.getSubnets() != null && !tzone.getSubnets().isEmpty()) {
            for (Subnets sub : tzone.getSubnets()) {
                if (sub.getDeviceVteps() != null && !sub.getDeviceVteps().isEmpty()) {
                    for (DeviceVteps hwVtepDS : sub.getDeviceVteps()) {
                        // OVS-TOR-OVS
                        deleteTrunksOvsTor(dataBroker, dpn.getDPNID(), srcTep.getInterfaceName(), srcTep.getIpAddress(), hwVtepDS.getTopologyId(), hwVtepDS.getNodeId(), hwVtepDS.getIpAddress(), tzone.getTunnelType(), writeTransaction);
                    }
                }
            }
        }
        if (cfgdhwVteps != null && !cfgdhwVteps.isEmpty()) {
            for (HwVtep hwVtep : cfgdhwVteps) {
                deleteTrunksOvsTor(dataBroker, dpn.getDPNID(), srcTep.getInterfaceName(), srcTep.getIpAddress(), hwVtep.getTopoId(), hwVtep.getNodeId(), hwVtep.getHwIp(), TunnelTypeVxlan.class, writeTransaction);
            }
        }
    }
}
Also used : DeviceVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps) Subnets(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)

Aggregations

TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)10 DeviceVteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps)10 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)7 SubnetsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey)7 DeviceVtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey)7 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)5 Subnets (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets)5 DeviceVtepsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder)5 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)4 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)4 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)4 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)4 RpcResultBuilder (org.opendaylight.yangtools.yang.common.RpcResultBuilder)4 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)3 InternalTunnelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelBuilder)3 InternalTunnelKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey)3 TransportZonesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZonesBuilder)3 TransportZoneBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder)3 SubnetsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsBuilder)3 DpnEndpointsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpointsBuilder)2