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