Merge "Quick fix RPCs and DevicCtx.close"
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / translator / MultipartReplyTableFeaturesToTableUpdatedTranslator.java
index 219cb4916d13c44e271da26edfdfedace51043ea..820cc73efc487ffbc11ec1df01f49eb34cbc6492 100644 (file)
@@ -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<OfHeader, List<DataObject>> {
 
-       protected static final Logger LOG = LoggerFactory
+    private static final Logger LOG = LoggerFactory
             .getLogger(MultipartReplyTableFeaturesToTableUpdatedTranslator.class);
-       
+
        @Override
        public List<DataObject> 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<DataObject> listDataObject = new CopyOnWriteArrayList<DataObject>();
-            
+
             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();
+
+    }
+
 }