salMatch.setField(new MatchField(MatchType.DL_VLAN,
vlan));
}
- if (ofMatch.getDataLayerVirtualLanPriorityCodePoint() != 0) {
+ if ((ofMatch.getWildcards() & OFMatch.OFPFW_DL_VLAN_PCP) == 0) {
salMatch.setField(MatchType.DL_VLAN_PR, ofMatch
.getDataLayerVirtualLanPriorityCodePoint());
}
salMatch.setField(new MatchField(MatchType.DL_VLAN,
vlan));
}
- if (v6Match.getDataLayerVirtualLanPriorityCodePoint() != 0) {
+ if ((v6Match.getWildcards() & OFMatch.OFPFW_DL_VLAN_PCP) == 0) {
salMatch.setField(MatchType.DL_VLAN_PR, v6Match
.getDataLayerVirtualLanPriorityCodePoint());
}
this.dlVlanIDState = MatchFieldState.MATCH_ABSENT;
}
- if (match.getDataLayerVirtualLanPriorityCodePoint() != 0) {
+ if ((match.getWildcards() & OFMatch.OFPFW_DL_VLAN_PCP) == 0) {
this.setDataLayerVirtualLanPriorityCodePoint(
match.getDataLayerVirtualLanPriorityCodePoint(), (byte) 0);
} else {
// extract the vlan id
super.setDataLayerVirtualLan(getVlanID(firstByte,
secondByte));
- } else {
this.wildcards ^= (1 << 1); // Sync with 0F 1.0 Match
}
if ((this.dataLayerVirtualLanTCIMask & 0xe000) != 0) {
// else if its a vlan pcp mask
// extract the vlan pcp
super.setDataLayerVirtualLanPriorityCodePoint(getVlanPCP(firstByte));
- } else {
this.wildcards ^= (1 << 20);
}
this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_WITH_MASK;
super.setDataLayerVirtualLan(getVlanID(firstByte, secondByte));
this.dlVlanTCIState = MatchFieldState.MATCH_FIELD_ONLY;
this.match_len += 6;
+ this.wildcards ^= (1 << 1); // Sync with 0F 1.0 Match
+ this.wildcards ^= (1 << 20);
}
}
}
// ipv4 dest processing
this.wildcards ^= (((1 << 5) - 1) << 14);
}
- } else {
- this.wildcards = 0;
}
}
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;
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 {
*/
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();
/*
import org.junit.Assert;
import org.junit.Test;
import org.openflow.protocol.OFMatch;
+import org.openflow.util.U32;
public class V6ExtensionTest {
match.fromString("input_port=1");
match.fromString("dl_dst=20:A0:11:10:00:99");
match.fromString("dl_src=00:10:08:22:12:75");
-
match.fromString("ip_src=10.1.1.1");
match.fromString("ip_dst=1.2.3.4");
match.fromString("eth_type=0x800");
match.fromString("dl_vlan=10");
- match.fromString("dl_vpcp=1");
match.fromString("nw_proto=6");
match.fromString("nw_tos=100");
match.fromString("tp_dst=8080");
match.fromString("tp_src=60");
+ match.fromString("dl_vpcp=1");
Assert.assertTrue(match.getInputPort() == 1);
// Assert.assertTrue(match.getIPv6MatchLen()==6);
-
ofm.setInputPort((short) 1);
// V6Match is meant for IPv6, but if using OFMatch, it will be set to
// IPv4 values, as OF1.0 doesn't support IPv6.
ofm.setTransportSource((short) 60);
ofm.setTransportDestination((short) 8080);
+ // this v6match ctor now looks at the wildcard field to
+ // determine if vlan pcp has been set
+ // so set the wildcards appropriately to reflect that vlan pcp
+ // has been set.
+ int wildcards = OFMatch.OFPFW_ALL;
+ wildcards &= ~OFMatch.OFPFW_DL_VLAN_PCP;
+ ofm.setWildcards(U32.t(Long.valueOf(wildcards)));
V6Match match3 = new V6Match(ofm);
Assert.assertTrue(match.getInputPort() == match3.getInputPort());