Search in sources :

Example 66 with Subnets

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.subnets.Subnets 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

Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)30 Subnets (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets)23 ArrayList (java.util.ArrayList)22 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)18 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)17 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)16 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)15 BigInteger (java.math.BigInteger)14 List (java.util.List)11 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)10 DeviceVteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps)10 Subnets (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.subnets.Subnets)10 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)9 Subnetmap (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap)9 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)9 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)8 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)8 HashMap (java.util.HashMap)7 ExecutionException (java.util.concurrent.ExecutionException)7 Map (java.util.Map)6