Bug:701 - Have Typed ErrorNotification for different node errrors
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / FlowEventListenerLoggingImpl.java
1 /**
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  * 
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
7  */
8 package org.opendaylight.openflowplugin.test;
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeErrorNotification;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeExperimenterErrorNotification;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 /**
21  * dummy implementation flushing events into log
22  */
23 public class FlowEventListenerLoggingImpl implements SalFlowListener {
24     
25     private static Logger LOG = LoggerFactory
26             .getLogger(FlowEventListenerLoggingImpl.class);
27
28     @Override
29     public void onFlowAdded(FlowAdded notification) {
30         LOG.info("flow to be added.........................." + notification.toString());
31         LOG.info("added flow Xid........................." + notification.getTransactionId().getValue());
32         LOG.info("-----------------------------------------------------------------------------------");
33     }
34
35     @Override
36     public void onFlowRemoved(FlowRemoved notification) {
37         LOG.debug("removed flow.........................." + notification.toString());
38         LOG.debug("remove flow Xid........................." + notification.getTransactionId().getValue());
39         LOG.debug("-----------------------------------------------------------------------------------");
40     }
41
42     @Override
43     public void onFlowUpdated(FlowUpdated notification) {
44         LOG.debug("updated flow.........................." + notification.toString());
45         LOG.debug("updated flow Xid........................." + notification.getTransactionId().getValue());
46         LOG.debug("-----------------------------------------------------------------------------------");
47     }
48
49     @Override
50     public void onNodeErrorNotification(NodeErrorNotification notification) {
51     //commenting as we have a NodeErrorListener
52     /*    LOG.error("Error notification  flow Xid........................."
53                 + notification.getTransactionId().getValue());
54         LOG.debug("notification Begin-Transaction:"
55                 + notification.getTransactionUri()
56                 + "-----------------------------------------------------------------------------------");
57     */
58     }
59
60     @Override
61     public void onNodeExperimenterErrorNotification(
62             NodeExperimenterErrorNotification notification) {
63         // TODO Auto-generated method stub
64
65     }
66
67     @Override
68     public void onSwitchFlowRemoved(SwitchFlowRemoved notification) {
69         LOG.debug("Switch flow removed : Cookies..................."
70                 + notification.getCookie().toString());
71         LOG.debug("-----------------------------------------------------------------------------------");
72     }
73 }