/**
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013, 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.openflow.md.core.translator;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
-
import org.opendaylight.openflowplugin.api.openflow.md.core.IMDMessageTranslator;
import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
+import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.errors.rev131116.ErrorType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.slf4j.LoggerFactory;
/**
- * general support for errorMessage OF-API to MD-SAL translation
+ * general support for errorMessage OF-API to MD-SAL translation
*/
public abstract class AbstractErrorTranslator implements IMDMessageTranslator<OfHeader, List<DataObject>> {
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractErrorTranslator.class);
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractErrorTranslator.class);
@Override
public List<DataObject> translate(SwitchConnectionDistinguisher cookie, SessionContext sc, OfHeader msg) {
// TODO -- Augmentation is not handled
ErrorType type = decodeErrorType(message.getType());
-
- list.add(getGranularNodeErrors(message, type));
+ NodeRef node = new NodeRef(
+ InventoryDataServiceUtil.identifierFromDatapathId(
+ sc.getFeatures().getDatapathId()));
+ list.add(getGranularNodeErrors(message, type, node));
return list;
} else {
LOG.error("Message is not of Error Message ");
return Collections.emptyList();
}
}
-
+
/**
- * @param message
- * @param errorType
- * @return
+ * @param message error message
+ * @param errorType error type
+ * @param node node ref
+ * @return error message
*/
- protected abstract org.opendaylight.yang.gen.v1.urn.opendaylight.flow.errors.rev131116.ErrorMessage getGranularNodeErrors(ErrorMessage message, ErrorType errorType);
+ protected abstract org.opendaylight.yang.gen.v1.urn.opendaylight.flow.errors.rev131116.ErrorMessage getGranularNodeErrors(ErrorMessage message, ErrorType errorType, NodeRef node);
/**
* @param type error type in source message