use of org.opendaylight.netvirt.elan.l2gw.MdsalEvent in project netvirt by opendaylight.
the class HwvtepPhysicalSwitchListener method handleAdd.
/**
* Handle add.
*
* @param l2GwDevice
* the l2 gw device
*/
private void handleAdd(L2GatewayDevice l2GwDevice, InstanceIdentifier<PhysicalSwitchAugmentation> identifier, PhysicalSwitchAugmentation phySwitchAdded) {
LOG.info("PhysicalSwitchListener Handle add of tunnel ips {} psNode {} device {}", phySwitchAdded.getTunnelIps(), identifier.firstKeyOf(Node.class).getNodeId(), l2GwDevice);
final String psName = l2GwDevice.getDeviceName();
final String hwvtepNodeId = l2GwDevice.getHwvtepNodeId();
Set<IpAddress> tunnelIps = l2GwDevice.getTunnelIps();
if (tunnelIps != null) {
// TODO add logical switch and mcast put itm tep event and update mcast
hwvtepHACache.addDebugEvent(new MdsalEvent("ps add provision", l2GwDevice.getHwvtepNodeId()));
for (final IpAddress tunnelIpAddr : tunnelIps) {
if (L2GatewayConnectionUtils.isGatewayAssociatedToL2Device(l2GwDevice)) {
LOG.info("PhysicalSwitchListener L2Gateway {} associated for {} physical switch " + " creating ITM tunnels for {}", l2GwDevice.getL2GatewayIds(), psName, tunnelIpAddr);
l2gwServiceProvider.provisionItmAndL2gwConnection(l2GwDevice, psName, hwvtepNodeId, tunnelIpAddr);
} else {
LOG.info("l2gw.provision.skip hwvtepNodeId: {} psName : {}", hwvtepNodeId, psName);
}
}
InstanceIdentifier<Node> globalNodeIid = HwvtepSouthboundUtils.createInstanceIdentifier(new NodeId(hwvtepNodeId));
HwvtepHACache.getInstance().setTepIpOfNode(globalNodeIid, tunnelIps.iterator().next());
elanClusterUtils.runOnlyInOwnerNode(psName, "Stale entry cleanup", () -> {
InstanceIdentifier<Node> psIid = HwvtepSouthboundUtils.createInstanceIdentifier(HwvtepSouthboundUtils.createManagedNodeId(new NodeId(hwvtepNodeId), psName));
staleVlanBindingsCleaner.scheduleStaleCleanup(psName, globalNodeIid, psIid);
transportZoneListener.createL2gwZeroDayConfig();
return Collections.emptyList();
});
}
}
use of org.opendaylight.netvirt.elan.l2gw.MdsalEvent in project netvirt by opendaylight.
the class HAOpClusteredListener method onGlobalNodeAdd.
@Override
public synchronized void onGlobalNodeAdd(InstanceIdentifier<Node> key, Node updated, TypedReadWriteTransaction<Operational> tx) {
connectedNodes.add(key);
addToCacheIfHAChildNode(key, updated);
hwvtepHACache.updateConnectedNodeStatus(key);
if (waitingJobs.containsKey(key) && !waitingJobs.get(key).isEmpty()) {
try {
HAJobScheduler jobScheduler = HAJobScheduler.getInstance();
Optional<Node> nodeOptional = tx.read(key).get();
if (nodeOptional.isPresent()) {
waitingJobs.get(key).forEach((waitingJob) -> jobScheduler.submitJob(() -> waitingJob.accept(nodeOptional)));
waitingJobs.get(key).clear();
hwvtepHACache.addDebugEvent(new MdsalEvent("Waiting jobs of node are run ", getNodeId(key)));
} else {
LOG.error("Failed to read oper node {}", key);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Failed to read oper node {}", key);
}
}
}
use of org.opendaylight.netvirt.elan.l2gw.MdsalEvent in project netvirt by opendaylight.
the class HAOpClusteredListener method onGlobalNodeUpdate.
@Override
void onGlobalNodeUpdate(InstanceIdentifier<Node> childPath, Node updatedChildNode, Node beforeChildNode, DataObjectModification<Node> mod, TypedReadWriteTransaction<Operational> tx) {
boolean wasHAChild = hwvtepHACache.isHAEnabledDevice(childPath);
addToHACacheIfBecameHAChild(childPath, updatedChildNode, beforeChildNode);
boolean isHAChild = hwvtepHACache.isHAEnabledDevice(childPath);
if (!wasHAChild && isHAChild) {
hwvtepHACache.addDebugEvent(new MdsalEvent(getNodeId(childPath), "became ha child"));
LOG.debug("{} became ha_child", getNodeId(childPath));
} else if (wasHAChild && !isHAChild) {
LOG.debug("{} unbecome ha_child", getNodeId(childPath));
}
}
Aggregations