OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[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  *
35  * @author kramesha
36  */
37 public class NodeErrorListenerLoggingImpl implements NodeErrorListener {
38
39     private static final Logger LOG = LoggerFactory.getLogger(NodeErrorListenerLoggingImpl.class);
40
41     @Override
42     public void onBadActionErrorNotification(BadActionErrorNotification notification) {
43         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
44                 notification.getTransactionId().getValue()));
45     }
46
47     @Override
48     public void onBadInstructionErrorNotification(BadInstructionErrorNotification notification) {
49         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
50                 notification.getTransactionId().getValue()));
51     }
52
53     @Override
54     public void onBadMatchErrorNotification(BadMatchErrorNotification notification) {
55         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
56                 notification.getTransactionId().getValue()));
57     }
58
59     @Override
60     public void onBadRequestErrorNotification(BadRequestErrorNotification notification) {
61         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
62                 notification.getTransactionId().getValue()));
63     }
64
65     @Override
66     public void onExperimenterErrorNotification(ExperimenterErrorNotification notification) {
67         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
68                 notification.getTransactionId().getValue()));
69     }
70
71     @Override
72     public void onFlowModErrorNotification(FlowModErrorNotification notification) {
73         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
74                 notification.getTransactionId().getValue()));
75     }
76
77     @Override
78     public void onGroupModErrorNotification(GroupModErrorNotification notification) {
79         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
80                 notification.getTransactionId().getValue()));
81     }
82
83     @Override
84     public void onHelloFailedErrorNotification(HelloFailedErrorNotification notification) {
85         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
86                 notification.getTransactionId().getValue()));
87     }
88
89     @Override
90     public void onMeterModErrorNotification(MeterModErrorNotification notification) {
91         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
92                 notification.getTransactionId().getValue()));
93     }
94
95     @Override
96     public void onPortModErrorNotification(PortModErrorNotification notification) {
97         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
98                 notification.getTransactionId().getValue()));
99     }
100
101     @Override
102     public void onQueueOpErrorNotification(QueueOpErrorNotification notification) {
103         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
104                 notification.getTransactionId().getValue()));
105     }
106
107     @Override
108     public void onRoleRequestErrorNotification(RoleRequestErrorNotification notification) {
109         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
110                 notification.getTransactionId().getValue()));
111     }
112
113     @Override
114     public void onSwitchConfigErrorNotification(SwitchConfigErrorNotification notification) {
115         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
116                 notification.getTransactionId().getValue()));
117     }
118
119     @Override
120     public void onTableFeaturesErrorNotification(TableFeaturesErrorNotification notification) {
121         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
122                 notification.getTransactionId().getValue()));
123     }
124
125     @Override
126     public void onTableModErrorNotification(TableModErrorNotification notification) {
127         LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
128                 notification.getTransactionId().getValue()));
129     }
130
131     private String toStr(ErrorType type, int code, BigInteger xid) {
132         return "[Type=" + type + ", Code=" + code + ", Xid =" + xid + "]";
133     }
134 }