use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpDstCaseBuilder in project openflowplugin by opendaylight.
the class MatchResponseConvertor2Test method testLayer4MatchUdp.
/**
* Test {@link MatchResponseConvertor#convert(MatchEntriesGrouping, VersionDatapathIdConvertorData)}.
*/
@Test
public void testLayer4MatchUdp() {
final MatchBuilder builder = new MatchBuilder();
builder.setType(OxmMatchType.class);
final List<MatchEntry> entries = new ArrayList<>();
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.UdpSrc.class);
entriesBuilder.setHasMask(false);
final UdpSrcCaseBuilder udpSrcCaseBuilder = new UdpSrcCaseBuilder();
final UdpSrcBuilder portBuilder = new UdpSrcBuilder();
portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(11));
udpSrcCaseBuilder.setUdpSrc(portBuilder.build());
entriesBuilder.setMatchEntryValue(udpSrcCaseBuilder.build());
entries.add(entriesBuilder.build());
entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(UdpDst.class);
entriesBuilder.setHasMask(false);
final UdpDstCaseBuilder udpDstCaseBuilder = new UdpDstCaseBuilder();
final UdpDstBuilder udpDstBuilder = new UdpDstBuilder();
udpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(12));
udpDstCaseBuilder.setUdpDst(udpDstBuilder.build());
entriesBuilder.setMatchEntryValue(udpDstCaseBuilder.build());
entries.add(entriesBuilder.build());
builder.setMatchEntry(entries);
final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
datapathIdConvertorData.setDatapathId(new BigInteger("42"));
final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder builtMatch = convert(builder.build(), datapathIdConvertorData);
final UdpMatch udpMatch = (UdpMatch) builtMatch.getLayer4Match();
Assert.assertEquals("Wrong udp src port", 11, udpMatch.getUdpSourcePort().getValue().intValue());
Assert.assertEquals("Wrong udp dst port", 12, udpMatch.getUdpDestinationPort().getValue().intValue());
}
Aggregations