@Override
public void consume(final DataObject message) {
- if (Notification.class.isInstance(message)) {
- if (!(DisconnectEvent.class.isInstance(message) || SwitchIdleEvent.class.isInstance(message))) {
+ if (message instanceof Notification) {
+ if (!(message instanceof DisconnectEvent || message instanceof SwitchIdleEvent)) {
statisticsCounters.incrementCounter(CounterEventTypes.US_MESSAGE_PASS);
}
- } else if (OfHeader.class.isInstance(message)) {
+ } else if (message instanceof OfHeader) {
statisticsCounters.incrementCounter(CounterEventTypes.US_MESSAGE_PASS);
}
consumeDeviceMessage(message);
if (message instanceof MultipartReply) {
final Optional<ConvertorExecutor> convertor = Optional.ofNullable(convertorExecutor);
final Optional<TranslatorLibrary> translator = Optional.ofNullable(translatorLibrary);
- final MultipartReply msg = MultipartReply.class.cast(message);
+ final MultipartReply msg = (MultipartReply) message;
final OpenflowVersion ofVersion = OpenflowVersion.get(deviceInfo.getVersion());
final VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(deviceInfo.getVersion());
data.setDatapathId(deviceInfo.getDatapathId());
}
} else if (message instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112
.MultipartReply) {
- return Optional.of(org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112
- .MultipartReply.class.cast(message).getMultipartReplyBody());
+ return Optional.of(((org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112
+ .MultipartReply) message).getMultipartReplyBody());
}
LOG.debug("Failed to translate {} for node {}.", message.getImplementedInterface(), deviceInfo);
if (Objects.nonNull(implementedInterface) && org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service
.rev130709.PacketInMessage.class.equals(implementedInterface)) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709
- .PacketInMessage packetInMessage = org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service
- .rev130709.PacketInMessage.class.cast(message);
+ .PacketInMessage packetInMessage = (org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service
+ .rev130709.PacketInMessage) message;
handlePacketInMessage(packetInMessage, implementedInterface, packetInMessage.getMatch());
return true;
builder.setLayer3Match(new ArpMatchBuilder()
.setArpOp(arpOp)
.build());
- } else if (ArpMatch.class.isInstance(layer3Match)
- && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpOp())) {
- builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match))
+ } else if (layer3Match instanceof ArpMatch
+ && Objects.isNull(((ArpMatch) layer3Match).getArpOp())) {
+ builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
.setArpOp(arpOp)
.build());
} else {
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))
+ } else if (layer3Match instanceof ArpMatch
+ && Objects.isNull(((ArpMatch) layer3Match).getArpSourceHardwareAddress())) {
+ builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
.setArpSourceHardwareAddress(arpBuilder.build())
.build());
} else {
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))
+ } else if (layer3Match instanceof ArpMatch
+ && Objects.isNull(((ArpMatch) layer3Match).getArpSourceTransportAddress())) {
+ builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
.setArpSourceTransportAddress(prefix)
.build());
} else {
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))
+ } else if (layer3Match instanceof ArpMatch
+ && Objects.isNull(((ArpMatch) layer3Match).getArpTargetHardwareAddress())) {
+ builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
.setArpTargetHardwareAddress(arpBuilder.build())
.build());
} else {
builder.setLayer3Match(new ArpMatchBuilder()
.setArpTargetTransportAddress(prefix)
.build());
- } else if (ArpMatch.class.isInstance(layer3Match)
- && Objects.isNull(ArpMatch.class.cast(layer3Match).getArpTargetTransportAddress())) {
- builder.setLayer3Match(new ArpMatchBuilder(ArpMatch.class.cast(layer3Match))
+ } else if (layer3Match instanceof ArpMatch
+ && Objects.isNull(((ArpMatch) layer3Match).getArpTargetTransportAddress())) {
+ builder.setLayer3Match(new ArpMatchBuilder((ArpMatch) layer3Match)
.setArpTargetTransportAddress(prefix)
.build());
} else {
builder.setLayer3Match(new Ipv4MatchBuilder()
.setIpv4Destination(IpConversionUtil.createPrefix(address, mask))
.build());
- } else if (Ipv4Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv4Match.class.cast(builder.getLayer3Match()).getIpv4Destination())) {
- builder.setLayer3Match(new Ipv4MatchBuilder(Ipv4Match.class.cast(builder.getLayer3Match()))
+ } else if (builder.getLayer3Match() instanceof Ipv4Match
+ && Objects.isNull(((Ipv4Match) builder.getLayer3Match()).getIpv4Destination())) {
+ builder.setLayer3Match(new Ipv4MatchBuilder((Ipv4Match) builder.getLayer3Match())
.setIpv4Destination(IpConversionUtil.createPrefix(address, mask))
.build());
} else {
.setIpv4DestinationAddressNoMask(address)
.setIpv4DestinationArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
.build());
- } else if (Ipv4MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+ } else if (builder.getLayer3Match() instanceof Ipv4MatchArbitraryBitMask
+ && Objects.isNull(((Ipv4MatchArbitraryBitMask) builder.getLayer3Match())
.getIpv4DestinationAddressNoMask())) {
- builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder(Ipv4MatchArbitraryBitMask.class.cast(builder
- .getLayer3Match()))
+ builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder((Ipv4MatchArbitraryBitMask) builder
+ .getLayer3Match())
.setIpv4DestinationAddressNoMask(address)
.setIpv4DestinationArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
.build());
builder.setLayer3Match(new Ipv4MatchBuilder()
.setIpv4Source(IpConversionUtil.createPrefix(address, mask))
.build());
- } else if (Ipv4Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv4Match.class.cast(builder.getLayer3Match()).getIpv4Source())) {
- builder.setLayer3Match(new Ipv4MatchBuilder(Ipv4Match.class.cast(builder.getLayer3Match()))
+ } else if (builder.getLayer3Match() instanceof Ipv4Match
+ && Objects.isNull(((Ipv4Match) builder.getLayer3Match()).getIpv4Source())) {
+ builder.setLayer3Match(new Ipv4MatchBuilder((Ipv4Match) builder.getLayer3Match())
.setIpv4Source(IpConversionUtil.createPrefix(address, mask))
.build());
} else {
.setIpv4SourceAddressNoMask(address)
.setIpv4SourceArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
.build());
- } else if (Ipv4MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+ } else if (builder.getLayer3Match() instanceof Ipv4MatchArbitraryBitMask
+ && Objects.isNull(((Ipv4MatchArbitraryBitMask) builder.getLayer3Match())
.getIpv4SourceAddressNoMask())) {
- builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder(Ipv4MatchArbitraryBitMask.class.cast(builder
- .getLayer3Match()))
+ builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder((Ipv4MatchArbitraryBitMask) builder
+ .getLayer3Match())
.setIpv4SourceAddressNoMask(address)
.setIpv4SourceArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
.build());
builder.setLayer3Match(new Ipv6MatchBuilder()
.setIpv6Destination(IpConversionUtil.createPrefix(address, mask))
.build());
- } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Destination())) {
- builder.setLayer3Match(new Ipv6MatchBuilder(Ipv6Match.class.cast(builder.getLayer3Match()))
+ } else if (builder.getLayer3Match() instanceof Ipv6Match
+ && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6Destination())) {
+ builder.setLayer3Match(new Ipv6MatchBuilder((Ipv6Match) builder.getLayer3Match())
.setIpv6Destination(IpConversionUtil.createPrefix(address, mask))
.build());
} else {
.setIpv6DestinationAddressNoMask(address)
.setIpv6DestinationArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
.build());
- } else if (Ipv6MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+ } else if (builder.getLayer3Match() instanceof Ipv6MatchArbitraryBitMask
+ && Objects.isNull(((Ipv6MatchArbitraryBitMask) builder.getLayer3Match())
.getIpv6DestinationAddressNoMask())) {
- final Ipv6MatchArbitraryBitMask match = Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match());
+ final Ipv6MatchArbitraryBitMask match = (Ipv6MatchArbitraryBitMask) builder.getLayer3Match();
builder.setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder(match)
.setIpv6DestinationAddressNoMask(address)
.setIpv6DestinationArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
builder.setLayer3Match(new Ipv6MatchBuilder()
.setIpv6ExtHeader(extHeaderBuilder.build())
.build());
- } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6ExtHeader())) {
- final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+ } else if (builder.getLayer3Match() instanceof Ipv6Match
+ && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6ExtHeader())) {
+ final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
builder.setLayer3Match(new Ipv6MatchBuilder(match)
.setIpv6ExtHeader(extHeaderBuilder.build())
.build());
builder.setLayer3Match(new Ipv6MatchBuilder()
.setIpv6Label(ipv6labelBuilder.build())
.build());
- } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Label())) {
- final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+ } else if (builder.getLayer3Match() instanceof Ipv6Match
+ && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6Label())) {
+ final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
builder.setLayer3Match(new Ipv6MatchBuilder(match)
.setIpv6Label(ipv6labelBuilder.build())
.build());
builder.setLayer3Match(new Ipv6MatchBuilder()
.setIpv6NdSll(address)
.build());
- } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdSll())) {
- final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+ } else if (builder.getLayer3Match() instanceof Ipv6Match
+ && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6NdSll())) {
+ final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
builder.setLayer3Match(new Ipv6MatchBuilder(match)
.setIpv6NdSll(address)
.build());
builder.setLayer3Match(new Ipv6MatchBuilder()
.setIpv6NdTarget(address)
.build());
- } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdTarget())) {
- final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+ } else if (builder.getLayer3Match() instanceof Ipv6Match
+ && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6NdTarget())) {
+ final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
builder.setLayer3Match(new Ipv6MatchBuilder(match)
.setIpv6NdTarget(address)
.build());
builder.setLayer3Match(new Ipv6MatchBuilder()
.setIpv6NdTll(address)
.build());
- } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdTll())) {
- final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
+ } else if (builder.getLayer3Match() instanceof Ipv6Match
+ && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6NdTll())) {
+ final Ipv6Match match = (Ipv6Match) builder.getLayer3Match();
builder.setLayer3Match(new Ipv6MatchBuilder(match)
.setIpv6NdTll(address)
.build());
builder.setLayer3Match(new Ipv6MatchBuilder()
.setIpv6Source(IpConversionUtil.createPrefix(address, mask))
.build());
- } else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Source())) {
- builder.setLayer3Match(new Ipv6MatchBuilder(Ipv6Match.class.cast(builder.getLayer3Match()))
+ } else if (builder.getLayer3Match() instanceof Ipv6Match
+ && Objects.isNull(((Ipv6Match) builder.getLayer3Match()).getIpv6Source())) {
+ builder.setLayer3Match(new Ipv6MatchBuilder((Ipv6Match) builder.getLayer3Match())
.setIpv6Source(IpConversionUtil.createPrefix(address, mask))
.build());
} else {
.setIpv6SourceAddressNoMask(address)
.setIpv6SourceArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
.build());
- } else if (Ipv6MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+ } else if (builder.getLayer3Match() instanceof Ipv6MatchArbitraryBitMask
+ && Objects.isNull(((Ipv6MatchArbitraryBitMask) builder.getLayer3Match())
.getIpv6SourceAddressNoMask())) {
- final Ipv6MatchArbitraryBitMask match = Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match());
+ final Ipv6MatchArbitraryBitMask match = (Ipv6MatchArbitraryBitMask) builder.getLayer3Match();
builder.setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder(match)
.setIpv6SourceAddressNoMask(address)
.setIpv6SourceArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
builder.setLayer4Match(new SctpMatchBuilder()
.setSctpDestinationPort(new PortNumber(port))
.build());
- } else if (SctpMatch.class.isInstance(builder.getLayer4Match())
- && Objects.isNull(SctpMatch.class.cast(builder.getLayer4Match()).getSctpDestinationPort())) {
- builder.setLayer4Match(new SctpMatchBuilder(SctpMatch.class.cast(builder.getLayer4Match()))
+ } else if (builder.getLayer4Match() instanceof SctpMatch
+ && Objects.isNull(((SctpMatch) builder.getLayer4Match()).getSctpDestinationPort())) {
+ builder.setLayer4Match(new SctpMatchBuilder((SctpMatch) builder.getLayer4Match())
.setSctpDestinationPort(new PortNumber(port))
.build());
} else {
builder.setLayer4Match(new SctpMatchBuilder()
.setSctpSourcePort(new PortNumber(port))
.build());
- } else if (SctpMatch.class.isInstance(builder.getLayer4Match())
- && Objects.isNull(SctpMatch.class.cast(builder.getLayer4Match()).getSctpSourcePort())) {
- builder.setLayer4Match(new SctpMatchBuilder(SctpMatch.class.cast(builder.getLayer4Match()))
+ } else if (builder.getLayer4Match() instanceof SctpMatch
+ && Objects.isNull(((SctpMatch) builder.getLayer4Match()).getSctpSourcePort())) {
+ builder.setLayer4Match(new SctpMatchBuilder((SctpMatch) builder.getLayer4Match())
.setSctpSourcePort(new PortNumber(port))
.build());
} else {
builder.setLayer4Match(new TcpMatchBuilder()
.setTcpDestinationPort(new PortNumber(port))
.build());
- } else if (TcpMatch.class.isInstance(builder.getLayer4Match())
- && Objects.isNull(TcpMatch.class.cast(builder.getLayer4Match()).getTcpDestinationPort())) {
- builder.setLayer4Match(new TcpMatchBuilder(TcpMatch.class.cast(builder.getLayer4Match()))
+ } else if (builder.getLayer4Match() instanceof TcpMatch
+ && Objects.isNull(((TcpMatch) builder.getLayer4Match()).getTcpDestinationPort())) {
+ builder.setLayer4Match(new TcpMatchBuilder((TcpMatch) builder.getLayer4Match())
.setTcpDestinationPort(new PortNumber(port))
.build());
} else {
builder.setLayer4Match(new TcpMatchBuilder()
.setTcpSourcePort(new PortNumber(port))
.build());
- } else if (TcpMatch.class.isInstance(builder.getLayer4Match())
- && Objects.isNull(TcpMatch.class.cast(builder.getLayer4Match()).getTcpSourcePort())) {
- builder.setLayer4Match(new TcpMatchBuilder(TcpMatch.class.cast(builder.getLayer4Match()))
+ } else if (builder.getLayer4Match() instanceof TcpMatch
+ && Objects.isNull(((TcpMatch) builder.getLayer4Match()).getTcpSourcePort())) {
+ builder.setLayer4Match(new TcpMatchBuilder((TcpMatch) builder.getLayer4Match())
.setTcpSourcePort(new PortNumber(port))
.build());
} else {
builder.setLayer4Match(new UdpMatchBuilder()
.setUdpDestinationPort(new PortNumber(port))
.build());
- } else if (UdpMatch.class.isInstance(builder.getLayer4Match())
- && Objects.isNull(UdpMatch.class.cast(builder.getLayer4Match()).getUdpDestinationPort())) {
- builder.setLayer4Match(new UdpMatchBuilder(UdpMatch.class.cast(builder.getLayer4Match()))
+ } else if (builder.getLayer4Match() instanceof UdpMatch
+ && Objects.isNull(((UdpMatch) builder.getLayer4Match()).getUdpDestinationPort())) {
+ builder.setLayer4Match(new UdpMatchBuilder((UdpMatch) builder.getLayer4Match())
.setUdpDestinationPort(new PortNumber(port))
.build());
} else {
builder.setLayer4Match(new UdpMatchBuilder()
.setUdpSourcePort(new PortNumber(port))
.build());
- } else if (UdpMatch.class.isInstance(builder.getLayer4Match())
- && Objects.isNull(UdpMatch.class.cast(builder.getLayer4Match()).getUdpSourcePort())) {
- builder.setLayer4Match(new UdpMatchBuilder(UdpMatch.class.cast(builder.getLayer4Match()))
+ } else if (builder.getLayer4Match() instanceof UdpMatch
+ && Objects.isNull(((UdpMatch) builder.getLayer4Match()).getUdpSourcePort())) {
+ builder.setLayer4Match(new UdpMatchBuilder((UdpMatch) builder.getLayer4Match())
.setUdpSourcePort(new PortNumber(port))
.build());
} else {
.setSetField(new SetFieldBuilder()
.setEthernetMatch(new EthernetMatchBuilder()
.setEthernetDestination(new EthernetDestinationBuilder()
- .setAddress(SetDlDstActionCase.class.cast(input).getSetDlDstAction()
+ .setAddress(((SetDlDstActionCase) input).getSetDlDstAction()
.getAddress())
.build())
.build())
.setSetField(new SetFieldBuilder()
.setEthernetMatch(new EthernetMatchBuilder()
.setEthernetSource(new EthernetSourceBuilder()
- .setAddress(SetDlSrcActionCase.class.cast(input).getSetDlSrcAction()
+ .setAddress(((SetDlSrcActionCase) input).getSetDlSrcAction()
.getAddress())
.build())
.build())
@Override
protected SetFieldCase buildAction(Action input) {
- final Address address = SetNwDstActionCase.class.cast(input).getSetNwDstAction().getAddress();
+ final Address address = ((SetNwDstActionCase) input).getSetNwDstAction().getAddress();
final SetFieldBuilder builder = new SetFieldBuilder();
- if (Ipv4.class.isInstance(address)) {
+ if (address instanceof Ipv4) {
builder.setLayer3Match(new Ipv4MatchBuilder()
- .setIpv4Destination(Ipv4.class.cast(address).getIpv4Address())
+ .setIpv4Destination(((Ipv4) address).getIpv4Address())
.build());
- } else if (Ipv6.class.isInstance(address)) {
+ } else if (address instanceof Ipv6) {
builder.setLayer3Match(new Ipv6MatchBuilder()
- .setIpv6Destination(Ipv6.class.cast(address).getIpv6Address())
+ .setIpv6Destination(((Ipv6) address).getIpv6Address())
.build());
}
@Override
protected SetFieldCase buildAction(Action input) {
- final Address address = SetNwSrcActionCase.class.cast(input).getSetNwSrcAction().getAddress();
+ final Address address = ((SetNwSrcActionCase) input).getSetNwSrcAction().getAddress();
final SetFieldBuilder builder = new SetFieldBuilder();
- if (Ipv4.class.isInstance(address)) {
+ if (address instanceof Ipv4) {
builder.setLayer3Match(new Ipv4MatchBuilder()
- .setIpv4Source(Ipv4.class.cast(address).getIpv4Address())
+ .setIpv4Source(((Ipv4) address).getIpv4Address())
.build());
- } else if (Ipv6.class.isInstance(address)) {
+ } else if (address instanceof Ipv6) {
builder.setLayer3Match(new Ipv6MatchBuilder()
- .setIpv6Source(Ipv6.class.cast(address).getIpv6Address())
+ .setIpv6Source(((Ipv6) address).getIpv6Address())
.build());
}
.setSetField(new SetFieldBuilder()
.setIpMatch(new IpMatchBuilder()
.setIpDscp(new Dscp(
- ActionUtil.tosToDscp(SetNwTosActionCase.class.cast(input)
+ ActionUtil.tosToDscp(((SetNwTosActionCase) input)
.getSetNwTosAction().getTos().shortValue())))
.build())
.build())
@Override
protected SetFieldCase buildAction(Action input) {
- final SetTpDstAction setTpDstAction = SetTpDstActionCase.class.cast(input).getSetTpDstAction();
+ final SetTpDstAction setTpDstAction = ((SetTpDstActionCase) input).getSetTpDstAction();
final PortNumber port = setTpDstAction.getPort();
final SetFieldBuilder builder = new SetFieldBuilder();
@Override
protected SetFieldCase buildAction(Action input) {
- final SetTpSrcAction setTpSrcAction = SetTpSrcActionCase.class.cast(input).getSetTpSrcAction();
+ final SetTpSrcAction setTpSrcAction = ((SetTpSrcActionCase) input).getSetTpSrcAction();
final PortNumber port = setTpSrcAction.getPort();
final SetFieldBuilder builder = new SetFieldBuilder();
.setVlanMatch(new VlanMatchBuilder()
.setVlanId(new VlanIdBuilder()
.setVlanIdPresent(true)
- .setVlanId(SetVlanIdActionCase.class.cast(input).getSetVlanIdAction()
+ .setVlanId(((SetVlanIdActionCase) input).getSetVlanIdAction()
.getVlanId())
.build())
.build())
return new SetFieldCaseBuilder()
.setSetField(new SetFieldBuilder()
.setVlanMatch(new VlanMatchBuilder()
- .setVlanPcp((SetVlanPcpActionCase.class.cast(input).getSetVlanPcpAction().getVlanPcp()))
+ .setVlanPcp((((SetVlanPcpActionCase) input).getSetVlanPcpAction().getVlanPcp()))
.build())
.build())
.build();
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- outBuffer.writeShort(ArpMatch.class.cast(match.getLayer3Match()).getArpOp());
+ outBuffer.writeShort(((ArpMatch) match.getLayer3Match()).getArpOp());
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && ArpMatch.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpOp());
+ && match.getLayer3Match() instanceof ArpMatch
+ && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpOp());
}
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
final ArpSourceHardwareAddress arpSourceHardwareAddress =
- ArpMatch.class.cast(match.getLayer3Match()).getArpSourceHardwareAddress();
+ ((ArpMatch) match.getLayer3Match()).getArpSourceHardwareAddress();
writeMacAddress(arpSourceHardwareAddress.getAddress(), outBuffer);
if (getHasMask(match)) {
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && ArpMatch.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceHardwareAddress());
+ && match.getLayer3Match() instanceof ArpMatch
+ && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpSourceHardwareAddress());
}
@Override
protected boolean getHasMask(Match match) {
- return Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceHardwareAddress().getMask());
+ return Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpSourceHardwareAddress().getMask());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- writeIpv4Prefix(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceTransportAddress(), outBuffer);
+ writeIpv4Prefix(((ArpMatch) match.getLayer3Match()).getArpSourceTransportAddress(), outBuffer);
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && ArpMatch.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceTransportAddress());
+ && match.getLayer3Match() instanceof ArpMatch
+ && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpSourceTransportAddress());
}
@Override
protected boolean getHasMask(Match match) {
// Split address to IP and mask
final Iterator<String> addressParts = IpConversionUtil.splitToParts(
- ArpMatch.class.cast(match.getLayer3Match()).getArpSourceTransportAddress());
+ ((ArpMatch) match.getLayer3Match()).getArpSourceTransportAddress());
addressParts.next();
// Check if we have mask
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
final ArpTargetHardwareAddress arpTargetHardwareAddress =
- ArpMatch.class.cast(match.getLayer3Match()).getArpTargetHardwareAddress();
+ ((ArpMatch) match.getLayer3Match()).getArpTargetHardwareAddress();
writeMacAddress(arpTargetHardwareAddress.getAddress(), outBuffer);
if (getHasMask(match)) {
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && ArpMatch.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetHardwareAddress());
+ && match.getLayer3Match() instanceof ArpMatch
+ && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpTargetHardwareAddress());
}
@Override
protected boolean getHasMask(Match match) {
- return Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetHardwareAddress().getMask());
+ return Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpTargetHardwareAddress().getMask());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- writeIpv4Prefix(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetTransportAddress(), outBuffer);
+ writeIpv4Prefix(((ArpMatch) match.getLayer3Match()).getArpTargetTransportAddress(), outBuffer);
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && ArpMatch.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetTransportAddress());
+ && match.getLayer3Match() instanceof ArpMatch
+ && Objects.nonNull(((ArpMatch) match.getLayer3Match()).getArpTargetTransportAddress());
}
@Override
protected boolean getHasMask(Match match) {
// Split address to IP and mask
final Iterator<String> addressParts = IpConversionUtil.splitToParts(
- ArpMatch.class.cast(match.getLayer3Match()).getArpTargetTransportAddress());
+ ((ArpMatch) match.getLayer3Match()).getArpTargetTransportAddress());
addressParts.next();
// Check if we have mask
super.serialize(match, outBuffer);
if (isPrefix(match)) {
- writeIpv4Prefix(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Destination(), outBuffer);
+ writeIpv4Prefix(((Ipv4Match) match.getLayer3Match()).getIpv4Destination(), outBuffer);
} else if (isArbitrary(match)) {
- final Ipv4MatchArbitraryBitMask ipv4 = Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match());
+ final Ipv4MatchArbitraryBitMask ipv4 = (Ipv4MatchArbitraryBitMask) match.getLayer3Match();
writeIpv4Address(ipv4.getIpv4DestinationAddressNoMask(), outBuffer);
if (getHasMask(match)) {
public boolean matchTypeCheck(Match match) {
if (isPrefix(match)) {
return Objects.nonNull(match.getLayer3Match())
- && Objects.nonNull(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Destination());
+ && Objects.nonNull(((Ipv4Match) match.getLayer3Match()).getIpv4Destination());
} else if (isArbitrary(match)) {
return Objects.nonNull(match.getLayer3Match())
- && Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ && Objects.nonNull(((Ipv4MatchArbitraryBitMask) match.getLayer3Match())
.getIpv4DestinationAddressNoMask());
}
if (isPrefix(match)) {
// Split address to IP and mask
final Iterator<String> addressParts = IpConversionUtil.splitToParts(
- Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Destination());
+ ((Ipv4Match) match.getLayer3Match()).getIpv4Destination());
addressParts.next();
// Check if we have mask
return addressParts.hasNext() && Integer.parseInt(addressParts.next()) < 32;
} else if (isArbitrary(match)) {
- return Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ return Objects.nonNull(((Ipv4MatchArbitraryBitMask) match.getLayer3Match())
.getIpv4DestinationArbitraryBitmask());
}
}
private static boolean isPrefix(Match match) {
- return Ipv4Match.class.isInstance(match.getLayer3Match());
+ return match.getLayer3Match() instanceof Ipv4Match;
}
private static boolean isArbitrary(Match match) {
- return Ipv4MatchArbitraryBitMask.class.isInstance(match.getLayer3Match());
+ return match.getLayer3Match() instanceof Ipv4MatchArbitraryBitMask;
}
@Override
super.serialize(match, outBuffer);
if (isPrefix(match)) {
- writeIpv4Prefix(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Source(), outBuffer);
+ writeIpv4Prefix(((Ipv4Match) match.getLayer3Match()).getIpv4Source(), outBuffer);
} else if (isArbitrary(match)) {
- final Ipv4MatchArbitraryBitMask ipv4 = Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match());
+ final Ipv4MatchArbitraryBitMask ipv4 = (Ipv4MatchArbitraryBitMask) match.getLayer3Match();
writeIpv4Address(ipv4.getIpv4SourceAddressNoMask(), outBuffer);
if (getHasMask(match)) {
public boolean matchTypeCheck(Match match) {
if (isPrefix(match)) {
return Objects.nonNull(match.getLayer3Match())
- && Objects.nonNull(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Source());
+ && Objects.nonNull(((Ipv4Match) match.getLayer3Match()).getIpv4Source());
} else if (isArbitrary(match)) {
return Objects.nonNull(match.getLayer3Match())
- && Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ && Objects.nonNull(((Ipv4MatchArbitraryBitMask) match.getLayer3Match())
.getIpv4SourceAddressNoMask());
}
if (isPrefix(match)) {
// Split address to IP and mask
final Iterator<String> addressParts = IpConversionUtil.splitToParts(
- Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Source());
+ ((Ipv4Match) match.getLayer3Match()).getIpv4Source());
addressParts.next();
// Check if we have mask
return addressParts.hasNext() && Integer.parseInt(addressParts.next()) < 32;
} else if (isArbitrary(match)) {
- return Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ return Objects.nonNull(((Ipv4MatchArbitraryBitMask) match.getLayer3Match())
.getIpv4SourceArbitraryBitmask());
}
}
private static boolean isPrefix(Match match) {
- return Ipv4Match.class.isInstance(match.getLayer3Match());
+ return match.getLayer3Match() instanceof Ipv4Match;
}
private static boolean isArbitrary(Match match) {
- return Ipv4MatchArbitraryBitMask.class.isInstance(match.getLayer3Match());
+ return match.getLayer3Match() instanceof Ipv4MatchArbitraryBitMask;
}
@Override
super.serialize(match, outBuffer);
if (isPrefix(match)) {
- writeIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination(), outBuffer);
+ writeIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Destination(), outBuffer);
} else if (isArbitrary(match)) {
- final Ipv6MatchArbitraryBitMask ipv6 = Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match());
+ final Ipv6MatchArbitraryBitMask ipv6 = (Ipv6MatchArbitraryBitMask) match.getLayer3Match();
writeIpv6Address(ipv6.getIpv6DestinationAddressNoMask(), outBuffer);
if (getHasMask(match)) {
public boolean matchTypeCheck(Match match) {
if (isPrefix(match)) {
return Objects.nonNull(match.getLayer3Match())
- && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination());
+ && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6Destination());
} else if (isArbitrary(match)) {
return Objects.nonNull(match.getLayer3Match())
- && Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ && Objects.nonNull(((Ipv6MatchArbitraryBitMask) match.getLayer3Match())
.getIpv6DestinationAddressNoMask());
}
@Override
protected boolean getHasMask(Match match) {
if (isPrefix(match)) {
- if (null != IpConversionUtil.hasIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match())
+ if (null != IpConversionUtil.hasIpv6Prefix(((Ipv6Match) match.getLayer3Match())
.getIpv6Destination())) {
return Objects.nonNull(IpConversionUtil
- .extractIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination()));
+ .extractIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Destination()));
}
} else if (isArbitrary(match)) {
- return Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ return Objects.nonNull(((Ipv6MatchArbitraryBitMask) match.getLayer3Match())
.getIpv6DestinationArbitraryBitmask());
}
}
private static boolean isPrefix(Match match) {
- return Ipv6Match.class.isInstance(match.getLayer3Match());
+ return match.getLayer3Match() instanceof Ipv6Match;
}
private static boolean isArbitrary(Match match) {
- return Ipv6MatchArbitraryBitMask.class.isInstance(match.getLayer3Match());
+ return match.getLayer3Match() instanceof Ipv6MatchArbitraryBitMask;
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- final Ipv6ExtHeader ipv6ExtHeader = Ipv6Match.class.cast(match.getLayer3Match()).getIpv6ExtHeader();
+ final Ipv6ExtHeader ipv6ExtHeader = ((Ipv6Match) match.getLayer3Match()).getIpv6ExtHeader();
outBuffer.writeShort(ipv6ExtHeader.getIpv6Exthdr());
if (getHasMask(match)) {
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && Ipv6Match.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6ExtHeader());
+ && match.getLayer3Match() instanceof Ipv6Match
+ && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6ExtHeader());
}
@Override
protected boolean getHasMask(Match match) {
- return Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6ExtHeader().getIpv6ExthdrMask());
+ return Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6ExtHeader().getIpv6ExthdrMask());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- final Ipv6Label ipv6Label = Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Label();
+ final Ipv6Label ipv6Label = ((Ipv6Match) match.getLayer3Match()).getIpv6Label();
outBuffer.writeInt(ipv6Label.getIpv6Flabel().getValue().intValue());
if (getHasMask(match)) {
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && Ipv6Match.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Label());
+ && match.getLayer3Match() instanceof Ipv6Match
+ && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6Label());
}
@Override
protected boolean getHasMask(Match match) {
- return Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Label().getFlabelMask());
+ return Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6Label().getFlabelMask());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- writeMacAddress(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdSll(), outBuffer);
+ writeMacAddress(((Ipv6Match) match.getLayer3Match()).getIpv6NdSll(), outBuffer);
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && Ipv6Match.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdSll());
+ && match.getLayer3Match() instanceof Ipv6Match
+ && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6NdSll());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- writeIpv6Address(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTarget(), outBuffer);
+ writeIpv6Address(((Ipv6Match) match.getLayer3Match()).getIpv6NdTarget(), outBuffer);
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && Ipv6Match.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTarget());
+ && match.getLayer3Match() instanceof Ipv6Match
+ && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6NdTarget());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- writeMacAddress(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTll(), outBuffer);
+ writeMacAddress(((Ipv6Match) match.getLayer3Match()).getIpv6NdTll(), outBuffer);
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && Ipv6Match.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTll());
+ && match.getLayer3Match() instanceof Ipv6Match
+ && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6NdTll());
}
@Override
super.serialize(match, outBuffer);
if (isPrefix(match)) {
- writeIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source(), outBuffer);
+ writeIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Source(), outBuffer);
} else if (isArbitrary(match)) {
- final Ipv6MatchArbitraryBitMask ipv6 = Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match());
+ final Ipv6MatchArbitraryBitMask ipv6 = (Ipv6MatchArbitraryBitMask) match.getLayer3Match();
writeIpv6Address(ipv6.getIpv6SourceAddressNoMask(), outBuffer);
if (getHasMask(match)) {
public boolean matchTypeCheck(Match match) {
if (isPrefix(match)) {
return Objects.nonNull(match.getLayer3Match())
- && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source());
+ && Objects.nonNull(((Ipv6Match) match.getLayer3Match()).getIpv6Source());
} else if (isArbitrary(match)) {
return Objects.nonNull(match.getLayer3Match())
- && Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ && Objects.nonNull(((Ipv6MatchArbitraryBitMask) match.getLayer3Match())
.getIpv6SourceAddressNoMask());
}
@Override
protected boolean getHasMask(Match match) {
if (isPrefix(match)) {
- if (null != IpConversionUtil.hasIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source())) {
+ if (null != IpConversionUtil.hasIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Source())) {
return Objects.nonNull(IpConversionUtil
- .extractIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source()));
+ .extractIpv6Prefix(((Ipv6Match) match.getLayer3Match()).getIpv6Source()));
}
} else if (isArbitrary(match)) {
- return Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ return Objects.nonNull(((Ipv6MatchArbitraryBitMask) match.getLayer3Match())
.getIpv6SourceArbitraryBitmask());
}
}
private static boolean isPrefix(Match match) {
- return Ipv6Match.class.isInstance(match.getLayer3Match());
+ return match.getLayer3Match() instanceof Ipv6Match;
}
private static boolean isArbitrary(Match match) {
- return Ipv6MatchArbitraryBitMask.class.isInstance(match.getLayer3Match());
+ return match.getLayer3Match() instanceof Ipv6MatchArbitraryBitMask;
}
@Override
// If entry is experimenter, set experimenter ID to key
if (entry.getOxmClass().equals(ExperimenterClass.class)) {
- key.setExperimenterId(ExperimenterIdCase.class.cast(entry.getMatchEntryValue())
+ key.setExperimenterId(((ExperimenterIdCase) entry.getMatchEntryValue())
.getExperimenter().getExperimenter().getValue());
}
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- outBuffer.writeShort(SctpMatch.class.cast(match.getLayer4Match()).getSctpDestinationPort().getValue());
+ outBuffer.writeShort(((SctpMatch) match.getLayer4Match()).getSctpDestinationPort().getValue());
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer4Match())
- && SctpMatch.class.isInstance(match.getLayer4Match())
- && Objects.nonNull(SctpMatch.class.cast(match.getLayer4Match()).getSctpDestinationPort());
+ && match.getLayer4Match() instanceof SctpMatch
+ && Objects.nonNull(((SctpMatch) match.getLayer4Match()).getSctpDestinationPort());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- outBuffer.writeShort(SctpMatch.class.cast(match.getLayer4Match()).getSctpSourcePort().getValue());
+ outBuffer.writeShort(((SctpMatch) match.getLayer4Match()).getSctpSourcePort().getValue());
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer4Match())
- && SctpMatch.class.isInstance(match.getLayer4Match())
- && Objects.nonNull(SctpMatch.class.cast(match.getLayer4Match()).getSctpSourcePort());
+ && match.getLayer4Match() instanceof SctpMatch
+ && Objects.nonNull(((SctpMatch) match.getLayer4Match()).getSctpSourcePort());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- outBuffer.writeShort(TcpMatch.class.cast(match.getLayer4Match()).getTcpDestinationPort().getValue());
+ outBuffer.writeShort(((TcpMatch) match.getLayer4Match()).getTcpDestinationPort().getValue());
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer4Match())
- && TcpMatch.class.isInstance(match.getLayer4Match())
- && Objects.nonNull(TcpMatch.class.cast(match.getLayer4Match()).getTcpDestinationPort());
+ && match.getLayer4Match() instanceof TcpMatch
+ && Objects.nonNull(((TcpMatch) match.getLayer4Match()).getTcpDestinationPort());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- outBuffer.writeShort(TcpMatch.class.cast(match.getLayer4Match()).getTcpSourcePort().getValue());
+ outBuffer.writeShort(((TcpMatch) match.getLayer4Match()).getTcpSourcePort().getValue());
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer4Match())
- && TcpMatch.class.isInstance(match.getLayer4Match())
- && Objects.nonNull(TcpMatch.class.cast(match.getLayer4Match()).getTcpSourcePort());
+ && match.getLayer4Match() instanceof TcpMatch
+ && Objects.nonNull(((TcpMatch) match.getLayer4Match()).getTcpSourcePort());
}
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
// TODO: Why is this serialization exactly same as in Ipv4DestinationEntrySerializer?
- writeIpv4Prefix(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Destination(), outBuffer);
+ writeIpv4Prefix(((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Destination(), outBuffer);
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && TunnelIpv4Match.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Destination());
+ && match.getLayer3Match() instanceof TunnelIpv4Match
+ && Objects.nonNull(((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Destination());
}
@Override
protected boolean getHasMask(Match match) {
// Split address to IP and mask
final Iterator<String> addressParts = IpConversionUtil.splitToParts(
- TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Destination());
+ ((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Destination());
addressParts.next();
// Check if we have mask
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
// TODO: Why is this serialization exactly same as in Ipv4SourceEntrySerializer?
- writeIpv4Prefix(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Source(), outBuffer);
+ writeIpv4Prefix(((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Source(), outBuffer);
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer3Match())
- && TunnelIpv4Match.class.isInstance(match.getLayer3Match())
- && Objects.nonNull(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Source());
+ && match.getLayer3Match() instanceof TunnelIpv4Match
+ && Objects.nonNull(((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Source());
}
@Override
protected boolean getHasMask(Match match) {
// Split address to IP and mask
final Iterator<String> addressParts = IpConversionUtil.splitToParts(
- TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Source());
+ ((TunnelIpv4Match) match.getLayer3Match()).getTunnelIpv4Source());
addressParts.next();
// Check if we have mask
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- outBuffer.writeShort(UdpMatch.class.cast(match.getLayer4Match()).getUdpDestinationPort().getValue());
+ outBuffer.writeShort(((UdpMatch) match.getLayer4Match()).getUdpDestinationPort().getValue());
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer4Match())
- && UdpMatch.class.isInstance(match.getLayer4Match())
- && Objects.nonNull(UdpMatch.class.cast(match.getLayer4Match()).getUdpDestinationPort());
+ && match.getLayer4Match() instanceof UdpMatch
+ && Objects.nonNull(((UdpMatch) match.getLayer4Match()).getUdpDestinationPort());
}
@Override
@Override
public void serialize(Match match, ByteBuf outBuffer) {
super.serialize(match, outBuffer);
- outBuffer.writeShort(UdpMatch.class.cast(match.getLayer4Match()).getUdpSourcePort().getValue());
+ outBuffer.writeShort(((UdpMatch) match.getLayer4Match()).getUdpSourcePort().getValue());
}
@Override
public boolean matchTypeCheck(Match match) {
return Objects.nonNull(match.getLayer4Match())
- && UdpMatch.class.isInstance(match.getLayer4Match())
- && Objects.nonNull(UdpMatch.class.cast(match.getLayer4Match()).getUdpSourcePort());
+ && match.getLayer4Match() instanceof UdpMatch
+ && Objects.nonNull(((UdpMatch) match.getLayer4Match()).getUdpSourcePort());
}
@Override
* @return updated instruction or empty
*/
private static Optional<Instruction> updateInstruction(final Instruction instruction, final Short protocol) {
- if (ApplyActionsCase.class.isInstance(instruction)) {
+ if (instruction instanceof ApplyActionsCase) {
return Optional
- .ofNullable(ApplyActionsCase.class.cast(instruction).getApplyActions())
+ .ofNullable(((ApplyActionsCase) instruction).getApplyActions())
.flatMap(aa -> Optional.ofNullable(aa.getAction()))
.map(as -> new ApplyActionsCaseBuilder()
.setApplyActions(new ApplyActionsBuilder()
* @return updated OpenFlow action
*/
private static Action updateSetTpActions(Action action, Short protocol) {
- if (SetTpSrcActionCase.class.isInstance(action.getAction())) {
- final SetTpSrcActionCase actionCase = SetTpSrcActionCase.class.cast(action.getAction());
+ if (action.getAction() instanceof SetTpSrcActionCase) {
+ final SetTpSrcActionCase actionCase = (SetTpSrcActionCase) action.getAction();
return new ActionBuilder(action)
.setAction(new SetTpSrcActionCaseBuilder(actionCase)
.build())
.build())
.build();
- } else if (SetTpDstActionCase.class.isInstance(action.getAction())) {
- final SetTpDstActionCase actionCase = SetTpDstActionCase.class.cast(action.getAction());
+ } else if (action.getAction() instanceof SetTpDstActionCase) {
+ final SetTpDstActionCase actionCase = (SetTpDstActionCase) action.getAction();
return new ActionBuilder(action)
.setAction(new SetTpDstActionCaseBuilder(actionCase)
.map(i -> {
final int[] offset = {0};
- return ApplyActionsCase.class.isInstance(i.getInstruction())
+ return i.getInstruction() instanceof ApplyActionsCase
? Optional
- .ofNullable(ApplyActionsCase.class.cast(i.getInstruction()).getApplyActions())
+ .ofNullable(((ApplyActionsCase) i.getInstruction()).getApplyActions())
.flatMap(as -> Optional.ofNullable(as.getAction()))
.map(a -> a.stream()
.sorted(OrderComparator.build())
// If current action is SetVlanId, insert PushVlan action before it and
// update order
- if (SetVlanIdActionCase.class.isInstance(action.getAction())) {
+ if (action.getAction() instanceof SetVlanIdActionCase) {
actions.add(new ActionBuilder()
.setAction(new PushVlanActionCaseBuilder()
.setPushVlanAction(new PushVlanActionBuilder()
.setCfi(new VlanCfi(1))
- .setVlanId(SetVlanIdActionCase.class.cast(action
- .getAction()).getSetVlanIdAction()
+ .setVlanId(((SetVlanIdActionCase) action
+ .getAction()).getSetVlanIdAction()
.getVlanId())
.setEthernetType(PUSH_VLAN)
.setTag(PUSH_VLAN)
.map(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types
.rev131026.Instruction::getInstruction)
.filter(ApplyActionsCase.class::isInstance)
- .map(i -> ApplyActionsCase.class.cast(i).getApplyActions())
+ .map(i -> ((ApplyActionsCase) i).getApplyActions())
.filter(Objects::nonNull)
.map(ActionList::getAction)
.filter(Objects::nonNull)
.flatMap(m -> Optional.ofNullable(m.getFlags()))
.ifPresent(flags -> Optional.ofNullable(meterBandHeader.getBandType()).ifPresent(type -> {
if (flags.isOfpmbtDrop()) {
- final Drop band = Drop.class.cast(type);
+ final Drop band = (Drop) type;
outBuffer.writeShort(MeterBandType.OFPMBTDROP.getIntValue());
outBuffer.writeShort(LENGTH_OF_METER_BANDS);
outBuffer.writeInt(band.getDropBurstSize().intValue());
outBuffer.writeZero(PADDING_IN_METER_BAND_DROP);
} else if (flags.isOfpmbtDscpRemark()) {
- final DscpRemark band = DscpRemark.class.cast(type);
+ final DscpRemark band = (DscpRemark) type;
outBuffer.writeShort(MeterBandType.OFPMBTDSCPREMARK.getIntValue());
outBuffer.writeShort(LENGTH_OF_METER_BANDS);
outBuffer.writeByte(band.getPrecLevel());
outBuffer.writeZero(PADDING_IN_METER_BAND_DSCP_REMARK);
} else if (flags.isOfpmbtExperimenter()) {
- final Experimenter band = Experimenter.class.cast(type);
+ final Experimenter band = (Experimenter) type;
// TODO: finish experimenter serialization
final ExperimenterIdSerializerKey<Experimenter> key =
try {
Optional.ofNullable(OFSessionUtil.getExtensionConvertorProvider())
.flatMap(provider ->
- (GeneralExtensionGrouping.class.isInstance(action)
+ (action instanceof GeneralExtensionGrouping
? convertExtensionGrouping(provider, (GeneralExtensionGrouping)action, version)
: convertGenericAction(provider, action, version))
.map(ofjAction -> {
try {
Optional.ofNullable(OFSessionUtil.getExtensionConvertorProvider())
.flatMap(provider ->
- (GeneralExtensionGrouping.class.isInstance(action)
+ (action instanceof GeneralExtensionGrouping
? convertExtensionGrouping(provider, (GeneralExtensionGrouping)action, version)
: convertGenericAction(provider, action, version))
.map(ofjAction -> {
Preconditions.checkNotNull(input);
final Class<?> requestType = input instanceof DataContainer
- ? DataContainer.class.cast(input).getImplementedInterface()
+ ? ((DataContainer) input).getImplementedInterface()
: input.getClass();
getMessageSpy().spyMessage(requestType, MessageSpy.StatisticsGroup.TO_SWITCH_ENTERED);
@Override
protected boolean isMultipart(OfHeader result) {
return result instanceof MultipartReply
- && MultipartReply.class.cast(result).getType().equals(getMultipartType());
+ && ((MultipartReply) result).getType().equals(getMultipartType());
}
@Override
protected boolean isReqMore(T result) {
- return MultipartReply.class.cast(result).getFlags().isOFPMPFREQMORE();
+ return ((MultipartReply) result).getFlags().isOFPMPFREQMORE();
}
@Override
@Override
protected boolean isReqMore(T result) {
- final MultipartRequestFlags flags = MultipartReply.class.cast(result).getFlags();
+ final MultipartRequestFlags flags = ((MultipartReply) result).getFlags();
return Objects.nonNull(flags) && flags.isOFPMPFREQMORE();
}
}
.filter(MultipartReplyFlowAggregateStats.class::isInstance)
.map(multipartReplyBody ->
new AggregatedFlowStatisticsBuilder(
- MultipartReplyFlowAggregateStats.class
- .cast(multipartReplyBody))
+ (MultipartReplyFlowAggregateStats) multipartReplyBody)
.build())
.collect(Collectors.toList())))
.build();
.map(MultipartReply::getMultipartReplyBody)
.filter(MultipartReplyExperimenter.class::isInstance)
.map(experimenter -> new ExperimenterCoreMessageItemBuilder()
- .setExperimenterMessageOfChoice(MultipartReplyExperimenter.class
- .cast(experimenter)
+ .setExperimenterMessageOfChoice(((MultipartReplyExperimenter) experimenter)
.getExperimenterMessageOfChoice())
.build())
.collect(Collectors.toList()))
@Override
protected boolean isMultipart(OfHeader result) {
return result instanceof MultipartReply
- && MultipartReply.class.cast(result).getMultipartReplyBody() instanceof MultipartReplyFlowStats;
+ && ((MultipartReply) result).getMultipartReplyBody() instanceof MultipartReplyFlowStats;
}
@Override
protected boolean isReqMore(T result) {
- return MultipartReply.class.cast(result).isRequestMore();
+ return ((MultipartReply) result).isRequestMore();
}
@Override
@Override
protected boolean isReqMore(T result) {
- return MultipartReply.class.cast(result).isRequestMore();
+ return ((MultipartReply) result).isRequestMore();
}
}
.stream()
.map(MultipartReply::getMultipartReplyBody)
.filter(MultipartReplyTableFeatures.class::isInstance)
- .flatMap(multipartReplyBody -> MultipartReplyTableFeatures.class
- .cast(multipartReplyBody)
+ .flatMap(multipartReplyBody -> ((MultipartReplyTableFeatures) multipartReplyBody)
.getTableFeatures()
.stream())
.collect(Collectors.toList()));
return new GetFlowStatisticsOutputBuilder()
.setFlowAndStatisticsMapList(input
.stream()
- .flatMap(multipartReply -> MultipartReplyFlowStats.class
- .cast(multipartReply.getMultipartReplyBody())
+ .flatMap(multipartReply -> ((MultipartReplyFlowStats) multipartReply.getMultipartReplyBody())
.getFlowAndStatisticsMapList()
.stream())
.map(flowAndStatisticsMapList -> {
return new GetGroupStatisticsOutputBuilder()
.setGroupStats(input
.stream()
- .flatMap(multipartReply -> MultipartReplyGroupStats.class
- .cast(multipartReply.getMultipartReplyBody())
+ .flatMap(multipartReply -> ((MultipartReplyGroupStats) multipartReply.getMultipartReplyBody())
.getGroupStats()
.stream())
.collect(Collectors.toList()))
return new GetMeterStatisticsOutputBuilder()
.setMeterStats(input
.stream()
- .flatMap(multipartReply -> MultipartReplyMeterStats.class
- .cast(multipartReply.getMultipartReplyBody())
+ .flatMap(multipartReply -> ((MultipartReplyMeterStats) multipartReply.getMultipartReplyBody())
.getMeterStats()
.stream())
.collect(Collectors.toList()))
return new GetNodeConnectorStatisticsOutputBuilder()
.setNodeConnectorStatisticsAndPortNumberMap(input
.stream()
- .flatMap(multipartReply -> MultipartReplyPortStats.class
- .cast(multipartReply.getMultipartReplyBody())
+ .flatMap(multipartReply -> ((MultipartReplyPortStats) multipartReply.getMultipartReplyBody())
.getNodeConnectorStatisticsAndPortNumberMap()
.stream())
.collect(Collectors.toList()))
return new GetQueueStatisticsOutputBuilder()
.setQueueIdAndStatisticsMap(input
.stream()
- .flatMap(multipartReply -> MultipartReplyQueueStats.class
- .cast(multipartReply.getMultipartReplyBody())
+ .flatMap(multipartReply -> ((MultipartReplyQueueStats) multipartReply.getMultipartReplyBody())
.getQueueIdAndStatisticsMap()
.stream())
.collect(Collectors.toList()))
in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
final Action action = deserializeAction(in);
- assertTrue(CopyTtlInCase.class.isInstance(action));
+ assertTrue(action instanceof CopyTtlInCase);
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
final Action action = deserializeAction(in);
- assertTrue(CopyTtlOutCase.class.isInstance(action));
+ assertTrue(action instanceof CopyTtlOutCase);
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
final Action action = deserializeAction(in);
- assertTrue(DecMplsTtlCase.class.isInstance(action));
+ assertTrue(action instanceof DecMplsTtlCase);
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
final Action action = deserializeAction(in);
- assertTrue(DecNwTtlCase.class.isInstance(action));
+ assertTrue(action instanceof DecNwTtlCase);
assertEquals(0, in.readableBytes());
}
in.writeInt(groupId);
final Action action = deserializeAction(in);
- assertTrue(GroupActionCase.class.isInstance(action));
- assertEquals(groupId, GroupActionCase.class.cast(action).getGroupAction().getGroupId().intValue());
+ assertTrue(action instanceof GroupActionCase);
+ assertEquals(groupId, ((GroupActionCase) action).getGroupAction().getGroupId().intValue());
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.OUTPUT_PADDING);
final Action action = deserializeAction(in);
- assertTrue(OutputActionCase.class.isInstance(action));
+ assertTrue(action instanceof OutputActionCase);
- final OutputAction outputAction = OutputActionCase.class.cast(action).getOutputAction();
+ final OutputAction outputAction = ((OutputActionCase) action).getOutputAction();
assertEquals(portNum, InventoryDataServiceUtil.portNumberfromNodeConnectorId(
OpenflowVersion.OF13, outputAction.getOutputNodeConnector().getValue()).intValue());
assertEquals(maxLength, outputAction.getMaxLength().shortValue());
in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
final Action action = deserializeAction(in);
- assertTrue(PopMplsActionCase.class.isInstance(action));
+ assertTrue(action instanceof PopMplsActionCase);
- final PopMplsAction popAction = PopMplsActionCase.class.cast(action).getPopMplsAction();
+ final PopMplsAction popAction = ((PopMplsActionCase) action).getPopMplsAction();
assertEquals(ethType, popAction.getEthernetType().shortValue());
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
final Action action = deserializeAction(in);
- assertTrue(PopPbbActionCase.class.isInstance(action));
+ assertTrue(action instanceof PopPbbActionCase);
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.PADDING_IN_ACTION_HEADER);
final Action action = deserializeAction(in);
- assertTrue(PopVlanActionCase.class.isInstance(action));
+ assertTrue(action instanceof PopVlanActionCase);
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
final Action action = deserializeAction(in);
- assertTrue(PushMplsActionCase.class.isInstance(action));
- assertEquals(ethType, PushMplsActionCase.class.cast(action).getPushMplsAction().getEthernetType().shortValue());
+ assertTrue(action instanceof PushMplsActionCase);
+ assertEquals(ethType, ((PushMplsActionCase) action).getPushMplsAction().getEthernetType().shortValue());
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
final Action action = deserializeAction(in);
- assertTrue(PushPbbActionCase.class.isInstance(action));
- assertEquals(ethType, PushPbbActionCase.class.cast(action).getPushPbbAction().getEthernetType().shortValue());
+ assertTrue(action instanceof PushPbbActionCase);
+ assertEquals(ethType, ((PushPbbActionCase) action).getPushPbbAction().getEthernetType().shortValue());
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
final Action action = deserializeAction(in);
- assertTrue(PushVlanActionCase.class.isInstance(action));
- assertEquals(ethType, PushVlanActionCase.class.cast(action).getPushVlanAction().getEthernetType().shortValue());
+ assertTrue(action instanceof PushVlanActionCase);
+ assertEquals(ethType, ((PushVlanActionCase) action).getPushVlanAction().getEthernetType().shortValue());
assertEquals(0, in.readableBytes());
}
in.writeZero(EncodeConstants.SIZE_OF_INT_IN_BYTES);
final Action action = deserializeAction(in);
- assertTrue(SetFieldCase.class.isInstance(action));
+ assertTrue(action instanceof SetFieldCase);
assertEquals(
OpenflowPortsUtil
.getPortLogicalName(EncodeConstants.OF13_VERSION_ID, BinContent.intToUnsignedLong(portNum)),
- SetFieldCase.class.cast(action).getSetField().getInPort().getValue());
+ ((SetFieldCase) action).getSetField().getInPort().getValue());
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.SET_MPLS_TTL_PADDING);
final Action action = deserializeAction(in);
- assertTrue(SetMplsTtlActionCase.class.isInstance(action));
- assertEquals(mplsTtl, SetMplsTtlActionCase.class.cast(action).getSetMplsTtlAction().getMplsTtl().shortValue());
+ assertTrue(action instanceof SetMplsTtlActionCase);
+ assertEquals(mplsTtl, ((SetMplsTtlActionCase) action).getSetMplsTtlAction().getMplsTtl().shortValue());
assertEquals(0, in.readableBytes());
}
in.writeZero(ActionConstants.SET_NW_TTL_PADDING);
final Action action = deserializeAction(in);
- assertTrue(SetNwTtlActionCase.class.isInstance(action));
- assertEquals(nwTtl, SetNwTtlActionCase.class.cast(action).getSetNwTtlAction().getNwTtl().shortValue());
+ assertTrue(action instanceof SetNwTtlActionCase);
+ assertEquals(nwTtl, ((SetNwTtlActionCase) action).getSetNwTtlAction().getNwTtl().shortValue());
assertEquals(0, in.readableBytes());
}
in.writeInt(queueId);
final Action action = deserializeAction(in);
- assertTrue(SetQueueActionCase.class.isInstance(action));
- assertEquals(queueId, SetQueueActionCase.class.cast(action).getSetQueueAction().getQueueId().intValue());
+ assertTrue(action instanceof SetQueueActionCase);
+ assertEquals(queueId, ((SetQueueActionCase) action).getSetQueueAction().getQueueId().intValue());
assertEquals(0, in.readableBytes());
}
final Instruction instruction = deserializer.deserialize(in);
assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
- final ApplyActionsCase actionCase = ApplyActionsCase.class.cast(instruction);
+ final ApplyActionsCase actionCase = (ApplyActionsCase) instruction;
assertEquals(1, actionCase.getApplyActions().getAction().size());
assertEquals(PopPbbActionCase.class, actionCase.getApplyActions().getAction().get(0)
.getAction().getImplementedInterface());
final Instruction instruction = deserializeInstruction(in);
assertEquals(GoToTableCase.class, instruction.getImplementedInterface());
- assertEquals(tableId, GoToTableCase.class.cast(instruction).getGoToTable().getTableId().shortValue());
+ assertEquals(tableId, ((GoToTableCase) instruction).getGoToTable().getTableId().shortValue());
assertEquals(0, in.readableBytes());
}
final Instruction instruction = deserializeInstruction(in);
assertEquals(MeterCase.class, instruction.getImplementedInterface());
- assertEquals(meterId, MeterCase.class.cast(instruction).getMeter().getMeterId().getValue().intValue());
+ assertEquals(meterId, ((MeterCase) instruction).getMeter().getMeterId().getValue().intValue());
assertEquals(0, in.readableBytes());
}
final Instruction instruction = deserializer.deserialize(in);
assertEquals(WriteActionsCase.class, instruction.getImplementedInterface());
- final WriteActionsCase actionCase = WriteActionsCase.class.cast(instruction);
+ final WriteActionsCase actionCase = (WriteActionsCase) instruction;
assertEquals(1, actionCase.getWriteActions().getAction().size());
assertEquals(PopPbbActionCase.class, actionCase.getWriteActions().getAction().get(0)
.getAction().getImplementedInterface());
ByteUtil
.convertBigIntegerToNBytes(metadata, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
ByteUtil
- .convertBigIntegerToNBytes(WriteMetadataCase.class.cast(instruction).getWriteMetadata()
+ .convertBigIntegerToNBytes(((WriteMetadataCase) instruction).getWriteMetadata()
.getMetadata(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
assertArrayEquals(
ByteUtil
.convertBigIntegerToNBytes(metadataMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
ByteUtil
- .convertBigIntegerToNBytes(WriteMetadataCase.class.cast(instruction).getWriteMetadata()
+ .convertBigIntegerToNBytes(((WriteMetadataCase) instruction).getWriteMetadata()
.getMetadataMask(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
assertEquals(0, in.readableBytes());
writeHeader(in, false);
in.writeShort(arpOp);
- assertEquals(arpOp, ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpOp().intValue());
+ assertEquals(arpOp, ((ArpMatch) deserialize(in).getLayer3Match()).getArpOp().intValue());
assertEquals(0, in.readableBytes());
}
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpSourceHardwareAddress));
assertEquals(arpSourceHardwareAddress.getValue(),
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceHardwareAddress().getAddress()
+ ((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceHardwareAddress().getAddress()
.getValue());
assertEquals(0, in.readableBytes());
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpSourceHardwareAddressMask));
final ArpSourceHardwareAddress desAddress =
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceHardwareAddress();
+ ((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceHardwareAddress();
assertEquals(arpSourceHardwareAddress.getValue(), desAddress.getAddress().getValue());
assertEquals(arpSourceHardwareAddressMask.getValue(), desAddress.getMask().getValue());
assertEquals(0, in.readableBytes());
in.writeBytes(IetfInetUtil.INSTANCE.ipv4AddressBytes(new Ipv4Address(addressParts.next())));
assertEquals(arpSourceTransportAddressNoMask.getValue(),
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceTransportAddress().getValue());
+ ((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceTransportAddress().getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
in.writeBytes(MatchConvertorUtil.extractIpv4Mask(addressParts));
final Ipv4Prefix desAddress =
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpSourceTransportAddress();
+ ((ArpMatch) deserialize(in).getLayer3Match()).getArpSourceTransportAddress();
assertEquals(arpSourceTransportAddress.getValue(), desAddress.getValue());
assertEquals(0, in.readableBytes());
}
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpTargetHardwareAddress));
assertEquals(arpTargetHardwareAddress.getValue(),
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetHardwareAddress().getAddress()
+ ((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetHardwareAddress().getAddress()
.getValue());
assertEquals(0, in.readableBytes());
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(arpTargetHardwareAddressMask));
final ArpTargetHardwareAddress desAddress =
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetHardwareAddress();
+ ((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetHardwareAddress();
assertEquals(arpTargetHardwareAddress.getValue(), desAddress.getAddress().getValue());
assertEquals(arpTargetHardwareAddressMask.getValue(), desAddress.getMask().getValue());
assertEquals(0, in.readableBytes());
in.writeBytes(IetfInetUtil.INSTANCE.ipv4AddressBytes(new Ipv4Address(addressParts.next())));
assertEquals(arpTargetTransportAddressNoMask.getValue(),
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetTransportAddress().getValue());
+ ((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetTransportAddress().getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
in.writeBytes(MatchConvertorUtil.extractIpv4Mask(addressParts));
final Ipv4Prefix desAddress =
- ArpMatch.class.cast(deserialize(in).getLayer3Match()).getArpTargetTransportAddress();
+ ((ArpMatch) deserialize(in).getLayer3Match()).getArpTargetTransportAddress();
assertEquals(arpTargetTransportAddress.getValue(), desAddress.getValue());
assertEquals(0, in.readableBytes());
}
in.writeBytes(IetfInetUtil.INSTANCE.ipv4AddressBytes(new Ipv4Address(addressParts.next())));
in.writeBytes(MatchConvertorUtil.extractIpv4Mask(addressParts));
- final Ipv4Match match = Ipv4Match.class.cast(deserialize(in).getLayer3Match());
+ final Ipv4Match match = (Ipv4Match) deserialize(in).getLayer3Match();
assertEquals(address.getValue(), match.getIpv4Destination().getValue());
assertEquals(0, in.readableBytes());
in.writeBytes(IetfInetUtil.INSTANCE.ipv4AddressBytes(new Ipv4Address(addressParts.next())));
in.writeBytes(MatchConvertorUtil.extractIpv4Mask(addressParts));
- final Ipv4Match match = Ipv4Match.class.cast(deserialize(in).getLayer3Match());
+ final Ipv4Match match = (Ipv4Match) deserialize(in).getLayer3Match();
assertEquals(address.getValue(), match.getIpv4Source().getValue());
assertEquals(0, in.readableBytes());
in.writeBytes(IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(address)));
in.writeBytes(IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(address)));
- final Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+ final Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(address.getValue(), match.getIpv6Destination().getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, false);
in.writeShort(extHeader);
- Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+ Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(extHeader, match.getIpv6ExtHeader().getIpv6Exthdr().intValue());
assertEquals(0, in.readableBytes());
in.writeShort(extHeader);
in.writeShort(extHeaderMask);
- match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+ match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(extHeader, match.getIpv6ExtHeader().getIpv6Exthdr().intValue());
assertEquals(extHeaderMask, match.getIpv6ExtHeader().getIpv6ExthdrMask().intValue());
assertEquals(0, in.readableBytes());
writeHeader(in, false);
in.writeInt(flowLabel);
- Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+ Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(flowLabel, match.getIpv6Label().getIpv6Flabel().getValue().intValue());
assertEquals(0, in.readableBytes());
in.writeInt(flowLabel);
in.writeInt(flowLabelMask);
- match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+ match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(flowLabel, match.getIpv6Label().getIpv6Flabel().getValue().intValue());
assertEquals(flowLabelMask, match.getIpv6Label().getFlabelMask().getValue().intValue());
assertEquals(0, in.readableBytes());
writeHeader(in, false);
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address));
- Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+ Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(address.getValue(), match.getIpv6NdSll().getValue());
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeBytes(IetfInetUtil.INSTANCE.ipv6AddressBytes(address));
- Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+ Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
assertArrayEquals(
IetfInetUtil.INSTANCE.ipv6AddressBytes(address),
IetfInetUtil.INSTANCE.ipv6AddressBytes(match.getIpv6NdTarget()));
writeHeader(in, false);
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address));
- Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+ Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(address.getValue(), match.getIpv6NdTll().getValue());
assertEquals(0, in.readableBytes());
}
in.writeBytes(IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(address)));
in.writeBytes(IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(address)));
- final Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
+ final Ipv6Match match = (Ipv6Match) deserialize(in).getLayer3Match();
assertEquals(address.getValue(), match.getIpv6Source().getValue());
assertEquals(0, in.readableBytes());
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, SctpMatch.class.cast(deserialize(in).getLayer4Match()).getSctpDestinationPort().getValue()
+ assertEquals(port, ((SctpMatch) deserialize(in).getLayer4Match()).getSctpDestinationPort().getValue()
.intValue());
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, SctpMatch.class.cast(deserialize(in).getLayer4Match()).getSctpSourcePort().getValue()
+ assertEquals(port, ((SctpMatch) deserialize(in).getLayer4Match()).getSctpSourcePort().getValue()
.intValue());
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, TcpMatch.class.cast(deserialize(in).getLayer4Match()).getTcpDestinationPort().getValue()
+ assertEquals(port, ((TcpMatch) deserialize(in).getLayer4Match()).getTcpDestinationPort().getValue()
.intValue());
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, TcpMatch.class.cast(deserialize(in).getLayer4Match()).getTcpSourcePort().getValue()
+ assertEquals(port, ((TcpMatch) deserialize(in).getLayer4Match()).getTcpSourcePort().getValue()
.intValue());
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, UdpMatch.class.cast(deserialize(in).getLayer4Match()).getUdpDestinationPort().getValue()
+ assertEquals(port, ((UdpMatch) deserialize(in).getLayer4Match()).getUdpDestinationPort().getValue()
.intValue());
assertEquals(0, in.readableBytes());
}
writeHeader(in, false);
in.writeShort(port);
- assertEquals(port, UdpMatch.class.cast(deserialize(in).getLayer4Match()).getUdpSourcePort().getValue()
+ assertEquals(port, ((UdpMatch) deserialize(in).getLayer4Match()).getUdpSourcePort().getValue()
.intValue());
assertEquals(0, in.readableBytes());
}
final Instruction instruction = message.getInstructions().getInstruction().get(0).getInstruction();
assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
- final ApplyActionsCase applyActions = ApplyActionsCase.class.cast(instruction);
+ final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
assertEquals(1, applyActions.getApplyActions().getAction().size());
assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
.getAction().getImplementedInterface());
assertEquals(Drop.class, dropHeader.getBandType().getImplementedInterface());
assertTrue(dropHeader.getMeterBandTypes().getFlags().isOfpmbtDrop());
- final Drop drop = Drop.class.cast(dropHeader.getBandType());
+ final Drop drop = (Drop) dropHeader.getBandType();
assertEquals(DROP_RATE, drop.getDropRate().intValue());
assertEquals(DROP_BURST, drop.getDropBurstSize().intValue());
assertEquals(DscpRemark.class, dscpHeader.getBandType().getImplementedInterface());
assertTrue(dscpHeader.getMeterBandTypes().getFlags().isOfpmbtDscpRemark());
- final DscpRemark dscpRemark = DscpRemark.class.cast(dscpHeader.getBandType());
+ final DscpRemark dscpRemark = (DscpRemark) dscpHeader.getBandType();
assertEquals(DSCP_RATE, dscpRemark.getDscpRemarkRate().intValue());
assertEquals(DSCP_BURST, dscpRemark.getDscpRemarkBurstSize().intValue());
flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
- final ApplyActionsCase applyActions = ApplyActionsCase.class.cast(instruction);
+ final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
assertEquals(1, applyActions.getApplyActions().getAction().size());
assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
.getAction().getImplementedInterface());
flowAndStatisticsMapList.getInstructions().getInstruction().get(1).getInstruction();
assertEquals(WriteActionsCase.class, instruction1.getImplementedInterface());
- final WriteActionsCase writeActions = WriteActionsCase.class.cast(instruction1);
+ final WriteActionsCase writeActions = (WriteActionsCase) instruction1;
assertEquals(1, writeActions.getWriteActions().getAction().size());
assertEquals(PopVlanActionCase.class, writeActions.getWriteActions().getAction().get(0)
.getAction().getImplementedInterface());
flowAndStatisticsMapList.getInstructions().getInstruction().get(0).getInstruction();
assertEquals(ApplyActionsCase.class, instruction.getImplementedInterface());
- final ApplyActionsCase applyActions = ApplyActionsCase.class.cast(instruction);
+ final ApplyActionsCase applyActions = (ApplyActionsCase) instruction;
assertEquals(1, applyActions.getApplyActions().getAction().size());
assertEquals(PopPbbActionCase.class, applyActions.getApplyActions().getAction().get(0)
.getAction().getImplementedInterface());
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
- final MultipartRequestFlowAggregateStats result = MultipartRequestFlowAggregateStats.class.cast(
- MultipartRequest.class.cast(ofHeader)
- .getMultipartRequestBody());
+ final MultipartRequestFlowAggregateStats result =
+ (MultipartRequestFlowAggregateStats) ((MultipartRequest) ofHeader)
+ .getMultipartRequestBody();
assertEquals(TABLE_ID, result.getFlowAggregateStats().getTableId().shortValue());
}
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
- final MultipartRequestExperimenter result = MultipartRequestExperimenter.class.cast(
- MultipartRequest.class.cast(ofHeader)
- .getMultipartRequestBody());
+ final MultipartRequestExperimenter result = (MultipartRequestExperimenter) ((MultipartRequest) ofHeader)
+ .getMultipartRequestBody();
assertEquals(DummyExperimenter.class, result.getExperimenterMessageOfChoice().getImplementedInterface());
}
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(FlowMessage.class, ofHeader.getImplementedInterface());
- final FlowMessage result = FlowMessage.class.cast(ofHeader);
+ final FlowMessage result = (FlowMessage) ofHeader;
assertEquals(FlowModCommand.OFPFCADD, result.getCommand());
assertEquals(TABLE_ID, result.getTableId().shortValue());
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(GroupMessage.class, ofHeader.getImplementedInterface());
- final GroupMessage result = GroupMessage.class.cast(ofHeader);
+ final GroupMessage result = (GroupMessage) ofHeader;
assertEquals(GroupModCommand.OFPGCADD, result.getCommand());
assertEquals(GROUP_ID, result.getGroupId().getValue().longValue());
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(MeterMessage.class, ofHeader.getImplementedInterface());
- final MeterMessage result = MeterMessage.class.cast(ofHeader);
+ final MeterMessage result = (MeterMessage) ofHeader;
assertEquals(MeterModCommand.OFPMCADD, result.getCommand());
assertEquals(METER_ID, result.getMeterId().getValue().longValue());
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(PortMessage.class, ofHeader.getImplementedInterface());
- final PortMessage result = PortMessage.class.cast(ofHeader);
+ final PortMessage result = (PortMessage) ofHeader;
assertEquals(PORT_ID, result.getPortNumber().getUint32().longValue());
}
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
- final MultipartRequestTableFeatures result = MultipartRequestTableFeatures.class.cast(
- MultipartRequest.class.cast(ofHeader)
- .getMultipartRequestBody());
+ final MultipartRequestTableFeatures result = (MultipartRequestTableFeatures) ((MultipartRequest) ofHeader)
+ .getMultipartRequestBody();
assertEquals(MAX_ENTRIES, result.getTableFeatures().get(0).getMaxEntries().longValue());
}
.build())
.build()));
- assertEquals(arpOp, ArpMatch.class.cast(matchBuilder.getLayer3Match()).getArpOp().intValue());
+ assertEquals(arpOp, ((ArpMatch) matchBuilder.getLayer3Match()).getArpOp().intValue());
}
@Test
.build()));
assertEquals("192.168.1.0/24",
- TunnelIpv4Match.class.cast(matchBuilder.getLayer3Match()).getTunnelIpv4Source().getValue());
+ ((TunnelIpv4Match) matchBuilder.getLayer3Match()).getTunnelIpv4Source().getValue());
assertEquals("192.168.2.0/24",
- TunnelIpv4Match.class.cast(matchBuilder.getLayer3Match()).getTunnelIpv4Destination().getValue());
+ ((TunnelIpv4Match) matchBuilder.getLayer3Match()).getTunnelIpv4Destination().getValue());
}
@Test
.setIpv4Destination(new Ipv4Prefix(destination))
.build()));
- assertEquals("192.168.1.0/24", Ipv4Match.class.cast(matchBuilder.getLayer3Match()).getIpv4Source().getValue());
+ assertEquals("192.168.1.0/24", ((Ipv4Match) matchBuilder.getLayer3Match()).getIpv4Source().getValue());
assertEquals("192.168.2.0/24",
- Ipv4Match.class.cast(matchBuilder.getLayer3Match()).getIpv4Destination().getValue());
+ ((Ipv4Match) matchBuilder.getLayer3Match()).getIpv4Destination().getValue());
}
@Test
.setIpv4DestinationArbitraryBitmask(leftMask)
.build()));
- assertEquals(right, Ipv4Match.class.cast(matchBuilder.getLayer3Match()).getIpv4Source());
- assertEquals(right, Ipv4Match.class.cast(matchBuilder.getLayer3Match()).getIpv4Destination());
+ assertEquals(right, ((Ipv4Match) matchBuilder.getLayer3Match()).getIpv4Source());
+ assertEquals(right, ((Ipv4Match) matchBuilder.getLayer3Match()).getIpv4Destination());
}
@Test
.setIpv6Destination(leftPrefix)
.build()));
- assertEquals(rightMac, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6NdSll());
- assertEquals(rightMac, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6NdTll());
- assertEquals(rightPrefix, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Source());
- assertEquals(rightPrefix, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Destination());
- assertEquals(rightAddress, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6NdTarget());
+ assertEquals(rightMac, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6NdSll());
+ assertEquals(rightMac, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6NdTll());
+ assertEquals(rightPrefix, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6Source());
+ assertEquals(rightPrefix, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6Destination());
+ assertEquals(rightAddress, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6NdTarget());
}
@Test
.setIpv6DestinationArbitraryBitmask(leftMask)
.build()));
- assertEquals(right, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Source());
- assertEquals(right, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Destination());
+ assertEquals(right, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6Source());
+ assertEquals(right, ((Ipv6Match) matchBuilder.getLayer3Match()).getIpv6Destination());
}
@Test