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.ByteUtil;
11 import org.opendaylight.openflowplugin.openflow.md.core.IMDMessageTranslator;
12 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
13 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
24 public class ErrorTranslator implements IMDMessageTranslator<OfHeader, DataObject> {
26 private static final Logger LOG = LoggerFactory
27 .getLogger(ErrorTranslator.class);
30 public DataObject translate(SwitchConnectionDistinguisher cookie,
31 SessionContext sc, OfHeader msg) {
32 ErrorMessage errorMsg = (ErrorMessage) msg;
33 LOG.error("errorMessage arrived: type={}, code={}, data={} | [{}]",
34 errorMsg.getType(), errorMsg.getCode(),
35 new String(errorMsg.getData()), ByteUtil.bytesToHexstring(errorMsg.getData(), " "));
36 //TODO:: add sal-error wrapper