use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder 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.layer._3.match.ArpMatchBuilder in project openflowplugin by opendaylight.
the class OfToSalArpShaCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull ArpShaCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ArpMatchBuilder arpMatchBuilder = data.getArpMatchBuilder();
ArpSha arpSha = source.getArpSha();
MacAddress macAddress = arpSha.getMacAddress();
if (macAddress != null) {
ArpSourceHardwareAddressBuilder arpSourceHardwareAddressBuilder = new ArpSourceHardwareAddressBuilder();
arpSourceHardwareAddressBuilder.setAddress(macAddress);
byte[] mask = arpSha.getMask();
if (mask != null) {
arpSourceHardwareAddressBuilder.setMask(new MacAddress(ByteBufUtils.macAddressToString(mask)));
}
arpMatchBuilder.setArpSourceHardwareAddress(arpSourceHardwareAddressBuilder.build());
matchBuilder.setLayer3Match(arpMatchBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder in project openflowplugin by opendaylight.
the class ArpSourceTransportAddressEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final Layer3Match layer3Match = builder.getLayer3Match();
final Ipv4Prefix prefix = readPrefix(message, hasMask);
if (Objects.isNull(layer3Match)) {
builder.setLayer3Match(new ArpMatchBuilder().setArpSourceTransportAddress(prefix).build());
} else if (ArpMatch.class.isInstance(layer3Match) && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpSourceTransportAddress())) {
builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match)).setArpSourceTransportAddress(prefix).build());
} else {
throwErrorOnMalformed(builder, "layer3Match", "arpSourceTransportAddress");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder in project openflowplugin by opendaylight.
the class ArpSourceHardwareAddressEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final Layer3Match layer3Match = builder.getLayer3Match();
final ArpSourceHardwareAddressBuilder arpBuilder = new ArpSourceHardwareAddressBuilder().setAddress(OxmDeserializerHelper.convertMacAddress(message));
if (hasMask) {
arpBuilder.setMask(OxmDeserializerHelper.convertMacAddress(message));
}
if (Objects.isNull(layer3Match)) {
builder.setLayer3Match(new ArpMatchBuilder().setArpSourceHardwareAddress(arpBuilder.build()).build());
} else if (ArpMatch.class.isInstance(layer3Match) && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpSourceHardwareAddress())) {
builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match)).setArpSourceHardwareAddress(arpBuilder.build()).build());
} else {
throwErrorOnMalformed(builder, "layer3Match", "arpSourceHardwareAddress");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder in project openflowplugin by opendaylight.
the class ArpTargetHardwareAddressEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final Layer3Match layer3Match = builder.getLayer3Match();
final ArpTargetHardwareAddressBuilder arpBuilder = new ArpTargetHardwareAddressBuilder().setAddress(OxmDeserializerHelper.convertMacAddress(message));
if (hasMask) {
arpBuilder.setMask(OxmDeserializerHelper.convertMacAddress(message));
}
if (Objects.isNull(layer3Match)) {
builder.setLayer3Match(new ArpMatchBuilder().setArpTargetHardwareAddress(arpBuilder.build()).build());
} else if (ArpMatch.class.isInstance(layer3Match) && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpTargetHardwareAddress())) {
builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match)).setArpTargetHardwareAddress(arpBuilder.build()).build());
} else {
throwErrorOnMalformed(builder, "layer3Match", "arpTargetHardwareAddress");
}
}
Aggregations