use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.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");
}
}
}
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.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);
}
}
}
}
Aggregations