Implemented Table Feature Multipart RPC 48/3548/3
authorHemaTG <hema.gopalkrishnan@ericsson.com>
Sat, 7 Dec 2013 12:01:31 +0000 (17:31 +0530)
committerGerrit Code Review <gerrit@opendaylight.org>
Sun, 8 Dec 2013 08:22:28 +0000 (08:22 +0000)
Signed-off-by: HemaTG <hema.gopalkrishnan@ericsson.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/ModelDrivenSwitch.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/MDController.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ModelDrivenSwitchImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/TableFeaturesConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/TableFeaturesReplyConvertor.java [new file with mode: 0644]
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTableFeaturesToTableUpdatedTranslator.java [new file with mode: 0644]

index da4954cb4017312cb09f1213d17d72cf23f11420..b8b302a6e1bf9eb10e720de93526716999926335 100644 (file)
@@ -34,6 +34,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.GetP
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.SalPortService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
 import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -44,6 +47,7 @@ public interface ModelDrivenSwitch extends //
         SalFlowService, //
         SalMeterService, //
         SalPortService, //
+        SalTableService,//
         PacketProcessingService, //
         OpendaylightGroupStatisticsService, //
         OpendaylightMeterStatisticsService, //
@@ -91,4 +95,7 @@ public interface ModelDrivenSwitch extends //
     
     @Override
     public Future<RpcResult<UpdatePortOutput>> updatePort(UpdatePortInput input);
+    
+    @Override
+    public Future<RpcResult<UpdateTableOutput>> updateTable(UpdateTableInput input) ;
 }
index d5e7c82c1f6b7e53e6b6a5afca9418a7c9a2b6e0..0b7c52fa9558307137a3e330a51159cce422a954 100644 (file)
@@ -28,11 +28,14 @@ import org.opendaylight.openflowplugin.openflow.md.core.translator.ExperimenterT
 import org.opendaylight.openflowplugin.openflow.md.core.translator.FlowRemovedTranslator;
 import org.opendaylight.openflowplugin.openflow.md.core.translator.MultiPartMessageDescToNodeUpdatedTranslator;
 import org.opendaylight.openflowplugin.openflow.md.core.translator.MultiPartReplyPortToNodeConnectorUpdatedTranslator;
+import org.opendaylight.openflowplugin.openflow.md.core.translator.MultipartReplyTableFeaturesToTableUpdatedTranslator;
 import org.opendaylight.openflowplugin.openflow.md.core.translator.MultipartReplyTranslator;
 import org.opendaylight.openflowplugin.openflow.md.core.translator.PacketInTranslator;
 import org.opendaylight.openflowplugin.openflow.md.core.translator.PortStatusMessageToNodeConnectorUpdatedTranslator;
 import org.opendaylight.openflowplugin.openflow.md.queue.PopListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeErrorNotification;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupFeaturesUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
@@ -49,6 +52,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.TableUpdated;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -98,24 +102,28 @@ public class MDController implements IMDController {
         addMessageTranslator(MultipartReplyMessage.class,OF13, new MultiPartMessageDescToNodeUpdatedTranslator());
         addMessageTranslator(ExperimenterMessage.class, OF10, new ExperimenterTranslator());
         addMessageTranslator(MultipartReplyMessage.class,OF13, new MultipartReplyTranslator());
+        addMessageTranslator(MultipartReplyMessage.class,OF13,new MultipartReplyTableFeaturesToTableUpdatedTranslator());
 
         //TODO: move registration to factory
         NotificationPopListener<DataObject> notificationPopListener = new NotificationPopListener<DataObject>();
+        addMessagePopListener(NodeErrorNotification.class, notificationPopListener);
         addMessagePopListener(NodeConnectorUpdated.class,notificationPopListener);
         addMessagePopListener(PacketReceived.class,notificationPopListener);
         addMessagePopListener(TransmitPacketInput.class, notificationPopListener);
         addMessagePopListener(NodeUpdated.class, notificationPopListener);
-        
+
+        addMessagePopListener(SwitchFlowRemoved.class, notificationPopListener);
+        addMessagePopListener(TableUpdated.class, notificationPopListener);
         //Notification registrations for group-statistics
         addMessagePopListener(GroupStatisticsUpdated.class, notificationPopListener);
         addMessagePopListener(GroupFeaturesUpdated.class, notificationPopListener);
         addMessagePopListener(GroupDescStatsUpdated.class, notificationPopListener);
-        
+
         //Notification registrations for meter-statistics
         addMessagePopListener(MeterStatisticsUpdated.class, notificationPopListener);
         addMessagePopListener(MeterConfigStatsUpdated.class, notificationPopListener);
         addMessagePopListener(MeterFeaturesUpdated.class, notificationPopListener);
-        
+
 
         // Push the updated Listeners to Session Manager which will be then picked up by ConnectionConductor eventually
         OFSessionUtil.getSessionManager().setTranslatorMapping(messageTranslators);
index 1f11e9d583cf660082c32201d6ee8dce5f387b93..22e25f8dba887e9cad71fd8ecd5ad6d964f86a00 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.FlowConver
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.MeterConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.TableFeaturesConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.session.IMessageDispatchService;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
@@ -93,17 +94,23 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.MatchBuilder;
+//import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features.TableFeatures;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterConfigBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features.TableFeatures;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.GetPortOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -860,5 +867,68 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
                        LOG.debug("Returning the Update Group RPC result to MD-SAL");
                        return Futures.immediateFuture(rpcResult);
        
+       }
+       @Override
+       public Future<RpcResult<UpdateTableOutput>> updateTable(
+                       UpdateTableInput input) {
+
+               // Get the Xid. The same Xid has to be sent in all the Multipart requests
+        Long xid = this.getSessionContext().getNextXid();
+
+        LOG.debug("Prepare the Multipart Table Mod requests for Transaction Id {} ",xid);
+
+        // Create multipart request header
+        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
+        mprInput.setType(MultipartType.OFPMPTABLEFEATURES);
+        mprInput.setVersion((short)0x04);
+        mprInput.setXid(xid);
+
+        //Convert the list of all MD-SAL table feature object into OF library object
+        List<TableFeatures> ofTableFeatureList = TableFeaturesConvertor.toTableFeaturesRequest(input.getUpdatedTable()) ;
+        int totalNoOfTableFeatureEntry = ofTableFeatureList.size();
+
+        MultipartRequestTableFeaturesBuilder tableFeaturesRequest = new MultipartRequestTableFeaturesBuilder();
+
+         // Slice the multipart request based on the configuration parameter, which is the no. of TableFeatureList element
+        // to be put in one multipart message. Default is 5
+        // This parameter must be set based on switch's Buffer capacity
+
+        List<TableFeatures> tmpOfTableFeatureList = null ;
+        String tableFeatureListCount = System.getProperty( "of.tableFeaturesCountPerMultipart", "5") ;
+        int noOfEntriesInMPR = Integer.parseInt(tableFeatureListCount) ;
+
+        int index = 0 ;
+        while(totalNoOfTableFeatureEntry-index > 0 ) {
+               if( (totalNoOfTableFeatureEntry-index) > noOfEntriesInMPR ) {
+                       mprInput.setFlags(new MultipartRequestFlags(true));
+                       tmpOfTableFeatureList = ofTableFeatureList.subList(index, index + noOfEntriesInMPR);
+               }
+               else {
+                       // Last multipart request
+                       mprInput.setFlags(new MultipartRequestFlags(false));
+                       tmpOfTableFeatureList = ofTableFeatureList.subList(index, totalNoOfTableFeatureEntry );
+               }
+
+        tableFeaturesRequest.setTableFeatures(tmpOfTableFeatureList) ;
+        //Set request body to main multipart request
+        mprInput.setMultipartRequestBody(tableFeaturesRequest.build());
+
+        //Send the request, no cookies associated, use any connection
+        LOG.debug("Send Table Feature request :{}",tmpOfTableFeatureList);
+        this.messageService.multipartRequest(mprInput.build(), null);
+        index += noOfEntriesInMPR ;
+               tmpOfTableFeatureList = null ; // To avoid any corrupt data
+        }
+      //Extract the Xid only from the Future for the last RPC and
+               // send it back to the NSF
+        LOG.debug("Returning the result and transaction id to NSF");
+        LOG.debug("Return results and transaction id back to caller");
+        UpdateTableOutputBuilder output = new UpdateTableOutputBuilder();
+        output.setTransactionId(generateTransactionId(xid));
+
+        Collection<RpcError> errors = Collections.emptyList();
+        RpcResult<UpdateTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
+        return Futures.immediateFuture(rpcResult);
+
        }
 }
index f7f2f6dc6f7aab6a6ce4fba6231cdec2f269adae..4ea514c13965265847ff8341954ed6b23bd3e7ec 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
@@ -71,6 +72,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeaturePropertyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIdsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlIn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOut;
@@ -118,9 +120,11 @@ import org.slf4j.LoggerFactory;
 public class TableFeaturesConvertor {
     private static final Logger logger = LoggerFactory.getLogger(TableFeaturesConvertor.class);
 
-    public static MultipartRequestTableFeatures toTableFeaturesRequest(
+    public static List<TableFeatures> toTableFeaturesRequest(
             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures salTableFeaturesList) {
-        MultipartRequestTableFeaturesBuilder tableFeaturesRequest = new MultipartRequestTableFeaturesBuilder();
+        if (salTableFeaturesList == null) {
+            return Collections.<TableFeatures> emptyList();
+        }
         List<TableFeatures> ofTableFeaturesList = new ArrayList<>();
         TableFeaturesBuilder ofTableFeatures = new TableFeaturesBuilder();
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures salTableFeatures : salTableFeaturesList
@@ -129,128 +133,130 @@ public class TableFeaturesConvertor {
             ofTableFeatures.setName(salTableFeatures.getName());
             ofTableFeatures.setMetadataMatch(salTableFeatures.getMetadataMatch());
             ofTableFeatures.setMetadataWrite(salTableFeatures.getMetadataWrite());
-            // TODO: setConfig
-            // ofTableFeatures.setConfig(salTableFeatures.getConfig());
+            if (salTableFeatures.getConfig() != null) {
+                ofTableFeatures.setConfig(new TableConfig(salTableFeatures.getConfig().isDEPRECATEDMASK()));
+            }
             ofTableFeatures.setTableFeatureProperties(toTableProperties(salTableFeatures.getTableProperties()));
             ofTableFeaturesList.add(ofTableFeatures.build());
         }
-        tableFeaturesRequest.setTableFeatures(ofTableFeaturesList);
-        return tableFeaturesRequest.build();
+        return ofTableFeaturesList;
     }
 
     private static List<TableFeatureProperties> toTableProperties(
             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TableProperties tableProperties) {
+        if (tableProperties == null) {
+            return Collections.<TableFeatureProperties> emptyList();
+        }
         List<TableFeatureProperties> ofTablePropertiesList = new ArrayList<>();
         TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
-        if (tableProperties != null) {
-            for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties property : tableProperties
-                    .getTableFeatureProperties()) {
-                org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType propType = property
-                        .getTableFeaturePropType();
-                if (propType instanceof Instructions) {
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.Instructions instructions = ((Instructions) propType)
-                            .getInstructions();
-                    setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONS,
-                            (instructions == null) ? new ArrayList<Instruction>() : instructions.getInstruction());
-                } else if (propType instanceof InstructionsMiss) {
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMiss instructions = ((InstructionsMiss) propType)
-                            .getInstructionsMiss();
-                    setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,
-                            (instructions == null) ? new ArrayList<Instruction>() : instructions.getInstruction());
-                } else if (propType instanceof NextTable) {
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.Tables tables = ((NextTable) propType)
-                            .getTables();
-                    setNextTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTNEXTTABLES,
-                            (tables == null) ? new ArrayList<Short>() : tables.getTableIds());
-                } else if (propType instanceof NextTableMiss) {
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.Tables tables = ((NextTableMiss) propType)
-                            .getTables();
-                    setNextTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTNEXTTABLESMISS,
-                            (tables == null) ? new ArrayList<Short>() : tables.getTableIds());
-                } else if (propType instanceof WriteActions) {
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActions writeActions = ((WriteActions) propType)
-                            .getWriteActions();
-                    setActionTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTWRITEACTIONS,
-                            ((writeActions == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>()
-                                    : writeActions.getAction()));
-                } else if (propType instanceof WriteActionsMiss) {
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMiss writeActionsMiss = ((WriteActionsMiss) propType)
-                            .getWriteActionsMiss();
-                    setActionTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
-                            ((writeActionsMiss == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>()
-                                    : writeActionsMiss.getAction()));
-                } else if (propType instanceof ApplyActions) {
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActions applyActions = ((ApplyActions) propType)
-                            .getApplyActions();
-                    setActionTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
-                            ((applyActions == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>()
-                                    : applyActions.getAction()));
-                } else if (propType instanceof ApplyActionsMiss) {
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMiss applyActionsMiss = ((ApplyActionsMiss) propType)
-                            .getApplyActionsMiss();
-                    setActionTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
-                            ((applyActionsMiss == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>()
-                                    : applyActionsMiss.getAction()));
-                } else if (propType instanceof Match) {
-                    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((Match) propType)
-                            .getSetFieldMatch();
-                    setSetFieldTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTMATCH,
-                            ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
-                                    : setFieldMatch));
-                } else if (propType instanceof Wildcards) {
-                    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((Wildcards) propType)
-                            .getSetFieldMatch();
-                    setSetFieldTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTWILDCARDS,
-                            ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
-                                    : setFieldMatch));
-                } else if (propType instanceof WriteSetfield) {
-                    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((WriteSetfield) propType)
-                            .getSetFieldMatch();
-                    setSetFieldTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTWRITEACTIONS,
-                            ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
-                                    : setFieldMatch));
-                } else if (propType instanceof WriteSetfieldMiss) {
-                    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((WriteSetfieldMiss) propType)
-                            .getSetFieldMatch();
-                    setSetFieldTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
-                            ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
-                                    : setFieldMatch));
-                } else if (propType instanceof ApplySetfield) {
-                    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((ApplySetfield) propType)
-                            .getSetFieldMatch();
-                    setSetFieldTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
-                            ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
-                                    : setFieldMatch));
-                } else if (propType instanceof ApplySetfieldMiss) {
-                    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((ApplySetfieldMiss) propType)
-                            .getSetFieldMatch();
-                    setSetFieldTableFeatureProperty(
-                            propBuilder,
-                            TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
-                            ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
-                                    : setFieldMatch));
-                } // Experimenter and Experimeneter miss Table features are
-                  // unhandled
-                ofTablePropertiesList.add(propBuilder.build());
-            }
+
+        for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties property : tableProperties
+                .getTableFeatureProperties()) {
+            org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType propType = property
+                    .getTableFeaturePropType();
+            if (propType instanceof Instructions) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.Instructions instructions = ((Instructions) propType)
+                        .getInstructions();
+                setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONS,
+                        (instructions == null) ? new ArrayList<Instruction>() : instructions.getInstruction());
+            } else if (propType instanceof InstructionsMiss) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMiss instructions = ((InstructionsMiss) propType)
+                        .getInstructionsMiss();
+                setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,
+                        (instructions == null) ? new ArrayList<Instruction>() : instructions.getInstruction());
+            } else if (propType instanceof NextTable) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.Tables tables = ((NextTable) propType)
+                        .getTables();
+                setNextTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTNEXTTABLES,
+                        (tables == null) ? new ArrayList<Short>() : tables.getTableIds());
+            } else if (propType instanceof NextTableMiss) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.Tables tables = ((NextTableMiss) propType)
+                        .getTables();
+                setNextTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTNEXTTABLESMISS,
+                        (tables == null) ? new ArrayList<Short>() : tables.getTableIds());
+            } else if (propType instanceof WriteActions) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActions writeActions = ((WriteActions) propType)
+                        .getWriteActions();
+                setActionTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTWRITEACTIONS,
+                        ((writeActions == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>()
+                                : writeActions.getAction()));
+            } else if (propType instanceof WriteActionsMiss) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMiss writeActionsMiss = ((WriteActionsMiss) propType)
+                        .getWriteActionsMiss();
+                setActionTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
+                        ((writeActionsMiss == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>()
+                                : writeActionsMiss.getAction()));
+            } else if (propType instanceof ApplyActions) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActions applyActions = ((ApplyActions) propType)
+                        .getApplyActions();
+                setActionTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
+                        ((applyActions == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>()
+                                : applyActions.getAction()));
+            } else if (propType instanceof ApplyActionsMiss) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMiss applyActionsMiss = ((ApplyActionsMiss) propType)
+                        .getApplyActionsMiss();
+                setActionTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
+                        ((applyActionsMiss == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action>()
+                                : applyActionsMiss.getAction()));
+            } else if (propType instanceof Match) {
+                List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((Match) propType)
+                        .getSetFieldMatch();
+                setSetFieldTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTMATCH,
+                        ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
+                                : setFieldMatch));
+            } else if (propType instanceof Wildcards) {
+                List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((Wildcards) propType)
+                        .getSetFieldMatch();
+                setSetFieldTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTWILDCARDS,
+                        ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
+                                : setFieldMatch));
+            } else if (propType instanceof WriteSetfield) {
+                List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((WriteSetfield) propType)
+                        .getSetFieldMatch();
+                setSetFieldTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTWRITEACTIONS,
+                        ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
+                                : setFieldMatch));
+            } else if (propType instanceof WriteSetfieldMiss) {
+                List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((WriteSetfieldMiss) propType)
+                        .getSetFieldMatch();
+                setSetFieldTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
+                        ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
+                                : setFieldMatch));
+            } else if (propType instanceof ApplySetfield) {
+                List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((ApplySetfield) propType)
+                        .getSetFieldMatch();
+                setSetFieldTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
+                        ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
+                                : setFieldMatch));
+            } else if (propType instanceof ApplySetfieldMiss) {
+                List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = ((ApplySetfieldMiss) propType)
+                        .getSetFieldMatch();
+                setSetFieldTableFeatureProperty(
+                        propBuilder,
+                        TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
+                        ((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
+                                : setFieldMatch));
+            } // Experimenter and Experimeneter miss Table features are
+              // unhandled
+            ofTablePropertiesList.add(propBuilder.build());
         }
         return ofTablePropertiesList;
     }
@@ -360,10 +366,7 @@ public class TableFeaturesConvertor {
             } else if (actionType instanceof PopPbbAction) {
                 actionBuilder
                         .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb.class);
-            } else if (actionType instanceof ExperimenterAction) {
-                actionBuilder
-                        .setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter.class);
-            }
+            } // Experimenter action is unhandled
             actionList.add(actionListBuilder.setAction(actionBuilder.build()).build());
         }
         ActionRelatedTableFeaturePropertyBuilder propBuilder = new ActionRelatedTableFeaturePropertyBuilder();
diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/TableFeaturesReplyConvertor.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/TableFeaturesReplyConvertor.java
new file mode 100644 (file)
index 0000000..f752848
--- /dev/null
@@ -0,0 +1,463 @@
+/**
+ * Copyright (c) 2013 Ericsson. 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.sal.convertor;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeatureProperty;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.TableFeatureProperties;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TableProperties;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Utility class for converting a OF library table features to MD-SAL table
+ * features.
+ */
+public class TableFeaturesReplyConvertor {
+    private static final Logger logger = LoggerFactory.getLogger(TableFeaturesReplyConvertor.class);
+
+    public static List<TableFeatures> toTableFeaturesReply(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeatures ofTableFeaturesList) {
+        if (ofTableFeaturesList == null || ofTableFeaturesList.getTableFeatures() == null) {
+            return Collections.<TableFeatures> emptyList();
+        }
+        List<TableFeatures> salTableFeaturesList = new ArrayList<>();
+        TableFeaturesBuilder salTableFeatures = new TableFeaturesBuilder();
+        for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features.TableFeatures ofTableFeatures : ofTableFeaturesList
+                .getTableFeatures()) {
+            salTableFeatures.setTableId(ofTableFeatures.getTableId());
+            salTableFeatures.setName(ofTableFeatures.getName());
+            if (ofTableFeatures.getMetadataMatch() != null) {
+                salTableFeatures.setMetadataMatch(new BigInteger(ofTableFeatures.getMetadataMatch()));
+            }
+            if (ofTableFeatures.getMetadataWrite() != null) {
+                salTableFeatures.setMetadataWrite(new BigInteger(ofTableFeatures.getMetadataWrite()));
+            }
+            if (ofTableFeatures.getConfig() != null) {
+                salTableFeatures.setConfig(new TableConfig(ofTableFeatures.getConfig().isOFPTCDEPRECATEDMASK()));
+            }
+            salTableFeatures.setMaxEntries(ofTableFeatures.getMaxEntries());
+            salTableFeatures.setTableProperties(toTableProperties(ofTableFeatures.getTableFeatureProperties()));
+            salTableFeaturesList.add(salTableFeatures.build());
+        }
+        return salTableFeaturesList;
+    }
+
+    private static TableProperties toTableProperties(List<TableFeatureProperties> ofTablePropertiesList) {
+        if (ofTablePropertiesList == null) {
+            return new TablePropertiesBuilder()
+                    .setTableFeatureProperties(
+                            Collections
+                                    .<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties> emptyList())
+                    .build();
+        }
+        List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties> salTablePropertiesList = new ArrayList<>();
+        TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
+        for (TableFeatureProperties property : ofTablePropertiesList) {
+            TableFeaturesPropType propType = property.getType();
+            if (propType != null) {
+                switch (propType) {
+                case OFPTFPTINSTRUCTIONS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder instructionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder();
+                    instructionBuilder
+                            .setInstructions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder()
+                                    .setInstruction(setInstructionTableFeatureProperty(property)).build());
+                    propBuilder.setTableFeaturePropType(instructionBuilder.build());
+                    break;
+                case OFPTFPTINSTRUCTIONSMISS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder instructionMissBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder();
+                    instructionMissBuilder
+                            .setInstructionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder()
+                                    .setInstruction(setInstructionTableFeatureProperty(property)).build());
+                    propBuilder.setTableFeaturePropType(instructionMissBuilder.build());
+                    break;
+                case OFPTFPTNEXTTABLES:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableBuilder nextTableBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableBuilder();
+                    nextTableBuilder
+                            .setTables(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.TablesBuilder()
+                                    .setTableIds(setNextTableFeatureProperty(property)).build());
+                    propBuilder.setTableFeaturePropType(nextTableBuilder.build());
+                    break;
+                case OFPTFPTNEXTTABLESMISS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMissBuilder nextTableMissBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMissBuilder();
+                    nextTableMissBuilder
+                            .setTables(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.TablesBuilder()
+                                    .setTableIds(setNextTableFeatureProperty(property)).build());
+                    propBuilder.setTableFeaturePropType(nextTableMissBuilder.build());
+                    break;
+                case OFPTFPTWRITEACTIONS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder writeActionsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder();
+                    writeActionsBuilder
+                            .setWriteActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActionsBuilder()
+                                    .setAction(setActionTableFeatureProperty(property)).build());
+                    propBuilder.setTableFeaturePropType(writeActionsBuilder.build());
+                    break;
+                case OFPTFPTWRITEACTIONSMISS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMissBuilder writeActionsMissBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMissBuilder();
+                    writeActionsMissBuilder
+                            .setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMissBuilder()
+                                    .setAction(setActionTableFeatureProperty(property)).build());
+                    propBuilder.setTableFeaturePropType(writeActionsMissBuilder.build());
+                    break;
+                case OFPTFPTAPPLYACTIONS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder applyActionsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder();
+                    applyActionsBuilder
+                            .setApplyActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder()
+                                    .setAction(setActionTableFeatureProperty(property)).build());
+                    propBuilder.setTableFeaturePropType(applyActionsBuilder.build());
+                    break;
+                case OFPTFPTAPPLYACTIONSMISS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder applyActionsMissBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder();
+                    applyActionsMissBuilder
+                            .setApplyActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder()
+                                    .setAction(setActionTableFeatureProperty(property)).build());
+                    propBuilder.setTableFeaturePropType(applyActionsMissBuilder.build());
+                    break;
+                case OFPTFPTMATCH:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder matchBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder();
+                    matchBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, true));
+                    propBuilder.setTableFeaturePropType(matchBuilder.build());
+                    break;
+                case OFPTFPTWILDCARDS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WildcardsBuilder wildcardsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WildcardsBuilder();
+                    wildcardsBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
+                    propBuilder.setTableFeaturePropType(wildcardsBuilder.build());
+                    break;
+                case OFPTFPTWRITESETFIELD:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder writeSetfieldBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder();
+                    writeSetfieldBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
+                    propBuilder.setTableFeaturePropType(writeSetfieldBuilder.build());
+                    break;
+                case OFPTFPTWRITESETFIELDMISS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder writeSetfieldMissBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder();
+                    writeSetfieldMissBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
+                    propBuilder.setTableFeaturePropType(writeSetfieldMissBuilder.build());
+                    break;
+                case OFPTFPTAPPLYSETFIELD:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder applySetfieldBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder();
+                    applySetfieldBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
+                    propBuilder.setTableFeaturePropType(applySetfieldBuilder.build());
+                    break;
+                case OFPTFPTAPPLYSETFIELDMISS:
+                    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder applySetfieldMissBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder();
+                    applySetfieldMissBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
+                    propBuilder.setTableFeaturePropType(applySetfieldMissBuilder.build());
+                    break;
+                case OFPTFPTEXPERIMENTER:
+                    // Experimenter Table features are unhandled
+                    break;
+                case OFPTFPTEXPERIMENTERMISS:
+                    // Experimenter miss Table features are unhandled
+                    break;
+                default:
+                    logger.error("Unsupported table feature property : " + propType);
+                    break;
+                }
+                salTablePropertiesList.add(propBuilder.build());
+            }
+        }
+        return new TablePropertiesBuilder().setTableFeatureProperties(salTablePropertiesList).build();
+    }
+
+    private static List<Instruction> setInstructionTableFeatureProperty(TableFeatureProperties properties) {
+        List<Instruction> instructionList = new ArrayList<>();
+        org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder();
+        for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.Instructions currInstruction : properties
+                .getAugmentation(InstructionRelatedTableFeatureProperty.class).getInstructions()) {
+            Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Instruction> currInstructionType = currInstruction
+                    .getType();
+            if (currInstructionType
+                    .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable.class)) {
+                builder.setInstruction((new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableBuilder()
+                        .build()));
+            } else if (currInstructionType
+                    .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata.class)) {
+                builder.setInstruction((new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataBuilder()
+                        .build()));
+            } else if (currInstructionType
+                    .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions.class)) {
+                builder.setInstruction((new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsBuilder()
+                        .build()));
+            } else if (currInstructionType
+                    .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ApplyActions.class)) {
+                builder.setInstruction((new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsBuilder()
+                        .build()));
+            } else if (currInstructionType
+                    .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions.class)) {
+                builder.setInstruction((new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsBuilder()
+                        .build()));
+            } else if (currInstructionType
+                    .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter.class)) {
+                builder.setInstruction((new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterBuilder()
+                        .build()));
+            } else if (currInstructionType
+                    .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Experimenter.class)) {
+                // TODO: Experimenter instructions are unhandled
+            }
+            instructionList.add(builder.build());
+        }
+        return instructionList;
+    }
+
+    private static List<Short> setNextTableFeatureProperty(TableFeatureProperties properties) {
+        List<Short> nextTableIdsList = new ArrayList<>();
+        for (NextTableIds tableId : properties.getAugmentation(NextTableRelatedTableFeatureProperty.class)
+                .getNextTableIds()) {
+            nextTableIdsList.add(tableId.getTableId());
+        }
+        return nextTableIdsList;
+    }
+
+    private static List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> setActionTableFeatureProperty(
+            TableFeatureProperties properties) {
+        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList = new ArrayList<>();
+        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder();
+        for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList currAction : properties
+                .getAugmentation(ActionRelatedTableFeatureProperty.class).getActionsList()) {
+            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action action = currAction
+                    .getAction();
+            if (action != null) {
+                Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Action> actionType = action
+                        .getType();
+                if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output.class)) {
+                    actionBuilder.setAction(new OutputActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group.class)) {
+                    actionBuilder.setAction(new GroupActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut.class)) {
+                    actionBuilder.setAction(new CopyTtlOutBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn.class)) {
+                    actionBuilder.setAction(new CopyTtlInBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl.class)) {
+                    actionBuilder.setAction(new SetMplsTtlActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl.class)) {
+                    actionBuilder.setAction(new DecMplsTtlBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan.class)) {
+                    actionBuilder.setAction(new PushVlanActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan.class)) {
+                    actionBuilder.setAction(new PopVlanActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls.class)) {
+                    actionBuilder.setAction(new PushMplsActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls.class)) {
+                    actionBuilder.setAction(new PopMplsActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue.class)) {
+                    actionBuilder.setAction(new SetQueueActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl.class)) {
+                    actionBuilder.setAction(new SetNwTtlActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl.class)) {
+                    actionBuilder.setAction(new DecNwTtlBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField.class)) {
+                    actionBuilder.setAction(new SetFieldBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb.class)) {
+                    actionBuilder.setAction(new PushPbbActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb.class)) {
+                    actionBuilder.setAction(new PopPbbActionBuilder().build());
+                } else if (actionType
+                        .equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter.class)) {
+                    // TODO: Experimenter Action unhandled.
+                }
+                actionList.add(actionBuilder.build());
+            }
+        }
+        return actionList;
+    }
+
+    private static List<SetFieldMatch> setSetFieldTableFeatureProperty(TableFeatureProperties properties,
+            boolean setHasMask) {
+        List<SetFieldMatch> setFieldMatchList = new ArrayList<>();
+        SetFieldMatchBuilder setFieldMatchBuilder = new SetFieldMatchBuilder();
+        Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField> salMatchField = null;
+        Class<? extends MatchField> ofMatchField = null;
+
+        // This handles only OpenflowBasicClass oxm class.
+        for (MatchEntries currMatch : properties.getAugmentation(OxmRelatedTableFeatureProperty.class)
+                .getMatchEntries()) {
+            ofMatchField = currMatch.getOxmMatchField();
+            if (ofMatchField.equals(ArpOp.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp.class;
+            } else if (ofMatchField.equals(ArpSha.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSha.class;
+            } else if (ofMatchField.equals(ArpSpa.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSpa.class;
+            } else if (ofMatchField.equals(ArpTha.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTha.class;
+            } else if (ofMatchField.equals(ArpTpa.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTpa.class;
+            } else if (ofMatchField.equals(EthDst.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst.class;
+            } else if (ofMatchField.equals(EthSrc.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc.class;
+            } else if (ofMatchField.equals(EthType.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType.class;
+            } else if (ofMatchField.equals(Icmpv4Code.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Code.class;
+            } else if (ofMatchField.equals(Icmpv4Type.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Type.class;
+            } else if (ofMatchField.equals(Icmpv6Code.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Code.class;
+            } else if (ofMatchField.equals(Icmpv6Type.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Type.class;
+            } else if (ofMatchField.equals(InPhyPort.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPhyPort.class;
+            } else if (ofMatchField.equals(InPort.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort.class;
+            } else if (ofMatchField.equals(IpDscp.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpDscp.class;
+            } else if (ofMatchField.equals(IpEcn.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn.class;
+            } else if (ofMatchField.equals(IpProto.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpProto.class;
+            } else if (ofMatchField.equals(Ipv4Dst.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst.class;
+            } else if (ofMatchField.equals(Ipv4Src.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Src.class;
+            } else if (ofMatchField.equals(Ipv6Dst.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Dst.class;
+            } else if (ofMatchField.equals(Ipv6Exthdr.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Exthdr.class;
+            } else if (ofMatchField.equals(Ipv6Flabel.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Flabel.class;
+            } else if (ofMatchField.equals(Ipv6NdSll.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll.class;
+            } else if (ofMatchField.equals(Ipv6NdTarget.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTarget.class;
+            } else if (ofMatchField.equals(Ipv6NdTll.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTll.class;
+            } else if (ofMatchField.equals(Ipv6Src.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Src.class;
+            } else if (ofMatchField.equals(Metadata.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata.class;
+            } else if (ofMatchField.equals(MplsBos.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos.class;
+            } else if (ofMatchField.equals(MplsLabel.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsLabel.class;
+            } else if (ofMatchField.equals(MplsTc.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsTc.class;
+            } else if (ofMatchField.equals(PbbIsid.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.PbbIsid.class;
+            } else if (ofMatchField.equals(SctpDst.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpDst.class;
+            } else if (ofMatchField.equals(SctpSrc.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpSrc.class;
+            } else if (ofMatchField.equals(TcpDst.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpDst.class;
+            } else if (ofMatchField.equals(TcpSrc.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpSrc.class;
+            } else if (ofMatchField.equals(TunnelId.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelId.class;
+            } else if (ofMatchField.equals(UdpDst.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst.class;
+            } else if (ofMatchField.equals(UdpSrc.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc.class;
+            } else if (ofMatchField.equals(VlanPcp.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp.class;
+            } else if (ofMatchField.equals(VlanVid.class)) {
+                salMatchField = org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid.class;
+            }
+
+            setFieldMatchBuilder.setMatchType(salMatchField);
+            if (setHasMask) {
+                setFieldMatchBuilder.setHasMask(currMatch.isHasMask());
+            }
+            setFieldMatchList.add(setFieldMatchBuilder.build());
+        }
+        return setFieldMatchList;
+    }
+
+}
\ No newline at end of file
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
new file mode 100644 (file)
index 0000000..c65f11f
--- /dev/null
@@ -0,0 +1,59 @@
+package org.opendaylight.openflowplugin.openflow.md.core.translator;
+
+import java.math.BigInteger;
+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.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.inventory.rev130819.NodeId;
+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;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.TableUpdatedBuilder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MultipartReplyTableFeaturesToTableUpdatedTranslator implements
+               IMDMessageTranslator<OfHeader, List<DataObject>> {
+
+       protected 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;
+                        
+            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() ))) ;
+            MultipartReplyTableFeatures body = (MultipartReplyTableFeatures) mpReply.getMultipartReplyBody();
+            message.setTableFeatures(TableFeaturesReplyConvertor.toTableFeaturesReply(body)) ;
+            listDataObject.add( message.build()) ;
+            
+            return listDataObject ;
+            
+               }
+               return null;
+               
+       }
+       
+}
+