2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.openflowplugin.openflow.md.core.translator;
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;
23 public class ErrorTranslator implements IMDMessageTranslator<OfHeader, DataObject> {
25 private static final Logger LOG = LoggerFactory
26 .getLogger(ErrorTranslator.class);
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