use of org.onosproject.net.flow.criteria.Criterion in project onos by opennetworkinglab.
the class CriterionCodecTest method matchIPv6FlowLabelTest.
/**
* Tests IPv6 flow label criterion.
*/
@Test
public void matchIPv6FlowLabelTest() {
Criterion criterion = Criteria.matchIPv6FlowLabel(0xffffe);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
use of org.onosproject.net.flow.criteria.Criterion in project onos by opennetworkinglab.
the class CriterionCodecTest method matchTcpDstTest.
/**
* Tests destination TCP port criterion.
*/
@Test
public void matchTcpDstTest() {
Criterion criterion = Criteria.matchTcpDst(tpPort);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
use of org.onosproject.net.flow.criteria.Criterion in project onos by opennetworkinglab.
the class CriterionCodecTest method matchTcpSrcTest.
/**
* Tests source TCP port criterion.
*/
@Test
public void matchTcpSrcTest() {
Criterion criterion = Criteria.matchTcpSrc(tpPort);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
use of org.onosproject.net.flow.criteria.Criterion in project onos by opennetworkinglab.
the class CriterionCodecTest method matchPiTypeEncodingTest.
/**
* Tests protocol-independent type criterion encoding.
*/
@Test
public void matchPiTypeEncodingTest() {
PiMatchFieldId ethMatchFieldId = PiMatchFieldId.of("ethernet_t.etherType");
byte[] matchExactBytes1 = { 0x08, 0x00 };
Criterion exactBytesCriterion = PiCriterion.builder().matchExact(ethMatchFieldId, matchExactBytes1).build();
ObjectNode exactResult = criterionCodec.encode(exactBytesCriterion, context);
assertThat(exactResult, matchesCriterion(exactBytesCriterion));
PiMatchFieldId ipv4MatchFieldId = PiMatchFieldId.of("ipv4_t.dstAddr");
int mask = 0x00ffffff;
byte[] matchLpmBytes1 = { 0x0a, 0x01, 0x01, 0x01 };
Criterion lpmBytesCriterion = PiCriterion.builder().matchLpm(ipv4MatchFieldId, matchLpmBytes1, mask).build();
ObjectNode lpmResult = criterionCodec.encode(lpmBytesCriterion, context);
assertThat(lpmResult, matchesCriterion(lpmBytesCriterion));
byte[] matchTernaryBytes1 = { 0x0a, 0x01, 0x01, 0x01 };
byte[] matchTernaryMaskBytes = { 0x7f, 0x7f, 0x7f, 0x00 };
Criterion ternaryBytesCriterion = PiCriterion.builder().matchTernary(ipv4MatchFieldId, matchTernaryBytes1, matchTernaryMaskBytes).build();
ObjectNode ternaryResult = criterionCodec.encode(ternaryBytesCriterion, context);
assertThat(ternaryResult, matchesCriterion(ternaryBytesCriterion));
byte[] matchRangeBytes1 = { 0x10 };
byte[] matchRangeHighBytes = { 0x30 };
Criterion rangeBytesCriterion = PiCriterion.builder().matchRange(ipv4MatchFieldId, matchRangeBytes1, matchRangeHighBytes).build();
ObjectNode rangeResult = criterionCodec.encode(rangeBytesCriterion, context);
assertThat(rangeResult, matchesCriterion(rangeBytesCriterion));
byte[] matchOptionalBytes = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
Criterion optionalBytesCriterion = PiCriterion.builder().matchOptional(ethMatchFieldId, matchOptionalBytes).build();
ObjectNode optionalResult = criterionCodec.encode(optionalBytesCriterion, context);
assertThat(optionalResult, matchesCriterion(optionalBytesCriterion));
}
use of org.onosproject.net.flow.criteria.Criterion in project onos by opennetworkinglab.
the class CriterionCodecTest method matchIPDscpTest.
/**
* Tests IP DSCP criterion.
*/
@Test
public void matchIPDscpTest() {
Criterion criterion = Criteria.matchIPDscp((byte) 63);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
}
Aggregations