2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.protocol_plugin.openflow.internal;
11 import org.apache.felix.dm.Component;
12 import org.opendaylight.controller.protocol_plugin.openflow.IFlowProgrammerNotifier;
13 import org.opendaylight.controller.sal.core.Node;
14 import org.opendaylight.controller.sal.flowprogrammer.Flow;
15 import org.opendaylight.controller.sal.flowprogrammer.IPluginOutFlowProgrammerService;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * Flow Programmer Notifier class for relaying asynchronous messages received
21 * from the network node to the listeners on the proper container
23 public class FlowProgrammerNotifier implements IFlowProgrammerNotifier {
24 protected static final Logger logger = LoggerFactory
25 .getLogger(FlowProgrammerNotifier.class);
26 private IPluginOutFlowProgrammerService salNotifier;
28 public FlowProgrammerNotifier() {
32 void init(Component c) {
33 logger.debug("INIT called!");
37 * Function called by the dependency manager when at least one dependency
38 * become unsatisfied or when the component is shutting down because for
39 * example bundle is being stopped.
43 logger.debug("DESTROY called!");
47 * Function called by dependency manager after "init ()" is called and after
48 * the services provided by the class are registered in the service registry
52 logger.debug("START called!");
56 * Function called by the dependency manager before the services exported by
57 * the component are unregistered, this will be followed by a "destroy ()"
62 logger.debug("STOP called!");
65 public void setPluginOutFlowProgrammerService(
66 IPluginOutFlowProgrammerService s) {
70 public void unsetPluginOutFlowProgrammerService(
71 IPluginOutFlowProgrammerService s) {
72 if (this.salNotifier == s) {
73 this.salNotifier = null;
78 public void flowRemoved(Node node, Flow flow) {
79 if (salNotifier != null) {
80 salNotifier.flowRemoved(node, flow);
82 logger.warn("Unable to relay switch message to upper layer");
87 public void flowErrorReported(Node node, long rid, Object err) {
88 if (salNotifier != null) {
89 salNotifier.flowErrorReported(node, rid, err);
91 logger.warn("Unable to relay switch error message to upper layer");