use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.dst._case.Ipv6Dst in project openflowplugin by opendaylight.
the class OfToSalIpv6DstCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull Ipv6DstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
final Ipv6MatchArbitraryBitMaskBuilder ipv6MatchArbitraryBitMaskBuilder = data.getIpv6MatchArbitraryBitMaskBuilder();
Ipv6Dst ipv6Dst = source.getIpv6Dst();
if (ipv6Dst != null) {
byte[] mask = ipv6Dst.getMask();
if (mask != null && IpConversionUtil.isIpv6ArbitraryBitMask(mask)) {
if (ipv6MatchBuilder.getIpv6Source() != null) {
Ipv6Prefix ipv6PrefixSourceAddress = ipv6MatchBuilder.getIpv6Source();
Ipv6Address ipv6SrcAddress = IpConversionUtil.extractIpv6Address(ipv6PrefixSourceAddress);
Ipv6ArbitraryMask srcIpv6Arbitrary = IpConversionUtil.compressedIpv6MaskFormat(IpConversionUtil.extractIpv6AddressMask(ipv6PrefixSourceAddress));
setSrcIpv6MatchArbitraryBitMaskBuilderFields(ipv6MatchArbitraryBitMaskBuilder, srcIpv6Arbitrary, IpConversionUtil.compressedIpv6AddressFormat(ipv6SrcAddress));
}
Ipv6ArbitraryMask dstIpv6ArbitraryMask = IpConversionUtil.compressedIpv6MaskFormat(IpConversionUtil.createIpv6ArbitraryBitMask(mask));
Ipv6Address stringIpv6DstAddress = IpConversionUtil.compressedIpv6AddressFormat(ipv6Dst.getIpv6Address());
setDstIpv6MatchArbitraryBitMaskBuilderFields(ipv6MatchArbitraryBitMaskBuilder, dstIpv6ArbitraryMask, stringIpv6DstAddress);
matchBuilder.setLayer3Match(ipv6MatchArbitraryBitMaskBuilder.build());
} else if (ipv6MatchArbitraryBitMaskBuilder.getIpv6SourceAddressNoMask() != null) {
/*
TODO Change comments
Case where source is of type ipv4MatchArbitraryBitMask already exists in Layer3Match,
source which of type ipv6Match needs to be converted to ipv6MatchArbitraryBitMask.
We convert 1::/32 to 1::/FFFF:FFFF::
example:-
<ipv6-destination>1::/32</ipv6-destination>
<ipv6-source-address-no-mask>1::1</ipv6-source-address-no-mask>
<ipv6-source-arbitrary-bitmask>FFFF::0001</ipv6-source-arbitrary-bitmask>
after conversion output example:-
<ipv6-destination-address-no-mask>1::</ipv6-destination-address-no-mask>
<ipv6-destination-arbitrary-bitmask>FFFF:FFFF::</ipv6-destination-arbitrary-bitmask>
<ipv6-source-address-no-mask>1::1</ipv6-source-address-no-mask>
<ipv6-source-arbitrary-bitmask>FFFF::0001</ipv6-source-arbitrary-bitmask>
*/
Ipv6ArbitraryMask dstIpv6ArbitraryMask = IpConversionUtil.compressedIpv6MaskFormat(IpConversionUtil.createIpv6ArbitraryBitMask(mask));
Ipv6Address stringIpv6DstAddress = IpConversionUtil.compressedIpv6AddressFormat(ipv6Dst.getIpv6Address());
setDstIpv6MatchArbitraryBitMaskBuilderFields(ipv6MatchArbitraryBitMaskBuilder, dstIpv6ArbitraryMask, stringIpv6DstAddress);
matchBuilder.setLayer3Match(ipv6MatchArbitraryBitMaskBuilder.build());
} else {
Ipv6Address stringIpv6DstAddress = IpConversionUtil.compressedIpv6AddressFormat(ipv6Dst.getIpv6Address());
setIpv6MatchBuilderFields(ipv6MatchBuilder, mask, stringIpv6DstAddress);
matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
}
}
return Optional.of(matchBuilder);
}
Aggregations