use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder in project openflowplugin by opendaylight.
the class TcpSrcConvertor method convert.
@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
TcpSrcCaseValue tcpSrcCaseValue = (TcpSrcCaseValue) input.getMatchEntryValue();
NxmOfTcpSrcBuilder tcpSrcBuilder = new NxmOfTcpSrcBuilder();
tcpSrcBuilder.setPort(tcpSrcCaseValue.getTcpSrcValues().getPort());
tcpSrcBuilder.setMask(tcpSrcCaseValue.getTcpSrcValues().getMask());
return resolveAugmentation(tcpSrcBuilder.build(), path, NxmOfTcpSrcKey.class);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder in project openflowplugin by opendaylight.
the class OxmTcpSrcSerializerTest method prepareMatchEntry.
private static MatchEntryBuilder prepareMatchEntry(int value) {
MatchEntryBuilder builder = prepareHeader(false);
TcpSrcCaseBuilder casebuilder = new TcpSrcCaseBuilder();
TcpSrcBuilder valueBuilder = new TcpSrcBuilder();
valueBuilder.setPort(new PortNumber(value));
casebuilder.setTcpSrc(valueBuilder.build());
builder.setMatchEntryValue(casebuilder.build());
return builder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder in project openflowplugin by opendaylight.
the class SalToOfTcpMatchCase method process.
@Override
public Optional<List<MatchEntry>> process(@Nonnull TcpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getTcpSourcePort() != null) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(TcpSrc.class);
TcpSrcCaseBuilder tcpSrcCaseBuilder = new TcpSrcCaseBuilder();
TcpSrcBuilder tcpSrcBuilder = new TcpSrcBuilder();
tcpSrcBuilder.setPort(source.getTcpSourcePort());
tcpSrcCaseBuilder.setTcpSrc(tcpSrcBuilder.build());
matchEntryBuilder.setMatchEntryValue(tcpSrcCaseBuilder.build());
matchEntryBuilder.setHasMask(false);
result.add(matchEntryBuilder.build());
}
if (source.getTcpDestinationPort() != null) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(TcpDst.class);
TcpDstCaseBuilder tcpDstCaseBuilder = new TcpDstCaseBuilder();
TcpDstBuilder tcpDstBuilder = new TcpDstBuilder();
tcpDstBuilder.setPort(source.getTcpDestinationPort());
tcpDstCaseBuilder.setTcpDst(tcpDstBuilder.build());
matchEntryBuilder.setMatchEntryValue(tcpDstCaseBuilder.build());
matchEntryBuilder.setHasMask(false);
result.add(matchEntryBuilder.build());
}
return Optional.of(result);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder in project openflowplugin by opendaylight.
the class SalToOfSetTpSrcActionCase method process.
@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
IPProtocols protocol = null;
if (data.getIpProtocol() != null) {
protocol = IPProtocols.fromProtocolNum(data.getIpProtocol());
}
SetTpSrcAction settpsrcaction = source.getSetTpSrcAction();
MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
matchBuilder.setOxmClass(OpenflowBasicClass.class);
matchBuilder.setHasMask(false);
int port = settpsrcaction.getPort().getValue();
int type = 0xff & port;
if (protocol != null) {
switch(protocol) {
case ICMP:
matchBuilder.setOxmMatchField(Icmpv4Type.class);
Icmpv4TypeCaseBuilder icmpv4TypeCaseBuilder = new Icmpv4TypeCaseBuilder();
Icmpv4TypeBuilder icmpv4TypeBuilder = new Icmpv4TypeBuilder();
icmpv4TypeBuilder.setIcmpv4Type((short) type);
icmpv4TypeCaseBuilder.setIcmpv4Type(icmpv4TypeBuilder.build());
matchBuilder.setMatchEntryValue(icmpv4TypeCaseBuilder.build());
break;
case ICMPV6:
matchBuilder.setOxmMatchField(Icmpv6Type.class);
Icmpv6TypeCaseBuilder icmpv6TypeCaseBuilder = new Icmpv6TypeCaseBuilder();
Icmpv6TypeBuilder icmpv6TypeBuilder = new Icmpv6TypeBuilder();
icmpv6TypeBuilder.setIcmpv6Type((short) type);
icmpv6TypeCaseBuilder.setIcmpv6Type(icmpv6TypeBuilder.build());
matchBuilder.setMatchEntryValue(icmpv6TypeCaseBuilder.build());
break;
case TCP:
matchBuilder.setOxmMatchField(TcpSrc.class);
TcpSrcCaseBuilder tcpSrcCaseBuilder = new TcpSrcCaseBuilder();
TcpSrcBuilder tcpSrcBuilder = new TcpSrcBuilder();
tcpSrcBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(port));
tcpSrcCaseBuilder.setTcpSrc(tcpSrcBuilder.build());
matchBuilder.setMatchEntryValue(tcpSrcCaseBuilder.build());
break;
case UDP:
matchBuilder.setOxmMatchField(UdpSrc.class);
UdpSrcCaseBuilder udpSrcCaseBuilder = new UdpSrcCaseBuilder();
UdpSrcBuilder udpSrcBuilder = new UdpSrcBuilder();
udpSrcBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(port));
udpSrcCaseBuilder.setUdpSrc(udpSrcBuilder.build());
matchBuilder.setMatchEntryValue(udpSrcCaseBuilder.build());
break;
default:
LOG.warn("Unknown protocol with combination of SetSourcePort: {}", protocol);
break;
}
} else {
LOG.warn("Null protocol with combination of SetSourcePort");
}
List<MatchEntry> entries = new ArrayList<>();
entries.add(matchBuilder.build());
SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
setFieldBuilder.setMatchEntry(entries);
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
setFieldCaseBuilder.setSetFieldAction(setFieldBuilder.build());
return Optional.of(new ActionBuilder().setActionChoice(setFieldCaseBuilder.build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder in project openflowplugin by opendaylight.
the class OxmTcpSrcDeserializer method addTcpSrcValue.
private static void addTcpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
TcpSrcCaseBuilder caseBuilder = new TcpSrcCaseBuilder();
TcpSrcBuilder tcpBuilder = new TcpSrcBuilder();
tcpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
caseBuilder.setTcpSrc(tcpBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
}
Aggregations