use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OxmUdpDstDeserializer method addUdpDstValue.
private static void addUdpDstValue(ByteBuf input, MatchEntryBuilder builder) {
UdpDstCaseBuilder caseBuilder = new UdpDstCaseBuilder();
UdpDstBuilder udpBuilder = new UdpDstBuilder();
udpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
caseBuilder.setUdpDst(udpBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class TcpDestinationPortEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final int port = message.readUnsignedShort();
if (Objects.isNull(builder.getLayer4Match())) {
builder.setLayer4Match(new TcpMatchBuilder().setTcpDestinationPort(new PortNumber(port)).build());
} else if (TcpMatch.class.isInstance(builder.getLayer4Match()) && Objects.isNull(TcpMatch.class.cast(builder.getLayer4Match()).getTcpDestinationPort())) {
builder.setLayer4Match(new TcpMatchBuilder(TcpMatch.class.cast(builder.getLayer4Match())).setTcpDestinationPort(new PortNumber(port)).build());
} else {
throwErrorOnMalformed(builder, "layer4Match", "tcpDestinationPort");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class SetTpDstActionSerializer method buildAction.
@Override
protected SetFieldCase buildAction(Action input) {
final SetTpDstAction setTpDstAction = SetTpDstActionCase.class.cast(input).getSetTpDstAction();
final PortNumber port = setTpDstAction.getPort();
final SetFieldBuilder builder = new SetFieldBuilder();
Optional.ofNullable(IPProtocols.fromProtocolNum(setTpDstAction.getIpProtocol())).ifPresent(proto -> {
switch(proto) {
case ICMP:
{
builder.setIcmpv4Match(new Icmpv4MatchBuilder().setIcmpv4Code((short) (0xFF & port.getValue())).build());
break;
}
case ICMPV6:
{
builder.setIcmpv6Match(new Icmpv6MatchBuilder().setIcmpv6Code((short) (0xFF & port.getValue())).build());
break;
}
case TCP:
{
builder.setLayer4Match(new TcpMatchBuilder().setTcpDestinationPort(port).build());
break;
}
case UDP:
{
builder.setLayer4Match(new UdpMatchBuilder().setUdpDestinationPort(port).build());
break;
}
default:
}
});
return new SetFieldCaseBuilder().setSetField(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class UdpDstCodec method deserialize.
@Override
public MatchEntry deserialize(ByteBuf message) {
MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
matchEntryBuilder.setHasMask(true);
int portNo = message.readUnsignedShort();
int mask = message.readUnsignedShort();
UdpDstCaseValueBuilder caseBuilder = new UdpDstCaseValueBuilder();
UdpDstValuesBuilder udpDstValuesBuilder = new UdpDstValuesBuilder();
udpDstValuesBuilder.setPort(new PortNumber(portNo));
udpDstValuesBuilder.setMask(mask);
caseBuilder.setUdpDstValues(udpDstValuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class TcpDstCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final TcpDstCaseValueBuilder caseBuilder = new TcpDstCaseValueBuilder();
final TcpDstValuesBuilder valuesBuilder = new TcpDstValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm0Class.class);
matchEntryBuilder.setOxmMatchField(NxmOfTcpDst.class);
matchEntryBuilder.setHasMask(true);
valuesBuilder.setPort(new PortNumber(1));
valuesBuilder.setMask(0xffff);
caseBuilder.setTcpDstValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
Aggregations