Bug 1186 - of-flow: pop-mpls-action different in config and operational data store
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / ActionConvertor.java
index efd14bd7fd590ea81adf17855bd489bcdd258164..a5d6a69c9b7422cb484cb4f64eb4b60b6e370eb2 100644 (file)
@@ -735,12 +735,11 @@ public final class ActionConvertor {
 
             } else if (action.getType().equals(
                     org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls.class)) {
-                bucketActions.add(ofToSALPushVlanAction(action));
+                bucketActions.add(ofToSALPushMplsAction(action));
 
             } else if (action.getType().equals(
                     org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopMpls.class)) {
-                PopMplsActionBuilder popMpls = new PopMplsActionBuilder();
-                bucketActions.add(new PopMplsActionCaseBuilder().setPopMplsAction(popMpls.build()).build());
+                bucketActions.add(ofToSALPopMplsAction(action));
 
             } else if (action.getType().equals(
                     org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue.class)) {
@@ -870,6 +869,22 @@ public final class ActionConvertor {
         return new PushMplsActionCaseBuilder().setPushMplsAction(pushMplsAction.build()).build();
     }
 
+    /**
+     * Method converts OF PopMpls action to SAL PopMpls action.
+     *
+     * @param action
+     * @return PopMplsActionCase
+     */
+    public static PopMplsActionCase ofToSALPopMplsAction(Action action) {
+
+        PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
+
+        EthertypeAction etherType = action.getAugmentation(EthertypeAction.class);
+        popMplsAction.setEthernetType(etherType.getEthertype().getValue());
+
+        return new PopMplsActionCaseBuilder().setPopMplsAction(popMplsAction.build()).build();
+    }
+
     /**
      * Method converts OF SetQueue action to SAL SetQueue action.
      *