use of org.onosproject.net.pi.runtime.PiExactFieldMatch in project onos by opennetworkinglab.
the class PiCriterionTranslatorsTest method testVlanPcpCriterion.
@Test
public void testVlanPcpCriterion() throws Exception {
byte[] vlanPcp = new byte[1];
random.nextBytes(vlanPcp);
int bitWidth = 3;
VlanPcpCriterion criterion = (VlanPcpCriterion) Criteria.matchVlanPcp(vlanPcp[0]);
PiExactFieldMatch exactMatch = (PiExactFieldMatch) translateCriterion(criterion, fieldId, EXACT, bitWidth);
assertThat(exactMatch.value().asReadOnlyBuffer().get(), is(criterion.priority()));
}
use of org.onosproject.net.pi.runtime.PiExactFieldMatch in project onos by opennetworkinglab.
the class PiCriterionTranslatorsTest method testIcmpv6TypeCriterion.
@Test
public void testIcmpv6TypeCriterion() throws Exception {
short icmpv6Type = (short) random.nextInt(256);
int bitWidth = 16;
Icmpv6TypeCriterion criterion = (Icmpv6TypeCriterion) Criteria.matchIcmpv6Type(icmpv6Type);
PiExactFieldMatch exactMatch = (PiExactFieldMatch) translateCriterion(criterion, fieldId, EXACT, bitWidth);
assertThat(exactMatch.value().asReadOnlyBuffer().getShort(), is(criterion.icmpv6Type()));
}
use of org.onosproject.net.pi.runtime.PiExactFieldMatch in project onos by opennetworkinglab.
the class PiCriterionTranslatorsTest method testArpPaCriterion.
@Test
public void testArpPaCriterion() throws Exception {
Ip4Address ip = Ip4Address.valueOf(random.nextInt());
int bitWidth = ip.toOctets().length * 8;
ArpPaCriterion criterion = (ArpPaCriterion) Criteria.matchArpTpa(ip);
PiExactFieldMatch exactMatch = (PiExactFieldMatch) translateCriterion(criterion, fieldId, EXACT, bitWidth);
assertThat(exactMatch.value().asReadOnlyBuffer().getInt(), is(criterion.ip().toInt()));
}
use of org.onosproject.net.pi.runtime.PiExactFieldMatch in project onos by opennetworkinglab.
the class PiCriterionTranslatorsTest method testIPv6FlowLabelCriterion.
@Test
public void testIPv6FlowLabelCriterion() throws Exception {
int flowLabel = random.nextInt();
int bitWidth = 32;
IPv6FlowLabelCriterion criterion = (IPv6FlowLabelCriterion) Criteria.matchIPv6FlowLabel(flowLabel);
PiExactFieldMatch exactMatch = (PiExactFieldMatch) translateCriterion(criterion, fieldId, EXACT, bitWidth);
assertThat(exactMatch.value().asReadOnlyBuffer().getInt(), is(criterion.flowLabel()));
}
use of org.onosproject.net.pi.runtime.PiExactFieldMatch in project onos by opennetworkinglab.
the class PiCriterionTranslatorsTest method testTunnelIdCriterion.
@Test
public void testTunnelIdCriterion() throws Exception {
long tunnelId = random.nextLong();
int bitWidth = 64;
TunnelIdCriterion criterion = (TunnelIdCriterion) Criteria.matchTunnelId(tunnelId);
PiExactFieldMatch exactMatch = (PiExactFieldMatch) translateCriterion(criterion, fieldId, EXACT, bitWidth);
assertThat(exactMatch.value().asReadOnlyBuffer().getLong(), is(criterion.tunnelId()));
}
Aggregations