use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createAppyActionInstruction41.
private static InstructionsBuilder createAppyActionInstruction41() {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final ActionBuilder ab1 = new ActionBuilder();
final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
final SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
// Sctp
final SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
final SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
final PortNumber srcport = new PortNumber(1435);
final PortNumber dstport = new PortNumber(22);
sctpmatch.setSctpSourcePort(srcport);
sctpmatch1.setSctpDestinationPort(dstport);
setFieldBuilder.setLayer4Match(sctpmatch.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.setKey(new ActionKey(0));
actionList.add(ab.build());
setFieldBuilder1.setLayer4Match(sctpmatch1.build());
ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
ab1.setKey(new ActionKey(1));
actionList.add(ab1.build());
final ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
final InstructionBuilder ib = new InstructionBuilder();
ib.setKey(new InstructionKey(0));
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
// Put our Instruction in a list of Instructions
final InstructionsBuilder isb = new InstructionsBuilder();
final List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch in project openflowplugin by opendaylight.
the class TcpDestinationPortEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int tcp = 10;
final Match sctpMatch = new MatchBuilder().setLayer4Match(new TcpMatchBuilder().setTcpDestinationPort(new PortNumber(tcp)).build()).build();
assertMatch(sctpMatch, false, (out) -> assertEquals(out.readUnsignedShort(), tcp));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch in project openflowplugin by opendaylight.
the class TcpSourcePortEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int tcp = 10;
final Match sctpMatch = new MatchBuilder().setLayer4Match(new TcpMatchBuilder().setTcpSourcePort(new PortNumber(tcp)).build()).build();
assertMatch(sctpMatch, false, (out) -> assertEquals(out.readUnsignedShort(), tcp));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch in project openflowplugin by opendaylight.
the class SctpSourcePortEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int sctp = 10;
final Match sctpMatch = new MatchBuilder().setLayer4Match(new SctpMatchBuilder().setSctpSourcePort(new PortNumber(sctp)).build()).build();
assertMatch(sctpMatch, false, (out) -> assertEquals(out.readUnsignedShort(), sctp));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch in project openflowplugin by opendaylight.
the class SalToOfSctpMatchCase method process.
@Override
public Optional<List<MatchEntry>> process(@Nonnull SctpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getSctpSourcePort() != null) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(SctpSrc.class);
SctpSrcCaseBuilder sctpSrcCaseBuilder = new SctpSrcCaseBuilder();
SctpSrcBuilder sctpSrcBuilder = new SctpSrcBuilder();
sctpSrcBuilder.setPort(source.getSctpSourcePort());
sctpSrcCaseBuilder.setSctpSrc(sctpSrcBuilder.build());
matchEntryBuilder.setMatchEntryValue(sctpSrcCaseBuilder.build());
matchEntryBuilder.setHasMask(false);
result.add(matchEntryBuilder.build());
}
if (source.getSctpDestinationPort() != null) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(SctpDst.class);
SctpDstCaseBuilder sctpDstCaseBuilder = new SctpDstCaseBuilder();
SctpDstBuilder sctpDstBuilder = new SctpDstBuilder();
sctpDstBuilder.setPort(source.getSctpDestinationPort());
sctpDstCaseBuilder.setSctpDst(sctpDstBuilder.build());
matchEntryBuilder.setMatchEntryValue(sctpDstCaseBuilder.build());
matchEntryBuilder.setHasMask(false);
result.add(matchEntryBuilder.build());
}
return Optional.of(result);
}
Aggregations