use of org.opendaylight.genius.itm.confighelpers.HwVtep in project genius by opendaylight.
the class TransportZoneListener method add.
@Override
public void add(@Nonnull TransportZone transportZone) {
LOG.debug("Received Transport Zone Add Event: {}", transportZone);
List<DPNTEPsInfo> opDpnList = createDPNTepInfo(transportZone);
List<HwVtep> hwVtepList = createhWVteps(transportZone);
opDpnList.addAll(getDPNTepInfoFromNotHosted(transportZone));
LOG.trace("Add: Operational dpnTepInfo - Before invoking ItmManager {}", opDpnList);
if (!opDpnList.isEmpty() || !hwVtepList.isEmpty()) {
LOG.trace("Add: Invoking ItmManager with DPN List {} ", opDpnList);
LOG.trace("Add: Invoking ItmManager with hwVtep List {} ", hwVtepList);
jobCoordinator.enqueueJob(transportZone.getZoneName(), new ItmTepAddWorker(opDpnList, hwVtepList, dataBroker, mdsalManager, itmConfig, itmInternalTunnelAddWorker, externalTunnelAddWorker, dpnTEPsInfoCache));
}
}
use of org.opendaylight.genius.itm.confighelpers.HwVtep in project genius by opendaylight.
the class TransportZoneListener method update.
@Override
public void update(@Nonnull TransportZone originalTransportZone, @Nonnull TransportZone updatedTransportZone) {
LOG.debug("Received Transport Zone Update Event: Old - {}, Updated - {}", originalTransportZone, updatedTransportZone);
List<DPNTEPsInfo> oldDpnTepsList = createDPNTepInfo(originalTransportZone);
List<DPNTEPsInfo> newDpnTepsList = createDPNTepInfo(updatedTransportZone);
List<DPNTEPsInfo> oldDpnTepsListcopy = new ArrayList<>();
oldDpnTepsListcopy.addAll(oldDpnTepsList);
LOG.trace("oldcopy0 {}", oldDpnTepsListcopy);
List<DPNTEPsInfo> newDpnTepsListcopy = new ArrayList<>();
newDpnTepsListcopy.addAll(newDpnTepsList);
LOG.trace("newcopy0 {}", newDpnTepsListcopy);
oldDpnTepsList.removeAll(newDpnTepsListcopy);
newDpnTepsList.removeAll(oldDpnTepsListcopy);
LOG.trace("oldDpnTepsList {}", oldDpnTepsList);
LOG.trace("newDpnTepsList {}", newDpnTepsList);
LOG.trace("oldcopy {}", oldDpnTepsListcopy);
LOG.trace("newcopy {}", newDpnTepsListcopy);
LOG.trace("oldcopy Size {}", oldDpnTepsList.size());
LOG.trace("newcopy Size {}", newDpnTepsList.size());
if (!newDpnTepsList.isEmpty()) {
LOG.trace("Adding TEPs ");
jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepAddWorker(newDpnTepsList, Collections.emptyList(), dataBroker, mdsalManager, itmConfig, itmInternalTunnelAddWorker, externalTunnelAddWorker, dpnTEPsInfoCache));
}
if (!oldDpnTepsList.isEmpty()) {
LOG.trace("Removing TEPs ");
jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepRemoveWorker(oldDpnTepsList, Collections.emptyList(), originalTransportZone, dataBroker, mdsalManager, itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
}
List<HwVtep> oldHwList = createhWVteps(originalTransportZone);
List<HwVtep> newHwList = createhWVteps(updatedTransportZone);
List<HwVtep> oldHwListcopy = new ArrayList<>();
oldHwListcopy.addAll(oldHwList);
LOG.trace("oldHwListcopy0 {}", oldHwListcopy);
List<HwVtep> newHwListcopy = new ArrayList<>();
newHwListcopy.addAll(newHwList);
LOG.trace("newHwListcopy0 {}", newHwListcopy);
oldHwList.removeAll(newHwListcopy);
newHwList.removeAll(oldHwListcopy);
LOG.trace("oldHwList {}", oldHwList);
LOG.trace("newHwList {}", newHwList);
LOG.trace("oldHwListcopy {}", oldHwListcopy);
LOG.trace("newHwListcopy {}", newHwListcopy);
if (!newHwList.isEmpty()) {
LOG.trace("Adding HW TEPs ");
jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepAddWorker(Collections.emptyList(), newHwList, dataBroker, mdsalManager, itmConfig, itmInternalTunnelAddWorker, externalTunnelAddWorker, dpnTEPsInfoCache));
}
if (!oldHwList.isEmpty()) {
LOG.trace("Removing HW TEPs ");
jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepRemoveWorker(Collections.emptyList(), oldHwList, originalTransportZone, dataBroker, mdsalManager, itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
}
}
use of org.opendaylight.genius.itm.confighelpers.HwVtep in project genius by opendaylight.
the class TransportZoneListener method createhWVteps.
private List<HwVtep> createhWVteps(TransportZone transportZone) {
List<HwVtep> hwVtepsList = new ArrayList<>();
String zoneName = transportZone.getZoneName();
Class<? extends TunnelTypeBase> tunnelType = transportZone.getTunnelType();
LOG.trace("Transport Zone_name: {}", zoneName);
List<Subnets> subnetsList = transportZone.getSubnets();
if (subnetsList != null) {
for (Subnets subnet : subnetsList) {
IpPrefix ipPrefix = subnet.getPrefix();
IpAddress gatewayIP = subnet.getGatewayIp();
int vlanID = subnet.getVlanId();
LOG.trace("IpPrefix: {}, gatewayIP: {}, vlanID: {} ", ipPrefix, gatewayIP, vlanID);
List<DeviceVteps> deviceVtepsList = subnet.getDeviceVteps();
if (deviceVtepsList != null) {
for (DeviceVteps vteps : deviceVtepsList) {
String topologyId = vteps.getTopologyId();
String nodeId = vteps.getNodeId();
IpAddress ipAddress = vteps.getIpAddress();
LOG.trace("topo-id: {}, node-id: {}, ipAddress: {}", topologyId, nodeId, ipAddress);
HwVtep hwVtep = ItmUtils.createHwVtepObject(topologyId, nodeId, ipAddress, ipPrefix, gatewayIP, vlanID, tunnelType, transportZone);
LOG.trace("Adding new HwVtep {} info ", hwVtep.getHwIp());
hwVtepsList.add(hwVtep);
}
}
}
}
LOG.trace("returning hwvteplist {}", hwVtepsList);
return hwVtepsList;
}
Aggregations