Bump mdsal to 5.0.2
[openflowplugin.git] / test-provider / src / main / java / org / opendaylight / openflowplugin / test / NodeErrorListenerLoggingImpl.java
index 71085f8d9e5f88bc569064d535caec95c413cfed..bc8d27ac4854a2972cf89588686f721efdb4d31e 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.openflowplugin.test;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.errors.rev131116.ErrorType;
@@ -17,95 +25,111 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev14041
 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.SwitchConfigErrorNotification;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.TableFeaturesErrorNotification;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.TableModErrorNotification;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint64;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.math.BigInteger;
-
 /**
- * dummy implementation flushing events into log
- *  @author kramesha
+ * Dummy implementation flushing events into log.
+ *
+ * @author kramesha
  */
 public class NodeErrorListenerLoggingImpl implements NodeErrorListener {
 
-    private static Logger LOG = LoggerFactory.getLogger(NodeErrorListenerLoggingImpl.class);
+    private static final Logger LOG = LoggerFactory.getLogger(NodeErrorListenerLoggingImpl.class);
 
     @Override
     public void onBadActionErrorNotification(BadActionErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onBadInstructionErrorNotification(BadInstructionErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onBadMatchErrorNotification(BadMatchErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onBadRequestErrorNotification(BadRequestErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onExperimenterErrorNotification(ExperimenterErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onFlowModErrorNotification(FlowModErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onGroupModErrorNotification(GroupModErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onHelloFailedErrorNotification(HelloFailedErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onMeterModErrorNotification(MeterModErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onPortModErrorNotification(PortModErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onQueueOpErrorNotification(QueueOpErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onRoleRequestErrorNotification(RoleRequestErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onSwitchConfigErrorNotification(SwitchConfigErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onTableFeaturesErrorNotification(TableFeaturesErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
     @Override
     public void onTableModErrorNotification(TableModErrorNotification notification) {
-        LOG.error("Error notification ----" + toStr(notification.getType(), notification.getCode(), notification.getTransactionId().getValue()) );
+        LOG.error("Error notification {}", toStr(notification.getType(), notification.getCode(),
+                notification.getTransactionId().getValue()));
     }
 
-    private String toStr(ErrorType type, int code, BigInteger xid) {
-        return "[Type="+type+", Code="+ code +", Xid ="+xid+"]";
+    private String toStr(ErrorType type, Uint16 code, Uint64 xid) {
+        return "[Type=" + type + ", Code=" + code + ", Xid =" + xid + "]";
     }
 }