preparing QueueKeeper and message translation
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / translator / ErrorTranslator.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.openflow.md.core.translator;
9
10 import org.opendaylight.openflowplugin.openflow.md.core.IMDMessageTranslator;
11 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
12 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
15 import org.opendaylight.yangtools.yang.binding.DataObject;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 /**
20  * @author mirehak
21  *
22  */
23 public class ErrorTranslator implements IMDMessageTranslator<OfHeader, DataObject> {
24
25     private static final Logger LOG = LoggerFactory
26             .getLogger(ErrorTranslator.class);
27     
28     @Override
29     public DataObject translate(SwitchConnectionDistinguisher cookie,
30             SessionContext sc, OfHeader msg) {
31         ErrorMessage errorMsg = (ErrorMessage) msg;
32         LOG.error("errorMessage arrived: type={}, code={}, data={} | [{}]", 
33                 errorMsg.getType(), errorMsg.getCode(),
34                 new String(errorMsg.getData()), ByteUtil.bytesToHexstring(errorMsg.getData(), " "));
35         //TODO:: add sal-error wrapper
36         return null;
37     }
38
39
40 }