use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder in project openflowplugin by opendaylight.
the class IpEcnEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final short ecn = message.readUnsignedByte();
if (Objects.isNull(builder.getIpMatch())) {
builder.setIpMatch(new IpMatchBuilder().setIpEcn(ecn).build());
} else if (Objects.isNull(builder.getIpMatch().getIpEcn())) {
builder.setIpMatch(new IpMatchBuilder(builder.getIpMatch()).setIpEcn(ecn).build());
} else {
throwErrorOnMalformed(builder, "ipMatch", "ipEcn");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder in project openflowplugin by opendaylight.
the class IpEcnEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final short ecn = (short) 58;
final Match match = new MatchBuilder().setIpMatch(new IpMatchBuilder().setIpEcn(ecn).build()).build();
assertMatch(match, false, (out) -> assertEquals(out.readUnsignedByte(), ecn));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createICMPv6Match.
private static MatchBuilder createICMPv6Match() {
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x86ddL));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
// ipv4 version
final IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 58);
match.setIpMatch(ipmatch.build());
// icmpv6
final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
// match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 1);
match.setIcmpv6Match(icmpv6match.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createL4SCTPMatch.
private static MatchBuilder createL4SCTPMatch() {
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x0800L));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
// ipv4 version
final IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 132);
match.setIpMatch(ipmatch.build());
final SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
final PortNumber srcport = new PortNumber(1435);
final PortNumber dstport = new PortNumber(22);
sctpmatch.setSctpSourcePort(srcport);
sctpmatch.setSctpDestinationPort(dstport);
match.setLayer4Match(sctpmatch.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createToSMatch.
private static MatchBuilder createToSMatch() {
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
final EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
match.setEthernetMatch(ethmatch.build());
// ipv4 version
final IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 6);
final Dscp dscp = new Dscp((short) 8);
ipmatch.setIpDscp(dscp);
match.setIpMatch(ipmatch.build());
return match;
}
Aggregations