Merge "Bug 5916: He plugin: Wake up statistics collector thread if RPC fails."
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / FlowConvertor.java
index aca8cd23537be4a91cf051d24983bc2690f9fbef..fe0ccc1851728d9232e9288ff08ba57ebf2a5ede 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2013-2014 Ericsson. and others.  All rights reserved.
+ * Copyright (c) 2013, 2015 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,
@@ -88,11 +88,11 @@ public class FlowConvertor {
     /**
      * Default idle timeout
      */
-    public static final Integer DEFAULT_IDLE_TIMEOUT = 5 * 60;
+    public static final Integer DEFAULT_IDLE_TIMEOUT = 0;
     /**
      * Default hard timeout
      */
-    public static final Integer DEFAULT_HARD_TIMEOUT = 10 * 60;
+    public static final Integer DEFAULT_HARD_TIMEOUT = 0;
     /**
      * Default priority
      */
@@ -134,6 +134,7 @@ public class FlowConvertor {
      * default match entries - empty
      */
     public static final List<MatchEntry> DEFAULT_MATCH_ENTRIES = new ArrayList<MatchEntry>();
+    private static final Integer PUSH_VLAN = 0x8100;
 
     private static final Ordering<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction> INSTRUCTION_ORDERING =
             Ordering.from(OrderComparator.<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction>build());
@@ -168,6 +169,11 @@ public class FlowConvertor {
      * This method converts the SAL Flow to OF Flow.
      * It checks if there is a set-vlan-id (1.0) action made on OF1.3.
      * If yes its handled separately
+     *
+     * @param srcFlow source flow
+     * @param version openflow version
+     * @param datapathId datapath id
+     * @return list of flow mod build
      */
     public static List<FlowModInputBuilder> toFlowModInputs(Flow srcFlow, short version, BigInteger datapathId) {
         if (version >= OFConstants.OFP_VERSION_1_3 && isSetVlanIdActionCasePresent(srcFlow)) {
@@ -177,7 +183,7 @@ public class FlowConvertor {
         }
     }
 
-    public static FlowModInputBuilder toFlowModInput(Flow flow, short version, BigInteger datapathid) {
+    private static FlowModInputBuilder toFlowModInput(Flow flow, short version, BigInteger datapathid) {
 
         FlowModInputBuilder flowMod = new FlowModInputBuilder();
         salToOFFlowCookie(flow, flowMod);
@@ -532,10 +538,8 @@ public class FlowConvertor {
 
                         pushVlanActionBuilder.setCfi(new VlanCfi(1))
                                 .setVlanId(setVlanIdActionCase.getSetVlanIdAction().getVlanId())
-                                .setEthernetType(sourceFlow.getMatch().getEthernetMatch()
-                                        .getEthernetType().getType().getValue().intValue())
-                                .setTag(sourceFlow.getMatch().getEthernetMatch()
-                                        .getEthernetType().getType().getValue().intValue());
+                                .setEthernetType(PUSH_VLAN)
+                                .setTag(PUSH_VLAN);
                         pushVlanActionCaseBuilder.setPushVlanAction(pushVlanActionBuilder.build());
                         PushVlanActionCase injectedAction = pushVlanActionCaseBuilder.build();