Merge "Revert "BUG-2613: Migrating Openflow Specific NSF from controller project...
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / NodeErrorListenerLoggingImpl.java
1 package org.opendaylight.openflowplugin.test;
2
3 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.errors.rev131116.ErrorType;
4 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.BadActionErrorNotification;
5 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.BadInstructionErrorNotification;
6 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.BadMatchErrorNotification;
7 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.BadRequestErrorNotification;
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.ExperimenterErrorNotification;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.FlowModErrorNotification;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.GroupModErrorNotification;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.HelloFailedErrorNotification;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.MeterModErrorNotification;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.PortModErrorNotification;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.QueueOpErrorNotification;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.RoleRequestErrorNotification;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.SwitchConfigErrorNotification;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.TableFeaturesErrorNotification;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.TableModErrorNotification;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23 import java.math.BigInteger;
24
25 /**
26  * dummy implementation flushing events into log
27  *  @author kramesha
28  */
29 public class NodeErrorListenerLoggingImpl implements NodeErrorListener {
30
31     private static Logger LOG = LoggerFactory.getLogger(NodeErrorListenerLoggingImpl.class);
32
33     @Override
34     public void onBadActionErrorNotification(BadActionErrorNotification notification) {
35         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
36     }
37
38     @Override
39     public void onBadInstructionErrorNotification(BadInstructionErrorNotification notification) {
40         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
41     }
42
43     @Override
44     public void onBadMatchErrorNotification(BadMatchErrorNotification notification) {
45         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
46     }
47
48     @Override
49     public void onBadRequestErrorNotification(BadRequestErrorNotification notification) {
50         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
51     }
52
53     @Override
54     public void onExperimenterErrorNotification(ExperimenterErrorNotification notification) {
55         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
56     }
57
58     @Override
59     public void onFlowModErrorNotification(FlowModErrorNotification notification) {
60         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
61     }
62
63     @Override
64     public void onGroupModErrorNotification(GroupModErrorNotification notification) {
65         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
66     }
67
68     @Override
69     public void onHelloFailedErrorNotification(HelloFailedErrorNotification notification) {
70         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
71     }
72
73     @Override
74     public void onMeterModErrorNotification(MeterModErrorNotification notification) {
75         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
76     }
77
78     @Override
79     public void onPortModErrorNotification(PortModErrorNotification notification) {
80         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
81     }
82
83     @Override
84     public void onQueueOpErrorNotification(QueueOpErrorNotification notification) {
85         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
86     }
87
88     @Override
89     public void onRoleRequestErrorNotification(RoleRequestErrorNotification notification) {
90         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
91     }
92
93     @Override
94     public void onSwitchConfigErrorNotification(SwitchConfigErrorNotification notification) {
95         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
96     }
97
98     @Override
99     public void onTableFeaturesErrorNotification(TableFeaturesErrorNotification notification) {
100         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
101     }
102
103     @Override
104     public void onTableModErrorNotification(TableModErrorNotification notification) {
105         LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
106     }
107
108     private String toStr(ErrorType type, int code, BigInteger xid) {
109         return "[Type="+type+", Code="+ code +", Xid ="+xid+"]";
110     }
111 }