Handling the case where vlan priority is set to 0.
[controller.git] / opendaylight / protocol_plugins / openflow / src / test / java / org / opendaylight / controller / protocol_plugin / openflow / internal / FlowProgrammerServiceTest.java
index a751948de7d5a73d22696f66a0bcefb15ca82b53..96f0d80022a5be59ea716d46b2cf8c5e26d20f1b 100644 (file)
@@ -18,9 +18,6 @@ import java.util.List;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.protocol_plugin.openflow.vendorextension.v6extension.V6Match;
-import org.openflow.protocol.OFMatch;
-import org.openflow.protocol.action.OFAction;
-
 import org.opendaylight.controller.sal.action.Action;
 import org.opendaylight.controller.sal.action.Flood;
 import org.opendaylight.controller.sal.action.FloodAll;
@@ -46,6 +43,9 @@ import org.opendaylight.controller.sal.utils.EtherTypes;
 import org.opendaylight.controller.sal.utils.IPProtocols;
 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
 import org.opendaylight.controller.sal.utils.NodeCreator;
+import org.openflow.protocol.OFMatch;
+import org.openflow.protocol.action.OFAction;
+import org.openflow.util.U32;
 
 public class FlowProgrammerServiceTest {
 
@@ -298,6 +298,16 @@ public class FlowProgrammerServiceTest {
          */
         FlowConverter salToOF = new FlowConverter(aFlow);
         V6Match v6Match = (V6Match) salToOF.getOFMatch();
+        // need this hardcoding here to make the test pass.
+        // this should not be a problem in actual code.
+        // in the test the sal match is converted to a V6 match.
+        // we lose the wildcard info as the V6 match is used for nicira extensions
+        // and nicira deals with wildcards in a different way.
+        // converting the V6 match back to sal match is not going to preserve the wildcard info.
+        // and we need the wildcard info for reading the vlan pcp now.
+        // when creating a V6Match using the readFrom method
+        // we do convert the nicira extensions format correctly to populate the wildcard info.
+        v6Match.setWildcards(U32.t(Long.valueOf(~OFMatch.OFPFW_DL_VLAN_PCP)));
         List<OFAction> ofActions = salToOF.getOFActions();
 
         /*