/*
* Copyright (c) 2015 Hewlett-Packard Development Company and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.nic.listeners.impl;
import org.opendaylight.nic.common.transaction.api.IntentCommonService;
import org.opendaylight.nic.listeners.api.IEventListener;
import org.opendaylight.nic.listeners.api.NicNotification;
import org.opendaylight.nic.listeners.api.NodeDeleted;
import org.opendaylight.nic.listeners.api.NodeUp;
import org.opendaylight.nic.utils.FlowAction;
class NodeNotificationSubscriberImpl implements IEventListener<NicNotification> {
private IntentCommonService flowService;
public NodeNotificationSubscriberImpl(IntentCommonService flowService) {
this.flowService = flowService;
}
@Override
public void handleEvent(NicNotification event) {
if (NodeUp.class.isInstance(event)) {
NodeUp nodeUp = (NodeUp) event;
flowService.createARPFlow(nodeUp.getNodeId());
flowService.createLLDPFlow(nodeUp.getNodeId());
flowService.resolveAndApply(nodeUp.getNodeId());
}
if (NodeDeleted.class.isInstance(event)) {
//TODO: Since node is deleted flow no longer exists on switch as there is no switch
}
}
}