use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone in project genius by opendaylight.
the class TransportZoneListener method createDPNTepInfoFromNotHosted.
private List<DPNTEPsInfo> createDPNTepInfoFromNotHosted(TransportZone tzNew) {
Map<BigInteger, List<TunnelEndPoints>> mapNotHostedDPNToTunnelEndpt = new ConcurrentHashMap<>();
List<DPNTEPsInfo> notHostedDpnTepInfo = new ArrayList<>();
String newZoneName = tzNew.getZoneName();
List<TzMembership> zones = ItmUtils.createTransportZoneMembership(newZoneName);
Class<? extends TunnelTypeBase> tunnelType = tzNew.getTunnelType();
TepsInNotHostedTransportZone tepsInNotHostedTransportZone = getNotHostedTransportZone(newZoneName).get();
if (tepsInNotHostedTransportZone == null) {
return notHostedDpnTepInfo;
}
List<UnknownVteps> unVtepsLst = tepsInNotHostedTransportZone.getUnknownVteps();
List<Vteps> vtepsList = new ArrayList<>();
if (unVtepsLst != null && !unVtepsLst.isEmpty()) {
for (UnknownVteps vteps : unVtepsLst) {
BigInteger dpnID = vteps.getDpnId();
String port = ITMConstants.DUMMY_PORT;
int vlanID = ITMConstants.DUMMY_VLANID;
IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(ITMConstants.DUMMY_PREFIX);
IpAddress gatewayIP = IpAddressBuilder.getDefaultInstance(ITMConstants.DUMMY_GATEWAY_IP);
IpAddress ipAddress = vteps.getIpAddress();
boolean useOfTunnel = ItmUtils.falseIfNull(vteps.isOfTunnel());
String tos = vteps.getOptionTunnelTos();
if (tos == null) {
tos = itmConfig.getDefaultTunnelTos();
}
TunnelEndPoints tunnelEndPoints = ItmUtils.createTunnelEndPoints(dpnID, ipAddress, port, useOfTunnel, vlanID, ipPrefix, gatewayIP, zones, tunnelType, tos);
List<TunnelEndPoints> tunnelEndPointsList = mapNotHostedDPNToTunnelEndpt.get(dpnID);
if (tunnelEndPointsList != null) {
tunnelEndPointsList.add(tunnelEndPoints);
} else {
tunnelEndPointsList = new ArrayList<>();
tunnelEndPointsList.add(tunnelEndPoints);
mapNotHostedDPNToTunnelEndpt.put(dpnID, tunnelEndPointsList);
}
Vteps newVtep = createVtepFromUnKnownVteps(dpnID, ipAddress, ITMConstants.DUMMY_PORT);
vtepsList.add(newVtep);
// Enqueue 'remove TEP from TepsNotHosted list' operation
// into DataStoreJobCoordinator
ItmTepsNotHostedRemoveWorker removeWorker = new ItmTepsNotHostedRemoveWorker(newZoneName, ipAddress, dpnID, dataBroker);
jobCoordinator.enqueueJob(newZoneName, removeWorker);
}
}
// Enqueue 'add TEP received from southbound OVSDB into ITM config DS' operation
// into DataStoreJobCoordinator
ItmTepsNotHostedMoveWorker moveWorker = new ItmTepsNotHostedMoveWorker(vtepsList, newZoneName, dataBroker);
jobCoordinator.enqueueJob(newZoneName, moveWorker);
if (mapNotHostedDPNToTunnelEndpt.size() > 0) {
for (Entry<BigInteger, List<TunnelEndPoints>> entry : mapNotHostedDPNToTunnelEndpt.entrySet()) {
DPNTEPsInfo newDpnTepsInfo = ItmUtils.createDPNTepInfo(entry.getKey(), entry.getValue());
notHostedDpnTepInfo.add(newDpnTepsInfo);
}
}
return notHostedDpnTepInfo;
}
Aggregations