Search in sources :

Example 1 with LogicalSwitchAddedJob

use of org.opendaylight.netvirt.elan.l2gw.jobs.LogicalSwitchAddedJob in project netvirt by opendaylight.

the class HwvtepLogicalSwitchListener method added.

@Override
@SuppressWarnings("checkstyle:IllegalCatch")
protected void added(InstanceIdentifier<LogicalSwitches> identifier, LogicalSwitches logicalSwitchNew) {
    LOG.debug("Received Add DataChange Notification for identifier: {}, LogicalSwitches: {}", identifier, logicalSwitchNew);
    try {
        L2GatewayDevice elanDevice = l2GatewayConnectionUtils.addL2DeviceToElanL2GwCache(logicalSwitchNew.getHwvtepNodeName().getValue(), l2GatewayDevice, l2GwConnId, physicalDevice);
        LogicalSwitchAddedJob logicalSwitchAddedWorker = new LogicalSwitchAddedJob(elanL2GatewayUtils, elanL2GatewayMulticastUtils, logicalSwitchName, physicalDevice, elanDevice, defaultVlanId, () -> elanInstanceCache.get(logicalSwitchName).orNull());
        elanClusterUtils.runOnlyInOwnerNode(logicalSwitchAddedWorker.getJobKey(), "create vlan mappings and mcast configurations", logicalSwitchAddedWorker);
    } catch (RuntimeException e) {
        LOG.error("Failed to handle HwVTEPLogicalSwitch - add for: {}", identifier, e);
    } finally {
        try {
            // This listener is specific to handle a specific logical
            // switch, hence closing it.
            LOG.trace("Closing LogicalSwitches listener for node: {}, logicalSwitch: {}", nodeId.getValue(), logicalSwitchName);
            // TODO use https://git.opendaylight.org/gerrit/#/c/44145/ when merged, and remove @SuppressWarnings
            close();
        } catch (Exception e) {
            LOG.warn("Failed to close HwVTEPLogicalSwitchListener", e);
        }
    }
}
Also used : LogicalSwitchAddedJob(org.opendaylight.netvirt.elan.l2gw.jobs.LogicalSwitchAddedJob) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)

Aggregations

LogicalSwitchAddedJob (org.opendaylight.netvirt.elan.l2gw.jobs.LogicalSwitchAddedJob)1 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)1