X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fopenflow%2Fmd%2Fcore%2Ftranslator%2FMultipartReplyTableFeaturesToTableUpdatedTranslator.java;h=820cc73efc487ffbc11ec1df01f49eb34cbc6492;hb=62a2522261049627e33ff4ae80120ffb530e7f73;hp=219cb4916d13c44e271da26edfdfedace51043ea;hpb=cd483df16cb45f5d8ef18fc62937367c2780f56b;p=openflowplugin.git diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTableFeaturesToTableUpdatedTranslator.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTableFeaturesToTableUpdatedTranslator.java index 219cb4916d..820cc73efc 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTableFeaturesToTableUpdatedTranslator.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTableFeaturesToTableUpdatedTranslator.java @@ -1,16 +1,23 @@ +/** + * Copyright (c) 2014 Ericsson India Global Services Pvt Ltd. 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.math.BigInteger; import java.util.Collections; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; - -import org.opendaylight.openflowplugin.openflow.md.core.IMDMessageTranslator; -import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher; +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.core.sal.convertor.TableFeaturesReplyConvertor; -import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext; import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply; @@ -26,36 +33,36 @@ import org.slf4j.LoggerFactory; public class MultipartReplyTableFeaturesToTableUpdatedTranslator implements IMDMessageTranslator> { - protected static final Logger LOG = LoggerFactory + private static final Logger LOG = LoggerFactory .getLogger(MultipartReplyTableFeaturesToTableUpdatedTranslator.class); - + @Override public List translate(SwitchConnectionDistinguisher cookie, SessionContext sc, OfHeader msg) { - - - if(msg instanceof MultipartReply && ((MultipartReply) msg).getType() == MultipartType.OFPMPTABLEFEATURES) { - LOG.info("MultipartReply Being translated to TableUpdated " ); - MultipartReplyMessage mpReply = (MultipartReplyMessage)msg; - + + + if (msg instanceof MultipartReply && ((MultipartReply) msg).getType() == MultipartType.OFPMPTABLEFEATURES) { + LOG.debug("MultipartReply Being translated to TableUpdated "); + MultipartReplyMessage mpReply = (MultipartReplyMessage) msg; + List listDataObject = new CopyOnWriteArrayList(); - + TableUpdatedBuilder message = new TableUpdatedBuilder() ; message.setNode((new NodeRef(InventoryDataServiceUtil.identifierFromDatapathId(sc.getFeatures() .getDatapathId())))); message.setMoreReplies(mpReply.getFlags().isOFPMPFREQMORE()); - message.setTransactionId(new TransactionId(new BigInteger(mpReply.getXid().toString() ))) ; + message.setTransactionId(new TransactionId(BigInteger.valueOf(mpReply.getXid()))); MultipartReplyTableFeaturesCase caseBody = (MultipartReplyTableFeaturesCase) mpReply.getMultipartReplyBody(); MultipartReplyTableFeatures body = caseBody.getMultipartReplyTableFeatures(); message.setTableFeatures(TableFeaturesReplyConvertor.toTableFeaturesReply(body)) ; listDataObject.add( message.build()) ; - + return listDataObject ; - - } - return Collections.emptyList(); - - } - + + } + return Collections.emptyList(); + + } + }