use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatch in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createTcpFlagMatch.
/**
* Test match for TCP_Flags.
*
* @return match containing Ethertype (0x0800), IP Protocol (TCP), TCP_Flag (SYN)
*/
// FIXME: move to extensible support
private static MatchBuilder createTcpFlagMatch() {
final MatchBuilder match = new MatchBuilder();
// Ethertype match
final EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x0800L));
ethernetType.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(ethernetType.build());
// TCP Protocol Match
// ipv4 version
final IpMatchBuilder ipMatch = new IpMatchBuilder();
ipMatch.setIpProtocol((short) 6);
match.setIpMatch(ipMatch.build());
// TCP Port Match
final PortNumber dstPort = new PortNumber(80);
final TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
tcpMatch.setTcpDestinationPort(dstPort);
match.setLayer4Match(tcpMatch.build());
/**
* Defined TCP Flag values in OVS v2.1+
* TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
* TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
* TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS 0x100
*/
final TcpFlagsMatchBuilder tcpFlagsMatch = new TcpFlagsMatchBuilder();
tcpFlagsMatch.setTcpFlags(0x002);
match.setTcpFlagsMatch(tcpFlagsMatch.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatch in project openflowplugin by opendaylight.
the class MatchConvertor method tcpFlagsMatch.
private static void tcpFlagsMatch(List<MatchEntry> matchEntryList, TcpFlagsMatch tcpFlagsMatch) {
ExperimenterIdCaseBuilder expIdCaseBuilder = new ExperimenterIdCaseBuilder();
if (tcpFlagsMatch != null) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(ExperimenterClass.class);
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(TcpFlags.class);
TcpFlagsContainerBuilder tcpFlagsContainerBuilder = new TcpFlagsContainerBuilder();
TcpFlagsBuilder tcpFlagsBuilder = new TcpFlagsBuilder();
tcpFlagsBuilder.setFlags(tcpFlagsMatch.getTcpFlags());
if (tcpFlagsMatch.getTcpFlagsMask() != null) {
matchEntryBuilder.setHasMask(true);
tcpFlagsBuilder.setMask(ByteUtil.unsignedShortToBytes(tcpFlagsMatch.getTcpFlagsMask()));
}
tcpFlagsContainerBuilder.setTcpFlags(tcpFlagsBuilder.build());
// Set experimenter ID.
ExperimenterBuilder experimenterBuilder = new ExperimenterBuilder();
experimenterBuilder.setExperimenter(new ExperimenterId(OFApprovedExperimenterIds.MATCH_TCP_FLAGS_EXP_ID));
expIdCaseBuilder.setExperimenter(experimenterBuilder.build());
expIdCaseBuilder.addAugmentation(TcpFlagsContainer.class, tcpFlagsContainerBuilder.build());
matchEntryBuilder.setMatchEntryValue(expIdCaseBuilder.build());
matchEntryList.add(matchEntryBuilder.build());
}
}
Aggregations