X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-compability%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcompability%2FFromSalConversionsUtils.java;h=18c47246290b0207a56be128e0df02ebb87f780a;hb=8cf4238d55b80059f7835c6cd377198b79d34b75;hp=e77375fc41a0d53367008064dc67f1a9b21b5d63;hpb=c11f8feda00f4837b043310258a84128fd95f1c9;p=controller.git diff --git a/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/FromSalConversionsUtils.java b/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/FromSalConversionsUtils.java index e77375fc41..18c4724629 100644 --- a/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/FromSalConversionsUtils.java +++ b/opendaylight/md-sal/sal-compability/src/main/java/org/opendaylight/controller/sal/compability/FromSalConversionsUtils.java @@ -12,43 +12,22 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.opendaylight.controller.sal.action.Controller; -import org.opendaylight.controller.sal.action.Drop; -import org.opendaylight.controller.sal.action.Flood; -import org.opendaylight.controller.sal.action.FloodAll; -import org.opendaylight.controller.sal.action.HwPath; -import org.opendaylight.controller.sal.action.Loopback; -import org.opendaylight.controller.sal.action.Output; -import org.opendaylight.controller.sal.action.PopVlan; -import org.opendaylight.controller.sal.action.PushVlan; -import org.opendaylight.controller.sal.action.SetDlDst; -import org.opendaylight.controller.sal.action.SetDlSrc; -import org.opendaylight.controller.sal.action.SetDlType; -import org.opendaylight.controller.sal.action.SetNextHop; -import org.opendaylight.controller.sal.action.SetNwDst; -import org.opendaylight.controller.sal.action.SetNwSrc; -import org.opendaylight.controller.sal.action.SetNwTos; -import org.opendaylight.controller.sal.action.SetTpDst; -import org.opendaylight.controller.sal.action.SetTpSrc; -import org.opendaylight.controller.sal.action.SetVlanCfi; -import org.opendaylight.controller.sal.action.SetVlanId; -import org.opendaylight.controller.sal.action.SetVlanPcp; -import org.opendaylight.controller.sal.action.SwPath; +import org.opendaylight.controller.sal.action.*; import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.flowprogrammer.Flow; import org.opendaylight.controller.sal.match.Match; import org.opendaylight.controller.sal.match.MatchField; import org.opendaylight.controller.sal.match.MatchType; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri; +import org.opendaylight.controller.sal.utils.NetUtils; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.*; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.ControllerActionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.OutputActionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.VlanCfi; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.*; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.Address; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv6Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.ActionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType; @@ -59,14 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetDestinationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetSourceBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetTypeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.EthernetMatch; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.EthernetMatchBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.IpMatch; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.IpMatchBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.Layer3Match; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.Layer4Match; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.VlanMatch; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.VlanMatchBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.ArpMatchBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv4MatchBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv6MatchBuilder; @@ -75,15 +47,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.UdpMatchBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.vlan.match.fields.VlanIdBuilder; -public class FromSalConversionsUtils { +import com.google.common.net.InetAddresses; - // source: http://en.wikipedia.org/wiki/Ethertype - private static final Short ETHERNET_ARP = new Short((short) 0x0806); +import static org.opendaylight.controller.sal.compability.ProtocolConstants.ETHERNET_ARP; +import static org.opendaylight.controller.sal.compability.ProtocolConstants.SCTP; +import static org.opendaylight.controller.sal.compability.ProtocolConstants.TCP; +import static org.opendaylight.controller.sal.compability.ProtocolConstants.UDP; - // source: http://en.wikipedia.org/wiki/List_of_IP_protocol_numbers - private static final short TCP = (short) 0x06; - private static final short UDP = (short) 0x11; - private static final short SCTP = (short) 0x84; +public class FromSalConversionsUtils { private FromSalConversionsUtils() { @@ -120,15 +91,15 @@ public class FromSalConversionsUtils { if (sourceAction instanceof Controller) { targetAction = new ControllerActionBuilder().build(); } else if (sourceAction instanceof Drop) { - // TODO: define maping + targetAction = new DropActionBuilder().build(); } else if (sourceAction instanceof Flood) { - // TODO: define maping + targetAction = new FloodActionBuilder().build(); } else if (sourceAction instanceof FloodAll) { - // TODO: define maping + targetAction = new FloodAllActionBuilder().build(); } else if (sourceAction instanceof HwPath) { - // TODO: define maping + targetAction = new HwPathActionBuilder().build(); } else if (sourceAction instanceof Loopback) { - // TODO: define maping + targetAction = new LoopbackActionBuilder().build(); } else if (sourceAction instanceof Output) { NodeConnector nodeConnector = ((Output) sourceAction).getPort(); @@ -137,35 +108,101 @@ public class FromSalConversionsUtils { targetAction = outputActionBuilder.build(); } else if (sourceAction instanceof PopVlan) { - // TODO: define maping + targetAction = new PopVlanActionBuilder().build(); } else if (sourceAction instanceof PushVlan) { - // TODO: define maping + PushVlan pushVlan = (PushVlan) sourceAction; + PushVlanActionBuilder pushVlanActionBuilder = new PushVlanActionBuilder(); + + pushVlanActionBuilder.setCfi(new VlanCfi(pushVlan.getCfi())); + pushVlanActionBuilder.setVlanId(new VlanId(pushVlan.getVlanId())); + pushVlanActionBuilder.setPcp(pushVlan.getPcp()); + pushVlanActionBuilder.setTag(pushVlan.getTag()); + targetAction = pushVlanActionBuilder.build(); } else if (sourceAction instanceof SetDlDst) { - // TODO: define maping + SetDlDst setDlDst = (SetDlDst) sourceAction; + SetDlDstActionBuilder setDlDstActionBuilder = new SetDlDstActionBuilder(); + + setDlDstActionBuilder.setAddress(new MacAddress(new String(setDlDst.getDlAddress()))); + targetAction = setDlDstActionBuilder.build(); } else if (sourceAction instanceof SetDlSrc) { - // TODO: define maping + SetDlSrc setDlSrc = (SetDlSrc) sourceAction; + SetDlSrcActionBuilder setDlSrcActionBuilder = new SetDlSrcActionBuilder(); + + setDlSrcActionBuilder.setAddress(new MacAddress(new String(setDlSrc.getDlAddress()))); + targetAction = setDlSrcActionBuilder.build(); } else if (sourceAction instanceof SetDlType) { - // TODO: define maping + SetDlType setDlType = (SetDlType) sourceAction; + SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder(); + + setDlTypeActionBuilder.setDlType(new EtherType(new Long(setDlType.getDlType()))); + targetAction = setDlTypeActionBuilder.build(); } else if (sourceAction instanceof SetNextHop) { - // TODO: define maping + SetNextHop setNextHop = (SetNextHop) sourceAction; + SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder(); + + InetAddress inetAddress = setNextHop.getAddress(); + setNextHopActionBuilder.setAddress(addressFromAction(inetAddress)); + + targetAction = setNextHopActionBuilder.build(); } else if (sourceAction instanceof SetNwDst) { - // TODO: define maping + SetNwDst setNwDst = (SetNwDst) sourceAction; + SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder(); + + InetAddress inetAddress = setNwDst.getAddress(); + setNwDstActionBuilder.setAddress(addressFromAction(inetAddress)); + + targetAction = setNwDstActionBuilder.build(); } else if (sourceAction instanceof SetNwSrc) { - // TODO: define maping + SetNwSrc setNwSrc = (SetNwSrc) sourceAction; + SetNwSrcActionBuilder setNwSrcActionBuilder = new SetNwSrcActionBuilder(); + + InetAddress inetAddress = setNwSrc.getAddress(); + setNwSrcActionBuilder.setAddress(addressFromAction(inetAddress)); + + targetAction = setNwSrcActionBuilder.build(); } else if (sourceAction instanceof SetNwTos) { - // TODO: define maping + SetNwTos setNwTos = (SetNwTos) sourceAction; + SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder(); + + setNwTosActionBuilder.setTos(setNwTos.getNwTos()); + targetAction = setNwTosActionBuilder.build(); } else if (sourceAction instanceof SetTpDst) { - // TODO: define maping + SetTpDst setTpDst = (SetTpDst) sourceAction; + SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder(); + + setTpDstActionBuilder.setPort(new PortNumber(setTpDst.getPort())); + + targetAction = setTpDstActionBuilder.build(); } else if (sourceAction instanceof SetTpSrc) { - // TODO: define maping + SetTpSrc setTpSrc = (SetTpSrc) sourceAction; + SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder(); + + setTpSrcActionBuilder.setPort(new PortNumber(setTpSrc.getPort())); + + targetAction = setTpSrcActionBuilder.build(); } else if (sourceAction instanceof SetVlanCfi) { - // TODO: define maping + SetVlanCfi setVlanCfi = (SetVlanCfi) sourceAction; + SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder(); + + setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(setVlanCfi.getCfi())); + + targetAction = setVlanCfiActionBuilder.build(); } else if (sourceAction instanceof SetVlanId) { - // TODO: define maping + SetVlanId setVlanId = (SetVlanId) sourceAction; + SetVlanIdActionBuilder setVlanIdActionBuilder = new SetVlanIdActionBuilder(); + + setVlanIdActionBuilder.setVlanId(new VlanId(setVlanId.getVlanId())); + + targetAction = setVlanIdActionBuilder.build(); } else if (sourceAction instanceof SetVlanPcp) { - // TODO: define maping + SetVlanPcp setVlanPcp = (SetVlanPcp) sourceAction; + SetVlanPcpActionBuilder setVlanPcpActionBuilder = new SetVlanPcpActionBuilder(); + + setVlanPcpActionBuilder.setVlanPcp(new VlanPcp((short) setVlanPcp.getPcp())); + + targetAction = setVlanPcpActionBuilder.build(); } else if (sourceAction instanceof SwPath) { - // TODO: define maping + targetAction = new SwPathActionBuilder().build(); } targetActionBuilder.setAction(targetAction); @@ -173,6 +210,20 @@ public class FromSalConversionsUtils { return targetActionBuilder.build(); } + private static Address addressFromAction(InetAddress inetAddress) { + String strInetAddresss = InetAddresses.toAddrString(inetAddress); + if (inetAddress instanceof Inet4Address) { + Ipv4Builder ipv4Builder = new Ipv4Builder(); + ipv4Builder.setIpv4Address(new Ipv4Prefix(strInetAddresss)); + return ipv4Builder.build(); + } else if (inetAddress instanceof Inet6Address) { + Ipv6Builder ipv6Builder = new Ipv6Builder(); + ipv6Builder.setIpv6Address(new Ipv6Prefix(strInetAddresss)); + return ipv6Builder.build(); + } + return null; + } + private static List nodeConnectorToUri(NodeConnector nodeConnector) { // TODO Define mapping return null; @@ -199,16 +250,15 @@ public class FromSalConversionsUtils { MatchField nwProto = sourceMatch.getField(MatchType.NW_PROTO); Short nwProtocolSource = null; if (nwProto != null && nwProto.getValue() != null) { - nwProtocolSource = (Short) (nwProto.getValue()); - } - - switch (nwProtocolSource) { - case TCP: - return Layer4MatchAsTcp(sourceMatch); - case UDP: - return Layer4MatchAsUdp(sourceMatch); - case SCTP: - return Layer4MatchAsSctp(sourceMatch); + nwProtocolSource = (short) ((byte) nwProto.getValue()); + switch (nwProtocolSource) { + case TCP: + return Layer4MatchAsTcp(sourceMatch); + case UDP: + return Layer4MatchAsUdp(sourceMatch); + case SCTP: + return Layer4MatchAsSctp(sourceMatch); + } } return null; } @@ -264,8 +314,9 @@ public class FromSalConversionsUtils { private static Integer transportPortFrom(final Match sourceMatch, final MatchType matchType) { MatchField transportPort = sourceMatch.getField(matchType); - if (transportPort != null && transportPort.getValue() != null) { - return (Integer) (transportPort.getValue()); + if (transportPort != null && transportPort.getValue() != null + && transportPort.getValue().getClass().equals(Short.class)) { + return new Integer(NetUtils.getUnsignedShort((short) transportPort.getValue())); } return null; } @@ -276,13 +327,13 @@ public class FromSalConversionsUtils { MatchField vlan = sourceMatch.getField(MatchType.DL_VLAN); if (vlan != null && vlan.getValue() != null) { VlanIdBuilder vlanIDBuilder = new VlanIdBuilder(); - vlanIDBuilder.setVlanId(new VlanId((Integer) (vlan.getValue()))); + vlanIDBuilder.setVlanId(new VlanId((int) (NetUtils.getUnsignedShort((short) vlan.getValue())))); vlanMatchBuild.setVlanId(vlanIDBuilder.build()); } MatchField vlanPriority = sourceMatch.getField(MatchType.DL_VLAN_PR); if (vlanPriority != null && vlanPriority.getValue() != null) { - vlanMatchBuild.setVlanPcp(new VlanPcp((Short) (vlanPriority.getValue()))); + vlanMatchBuild.setVlanPcp(new VlanPcp((short) ((byte) vlanPriority.getValue()))); } return vlanMatchBuild.build(); @@ -292,13 +343,13 @@ public class FromSalConversionsUtils { IpMatchBuilder targetIpMatchBuild = new IpMatchBuilder(); MatchField networkTos = sourceMatch.getField(MatchType.NW_TOS); if (networkTos != null && networkTos.getValue() != null) { - Dscp dscp = new Dscp((Short) (networkTos.getValue())); + Dscp dscp = new Dscp((short) (NetUtils.getUnsignedByte((Byte) networkTos.getValue()))); targetIpMatchBuild.setIpDscp(dscp); } MatchField protocol = sourceMatch.getField(MatchType.NW_PROTO); if (protocol != null && protocol.getValue() != null) { - targetIpMatchBuild.setIpProtocol((Short) (protocol.getValue())); + targetIpMatchBuild.setIpProtocol((short) ((byte) protocol.getValue())); } return targetIpMatchBuild.build(); @@ -312,17 +363,13 @@ public class FromSalConversionsUtils { .setAddress(ethernetSourceAddressFrom(sourceMatch)); targetEthMatchBuild.setEthernetSource(ethSourBuild.build()); - final MatchField dataLinkDest = sourceMatch.getField(DL_DST); - if (dataLinkDest != null && dataLinkDest.getValue() != null) { - final MacAddress macDestAddress; - macDestAddress = new MacAddress((String) (dataLinkDest.getValue())); - EthernetDestinationBuilder ethDestBuild = new EthernetDestinationBuilder().setAddress(macDestAddress); - targetEthMatchBuild.setEthernetDestination(ethDestBuild.build()); - } + EthernetDestinationBuilder ethDestBuild = new EthernetDestinationBuilder() + .setAddress(ethernetDestAddressFrom(sourceMatch)); + targetEthMatchBuild.setEthernetDestination(ethDestBuild.build()); final MatchField dataLinkType = sourceMatch.getField(MatchType.DL_TYPE); if (dataLinkType != null && dataLinkType.getValue() != null) { - EtherType etherType = new EtherType((Long) (dataLinkType.getValue())); + EtherType etherType = new EtherType(new Long(NetUtils.getUnsignedShort((Short) dataLinkType.getValue()))); EthernetTypeBuilder ethType = new EthernetTypeBuilder().setType(etherType); targetEthMatchBuild.setEthernetType(ethType.build()); } @@ -332,7 +379,7 @@ public class FromSalConversionsUtils { private static MacAddress ethernetSourceAddressFrom(final Match sourceMatch) { final MatchField dataLinkSource = sourceMatch.getField(DL_SRC); if (dataLinkSource != null && dataLinkSource.getValue() != null) { - return new MacAddress(new MacAddress((String) (dataLinkSource.getValue()))); + return new MacAddress(new MacAddress(new String((byte[]) dataLinkSource.getValue()))); } return null; @@ -357,7 +404,7 @@ public class FromSalConversionsUtils { if (dataLinkType != null && dataLinkType.getValue() != null) { dLType = (Short) (dataLinkType.getValue()); } - if (dLType.equals(ETHERNET_ARP)) { + if (dLType != null && dLType.equals(ETHERNET_ARP)) { return setLayer3MatchAsArp(sourceMatch, (Inet4Address) inetSourceAddress, (Inet4Address) inetDestAddress); } else { @@ -373,16 +420,16 @@ public class FromSalConversionsUtils { private static Layer3Match setLayer3MatchAsArp(final Match sourceMatch, final Inet4Address inetSourceAddress, final Inet4Address inetDestAddress) { - byte[] inetSourceAddressValue = inetSourceAddress.getAddress(); - Ipv4Prefix ipv4SourcePrefix = new Ipv4Prefix(Arrays.toString(inetSourceAddressValue)); + String inetSourceAddressStr = InetAddresses.toAddrString(inetSourceAddress); + Ipv4Prefix ipv4SourcePrefix = new Ipv4Prefix(inetSourceAddressStr); - byte[] inetDestAddressValue = inetDestAddress.getAddress(); - Ipv4Prefix ipv4DestPrefix = new Ipv4Prefix(Arrays.toString(inetDestAddressValue)); + String inetDestAddressValue = InetAddresses.toAddrString(inetDestAddress); + Ipv4Prefix ipv4DestPrefix = new Ipv4Prefix(inetDestAddressValue); ArpMatchBuilder arpMatchBuilder = new ArpMatchBuilder(); arpMatchBuilder.setArpSourceTransportAddress(ipv4SourcePrefix); - arpMatchBuilder.setArpSourceTransportAddress(ipv4DestPrefix); + arpMatchBuilder.setArpTargetTransportAddress(ipv4DestPrefix); ArpSourceHardwareAddressBuilder arpSourceHardwareAddressBuilder = new ArpSourceHardwareAddressBuilder(); arpSourceHardwareAddressBuilder.setAddress(ethernetSourceAddressFrom(sourceMatch)); @@ -399,27 +446,31 @@ public class FromSalConversionsUtils { private static MacAddress ethernetDestAddressFrom(final Match sourceMatch) { final MatchField dataLinkDest = sourceMatch.getField(DL_DST); if (dataLinkDest != null && dataLinkDest.getValue() != null) { - return new MacAddress((String) (dataLinkDest.getValue())); + return new MacAddress(new String((byte[]) (dataLinkDest.getValue()))); } return null; } private static Layer3Match setLayer3MatchAsIpv4(final Inet4Address inetSourceAddress, final Inet4Address inetDestAddress) { - byte[] inetAddressValue = inetSourceAddress.getAddress(); + String inetSrcAddressString = InetAddresses.toAddrString(inetSourceAddress); + String inetDstAddressString = InetAddresses.toAddrString(inetDestAddress); Ipv4MatchBuilder layer4MatchBuild = new Ipv4MatchBuilder(); - layer4MatchBuild.setIpv4Source(new Ipv4Prefix(Arrays.toString(inetAddressValue))); + layer4MatchBuild.setIpv4Source(new Ipv4Prefix(inetSrcAddressString)); + layer4MatchBuild.setIpv4Destination(new Ipv4Prefix(inetDstAddressString)); return layer4MatchBuild.build(); } private static Layer3Match setLayer3MatchAsIpv6(final Inet6Address inetSourceAddress, final Inet6Address inetDestAddress) { - byte[] inetAddressValue = inetSourceAddress.getAddress(); + String inetSrcAddressString = InetAddresses.toAddrString(inetSourceAddress); + String inetDstAddressString = InetAddresses.toAddrString(inetDestAddress); Ipv6MatchBuilder layer6MatchBuild = new Ipv6MatchBuilder(); - layer6MatchBuild.setIpv6Source(new Ipv6Prefix(Arrays.toString(inetAddressValue))); + layer6MatchBuild.setIpv6Source(new Ipv6Prefix(inetSrcAddressString)); + layer6MatchBuild.setIpv6Destination(new Ipv6Prefix(inetDstAddressString)); return layer6MatchBuild.build(); }