use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints 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);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints in project genius by opendaylight.
the class ItmExternalTunnelDeleteWorker method deleteTunnels.
public static List<ListenableFuture<Void>> deleteTunnels(DataBroker dataBroker, Collection<DPNTEPsInfo> dpnTepsList, IpAddress extIp, Class<? extends TunnelTypeBase> tunType) {
LOG.trace(" Delete Tunnels towards DC Gateway with Ip {}", extIp);
if (dpnTepsList == null || dpnTepsList.isEmpty()) {
LOG.debug("no vtep to delete");
return Collections.emptyList();
}
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
for (DPNTEPsInfo teps : dpnTepsList) {
TunnelEndPoints firstEndPt = teps.getTunnelEndPoints().get(0);
String interfaceName = firstEndPt.getInterfaceName();
String trunkInterfaceName = ItmUtils.getTrunkInterfaceName(interfaceName, new String(firstEndPt.getIpAddress().getValue()), new String(extIp.getValue()), tunType.getName());
InstanceIdentifier<Interface> trunkIdentifier = ItmUtils.buildId(trunkInterfaceName);
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, trunkIdentifier);
ItmUtils.ITM_CACHE.removeInterface(trunkInterfaceName);
InstanceIdentifier<ExternalTunnel> path = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, ItmUtils.getExternalTunnelKey(String.valueOf(extIp.getValue()), teps.getDPNID().toString(), tunType));
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, path);
LOG.debug("Deleting tunnel towards DC gateway, Tunnel interface name {} ", trunkInterfaceName);
ItmUtils.ITM_CACHE.removeExternalTunnel(trunkInterfaceName);
// Release the Ids for the trunk interface Name
ItmUtils.releaseIdForTrunkInterfaceName(interfaceName, new String(firstEndPt.getIpAddress().getValue()), new String(extIp.getValue()), tunType.getName());
}
return Collections.singletonList(writeTransaction.submit());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints in project genius by opendaylight.
the class ItmInternalTunnelAddWorker method wireUpWithinTransportZone.
private void wireUpWithinTransportZone(DPNTEPsInfo srcDpn, DPNTEPsInfo dstDpn, IMdsalApiManager mdsalManager, WriteTransaction transaction) {
LOG.trace("Wiring up within Transport Zone for Dpns {}, {} ", srcDpn, dstDpn);
List<TunnelEndPoints> srcEndPts = srcDpn.getTunnelEndPoints();
List<TunnelEndPoints> dstEndPts = dstDpn.getTunnelEndPoints();
for (TunnelEndPoints srcte : srcEndPts) {
for (TunnelEndPoints dstte : dstEndPts) {
// Compare the Transport zones
if (!srcDpn.getDPNID().equals(dstDpn.getDPNID())) {
if (!ItmUtils.getIntersection(srcte.getTzMembership(), dstte.getTzMembership()).isEmpty()) {
// wire them up
wireUpBidirectionalTunnel(srcte, dstte, srcDpn.getDPNID(), dstDpn.getDPNID(), mdsalManager, transaction);
if (!ItmTunnelAggregationHelper.isTunnelAggregationEnabled()) {
// CHECK THIS -- Assumption -- One end point per Dpn per transport zone
break;
}
}
}
}
}
}
Aggregations