use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder in project openflowplugin by opendaylight.
the class MatchResponseConvertor method convert.
@Override
public MatchBuilder convert(MatchEntriesGrouping source, VersionDatapathIdConvertorData datapathIdConvertorData) {
final MatchBuilder matchBuilder = new MatchBuilder();
final MatchResponseConvertorData data = new MatchResponseConvertorData(datapathIdConvertorData.getVersion());
data.setDatapathId(datapathIdConvertorData.getDatapathId());
data.setMatchBuilder(matchBuilder);
data.setEthernetMatchBuilder(new EthernetMatchBuilder());
data.setVlanMatchBuilder(new VlanMatchBuilder());
data.setIpMatchBuilder(new IpMatchBuilder());
data.setTcpMatchBuilder(new TcpMatchBuilder());
data.setUdpMatchBuilder(new UdpMatchBuilder());
data.setSctpMatchBuilder(new SctpMatchBuilder());
data.setIcmpv4MatchBuilder(new Icmpv4MatchBuilder());
data.setIcmpv6MatchBuilder(new Icmpv6MatchBuilder());
data.setIpv4MatchBuilder(new Ipv4MatchBuilder());
data.setIpv4MatchArbitraryBitMaskBuilder(new Ipv4MatchArbitraryBitMaskBuilder());
data.setIpv6MatchArbitraryBitMaskBuilder(new Ipv6MatchArbitraryBitMaskBuilder());
data.setArpMatchBuilder(new ArpMatchBuilder());
data.setIpv6MatchBuilder(new Ipv6MatchBuilder());
data.setProtocolMatchFieldsBuilder(new ProtocolMatchFieldsBuilder());
data.setTunnelIpv4MatchBuilder(new TunnelIpv4MatchBuilder());
data.setTcpFlagsMatchBuilder(new TcpFlagsMatchBuilder());
for (MatchEntry ofMatch : source.getMatchEntry()) {
if (TunnelIpv4Dst.class.isAssignableFrom(ofMatch.getOxmMatchField()) || TunnelIpv4Src.class.isAssignableFrom(ofMatch.getOxmMatchField())) {
/*
* TODO: Fix TunnelIpv4Src and Ipv4Dst, because current implementation do not work
* TunnelIpv4Src and TunnelIpv4Dst are not compatible with
* org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField
* and so you cannot even set them to OxmMatchField.
* Creation of TunnelIpv4SrcCase and TunnelIpv4DstCase in
* org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value
* .grouping.match.entry.value
* and proper use of it can fix this bug.
*/
OF_TO_SAL_TUNNEL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data, getConvertorExecutor());
} else {
data.setOxmMatchField(ofMatch.getOxmMatchField());
OF_TO_SAL_PROCESSOR.process(ofMatch.getMatchEntryValue(), data, getConvertorExecutor());
}
}
return matchBuilder;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder in project openflowplugin by opendaylight.
the class VlanVidEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
final int vlanVidValue = message.readUnsignedShort();
if (hasMask) {
// Skip mask
message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
vlanIdBuilder.setVlanId(new VlanId(0)).setVlanIdPresent(true);
} else {
final boolean vidPresent = (vlanVidValue & (1 << 12)) != 0;
vlanIdBuilder.setVlanId(new VlanId((vidPresent ? vlanVidValue & ((1 << 12) - 1) : vlanVidValue))).setVlanIdPresent(vidPresent);
}
if (Objects.isNull(builder.getVlanMatch())) {
builder.setVlanMatch(new VlanMatchBuilder().setVlanId(vlanIdBuilder.build()).build());
} else if (Objects.isNull(builder.getVlanMatch().getVlanId())) {
builder.setVlanMatch(new VlanMatchBuilder(builder.getVlanMatch()).setVlanId(vlanIdBuilder.build()).build());
} else {
throwErrorOnMalformed(builder, "vlanMatch", "vlanVid");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createAppyActionInstruction36.
private static InstructionsBuilder createAppyActionInstruction36() {
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();
// Vlan
final VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
final VlanMatchBuilder vlanBuilder1 = new VlanMatchBuilder();
final VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
final VlanId vlanId = new VlanId(10);
final VlanPcp vpcp = new VlanPcp((short) 3);
vlanBuilder.setVlanPcp(vpcp);
vlanBuilder1.setVlanId(vlanIdBuilder.setVlanId(vlanId).setVlanIdPresent(true).build());
setFieldBuilder.setVlanMatch(vlanBuilder.build());
setFieldBuilder1.setVlanMatch(vlanBuilder1.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.setKey(new ActionKey(0));
actionList.add(ab.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.VlanMatchBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createVlanMatch.
private static MatchBuilder createVlanMatch() {
final MatchBuilder match = new MatchBuilder();
// vlan match
final VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
final VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
final VlanId vlanId = new VlanId(10);
final VlanPcp vpcp = new VlanPcp((short) 3);
vlanBuilder.setVlanPcp(vpcp);
vlanIdBuilder.setVlanId(vlanId);
vlanIdBuilder.setVlanIdPresent(true);
vlanBuilder.setVlanId(vlanIdBuilder.build());
match.setVlanMatch(vlanBuilder.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder in project openflowplugin by opendaylight.
the class OfToSalVlanVidCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull VlanVidCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final VlanMatchBuilder vlanMatchBuilder = data.getVlanMatchBuilder();
final VlanVid vlanVid = source.getVlanVid();
if (vlanVid != null) {
VlanIdBuilder vlanBuilder = new VlanIdBuilder();
vlanBuilder.setVlanId(new VlanId(vlanVid.getVlanVid()));
vlanBuilder.setVlanIdPresent(vlanVid.isCfiBit());
vlanMatchBuilder.setVlanId(vlanBuilder.build());
matchBuilder.setVlanMatch(vlanMatchBuilder.build());
}
return Optional.of(matchBuilder);
}
Aggregations