Adding support for TCP flags match via Experimenter Message


Thomas Ferrandiz
 

Hello all,

I'm trying to implement support for TCP flags match using the OF Experimenter Message for a project I'm working on.

The version of ODL I'm using is Beryllium-SR4 which does not seem to have support for this.
However, I saw in the master branch of openflowjava that there was at least a partial implementation.

So what I did was to try to move it into my own module and complete the implementation of the missing parts I could potentially need.
I followed these steps:
1/ Copy openflow-approved-extensions.yang in my module and remove the parts that do not concern the use of TCP flags.
2/ Copy the files AbstractOxmExperimenterMatchEntryDeserializer.java, AbstractOxmExperimenterMatchEntrySerializer.java, OnfOxmTcpFlagsDeserializer.java and OnfOxmTcpFlagsSerializer.java in my module
3/ Register them in SwitchConnectionProvider
In order to do this, I added this in the section 'augment "/config:modules/config:module/config:configuration" ' of the yang declaration of my module:

list openflow-switch-connection-provider {
uses config:service-ref {
refine type {
mandatory true;
config:required-identity openflow-switch-connection-provider:openflow-switch-connection-provider;
}
}
}

And used this code:

private void registerSerializer() {
for (SwitchConnectionProvider provider : providers) {
MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(version,
ExperimenterClass.class, TcpFlags.class);
key.setExperimenterId(EncodeConstants.ONF_EXPERIMENTER_ID);
provider.registerMatchEntrySerializer(key, new OnfOxmTcpFlagsSerializer());

MatchEntryDeserializerKey key2 = new MatchEntryDeserializerKey(version,
OxmMatchConstants.EXPERIMENTER_CLASS, EncodeConstants.ONFOXM_ET_TCP_FLAGS);
key2.setExperimenterId(EncodeConstants.ONF_EXPERIMENTER_ID);
provider.registerMatchEntryDeserializer(key2, new OnfOxmTcpFlagsDeserializer());

}
}

4/ I tried to write the message as follows:

//Flag specific part

TcpFlagsBuilder flagsBuilder = new TcpFlagsBuilder();
flagsBuilder.setFlags(TCP_FLAG_SYN);
TcpFlagsContainerBuilder tcpFlagContainerBuilder = new TcpFlagsContainerBuilder();
tcpFlagContainerBuilder.setTcpFlags(flagsBuilder.build());

ExperimenterIdCaseBuilder expIdCaseBuilder = new ExperimenterIdCaseBuilder();
ExperimenterBuilder expBuilder = new ExperimenterBuilder();
expBuilder.setExperimenter(new ExperimenterId(EncodeConstants.ONF_EXPERIMENTER_ID));
expIdCaseBuilder.setExperimenter(expBuilder.build());
expIdCaseBuilder.addAugmentation(TcpFlagsContainer.class, tcpFlagContainerBuilder.build());

MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(TcpFlags.class);
matchEntryBuilder.setOxmClass(ExperimenterClass.class);
matchEntryBuilder.setMatchEntryValue(expIdCaseBuilder.build());
List<MatchEntry> matchEntries = new ArrayList<>();
MatchEntry me = matchEntryBuilder.build();
matchEntries.add(me);

org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.
rev150203.actions.grouping.ActionBuilder actionBuilder
= new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.
rev150203.actions.grouping.ActionBuilder();

actionBuilder.setActionChoice(setFieldcaseBuilder.build());

The problem comes when I need to add actionBuilder.build() to a list of Action because there are two Action types that are not compatible:

final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList = new ArrayList<>();
actionList.add(actionBuilder.build()); //Does not work

So my question is whether there is a way to convert between the two types of Action?
Or to create an Action of type org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action directly with a TcpFlagsContainer embedded somehow?

Thanks in advance for your help,
Thomas FERRANDIZ

Join {z.archive.openflowjava-dev@lists.opendaylight.org to automatically receive all group messages.