1 package org.opendaylight.controller.sal.compability;
3 import static org.opendaylight.controller.sal.match.MatchType.DL_DST;
4 import static org.opendaylight.controller.sal.match.MatchType.DL_SRC;
5 import static org.opendaylight.controller.sal.match.MatchType.DL_TYPE;
7 import java.math.BigInteger;
8 import java.net.Inet4Address;
9 import java.net.Inet6Address;
10 import java.net.InetAddress;
11 import java.util.ArrayList;
12 import java.util.Arrays;
13 import java.util.List;
15 import org.opendaylight.controller.sal.action.*;
16 import org.opendaylight.controller.sal.core.NodeConnector;
17 import org.opendaylight.controller.sal.flowprogrammer.Flow;
18 import org.opendaylight.controller.sal.match.Match;
19 import org.opendaylight.controller.sal.match.MatchField;
20 import org.opendaylight.controller.sal.match.MatchType;
21 import org.opendaylight.controller.sal.utils.NetUtils;
22 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.*;
23 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.VlanCfi;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.*;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.Address;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv4Builder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv6Builder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.ActionBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.arp.match.fields.ArpSourceHardwareAddressBuilder;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.arp.match.fields.ArpTargetHardwareAddressBuilder;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetDestinationBuilder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetSourceBuilder;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetTypeBuilder;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.*;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.ArpMatchBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv4MatchBuilder;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv6MatchBuilder;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.SctpMatchBuilder;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.TcpMatchBuilder;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.UdpMatchBuilder;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.vlan.match.fields.VlanIdBuilder;
50 import com.google.common.net.InetAddresses;
52 import static org.opendaylight.controller.sal.compability.ProtocolConstants.ETHERNET_ARP;
53 import static org.opendaylight.controller.sal.compability.ProtocolConstants.SCTP;
54 import static org.opendaylight.controller.sal.compability.ProtocolConstants.TCP;
55 import static org.opendaylight.controller.sal.compability.ProtocolConstants.UDP;
57 public class FromSalConversionsUtils {
59 private FromSalConversionsUtils() {
63 public static FlowAdded flowFrom(Flow sourceFlow) {
64 if (sourceFlow != null) {
65 final FlowAddedBuilder targetFlow = new FlowAddedBuilder();
67 targetFlow.setHardTimeout((int) sourceFlow.getHardTimeout());
68 targetFlow.setIdleTimeout((int) sourceFlow.getIdleTimeout());
69 targetFlow.setPriority((int) sourceFlow.getPriority());
70 targetFlow.setCookie(new BigInteger(String.valueOf(sourceFlow.getId())));
72 List<org.opendaylight.controller.sal.action.Action> sourceActions = sourceFlow.getActions();
73 List<Action> targetActions = new ArrayList<>();
74 for (org.opendaylight.controller.sal.action.Action sourceAction : sourceActions) {
75 targetActions.add(actionFrom(sourceAction));
77 targetFlow.setAction(targetActions);
79 targetFlow.setMatch(matchFrom(sourceFlow.getMatch()));
81 return targetFlow.build();
86 private static Action actionFrom(org.opendaylight.controller.sal.action.Action sourceAction) {
88 ActionBuilder targetActionBuilder = new ActionBuilder();
89 org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.Action targetAction = null;
91 if (sourceAction instanceof Controller) {
92 targetAction = new ControllerActionBuilder().build();
93 } else if (sourceAction instanceof Drop) {
94 targetAction = new DropActionBuilder().build();
95 } else if (sourceAction instanceof Flood) {
96 targetAction = new FloodActionBuilder().build();
97 } else if (sourceAction instanceof FloodAll) {
98 targetAction = new FloodAllActionBuilder().build();
99 } else if (sourceAction instanceof HwPath) {
100 targetAction = new HwPathActionBuilder().build();
101 } else if (sourceAction instanceof Loopback) {
102 targetAction = new LoopbackActionBuilder().build();
103 } else if (sourceAction instanceof Output) {
104 NodeConnector nodeConnector = ((Output) sourceAction).getPort();
106 OutputActionBuilder outputActionBuilder = new OutputActionBuilder();
107 outputActionBuilder.setOutputNodeConnector(nodeConnectorToUri(nodeConnector));
108 targetAction = outputActionBuilder.build();
110 } else if (sourceAction instanceof PopVlan) {
111 targetAction = new PopVlanActionBuilder().build();
112 } else if (sourceAction instanceof PushVlan) {
113 PushVlan pushVlan = (PushVlan) sourceAction;
114 PushVlanActionBuilder pushVlanActionBuilder = new PushVlanActionBuilder();
116 pushVlanActionBuilder.setCfi(new VlanCfi(pushVlan.getCfi()));
117 pushVlanActionBuilder.setVlanId(new VlanId(pushVlan.getVlanId()));
118 pushVlanActionBuilder.setPcp(pushVlan.getPcp());
119 pushVlanActionBuilder.setTag(pushVlan.getTag());
120 targetAction = pushVlanActionBuilder.build();
121 } else if (sourceAction instanceof SetDlDst) {
122 SetDlDst setDlDst = (SetDlDst) sourceAction;
123 SetDlDstActionBuilder setDlDstActionBuilder = new SetDlDstActionBuilder();
125 setDlDstActionBuilder.setAddress(new MacAddress(new String(setDlDst.getDlAddress())));
126 targetAction = setDlDstActionBuilder.build();
127 } else if (sourceAction instanceof SetDlSrc) {
128 SetDlSrc setDlSrc = (SetDlSrc) sourceAction;
129 SetDlSrcActionBuilder setDlSrcActionBuilder = new SetDlSrcActionBuilder();
131 setDlSrcActionBuilder.setAddress(new MacAddress(new String(setDlSrc.getDlAddress())));
132 targetAction = setDlSrcActionBuilder.build();
133 } else if (sourceAction instanceof SetDlType) {
134 SetDlType setDlType = (SetDlType) sourceAction;
135 SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
137 setDlTypeActionBuilder.setDlType(new EtherType(new Long(setDlType.getDlType())));
138 targetAction = setDlTypeActionBuilder.build();
139 } else if (sourceAction instanceof SetNextHop) {
140 SetNextHop setNextHop = (SetNextHop) sourceAction;
141 SetNextHopActionBuilder setNextHopActionBuilder = new SetNextHopActionBuilder();
143 InetAddress inetAddress = setNextHop.getAddress();
144 setNextHopActionBuilder.setAddress(addressFromAction(inetAddress));
146 targetAction = setNextHopActionBuilder.build();
147 } else if (sourceAction instanceof SetNwDst) {
148 SetNwDst setNwDst = (SetNwDst) sourceAction;
149 SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
151 InetAddress inetAddress = setNwDst.getAddress();
152 setNwDstActionBuilder.setAddress(addressFromAction(inetAddress));
154 targetAction = setNwDstActionBuilder.build();
155 } else if (sourceAction instanceof SetNwSrc) {
156 SetNwSrc setNwSrc = (SetNwSrc) sourceAction;
157 SetNwSrcActionBuilder setNwSrcActionBuilder = new SetNwSrcActionBuilder();
159 InetAddress inetAddress = setNwSrc.getAddress();
160 setNwSrcActionBuilder.setAddress(addressFromAction(inetAddress));
162 targetAction = setNwSrcActionBuilder.build();
163 } else if (sourceAction instanceof SetNwTos) {
164 SetNwTos setNwTos = (SetNwTos) sourceAction;
165 SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
167 setNwTosActionBuilder.setTos(setNwTos.getNwTos());
168 targetAction = setNwTosActionBuilder.build();
169 } else if (sourceAction instanceof SetTpDst) {
170 SetTpDst setTpDst = (SetTpDst) sourceAction;
171 SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
173 setTpDstActionBuilder.setPort(new PortNumber(setTpDst.getPort()));
175 targetAction = setTpDstActionBuilder.build();
176 } else if (sourceAction instanceof SetTpSrc) {
177 SetTpSrc setTpSrc = (SetTpSrc) sourceAction;
178 SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
180 setTpSrcActionBuilder.setPort(new PortNumber(setTpSrc.getPort()));
182 targetAction = setTpSrcActionBuilder.build();
183 } else if (sourceAction instanceof SetVlanCfi) {
184 SetVlanCfi setVlanCfi = (SetVlanCfi) sourceAction;
185 SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
187 setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(setVlanCfi.getCfi()));
189 targetAction = setVlanCfiActionBuilder.build();
190 } else if (sourceAction instanceof SetVlanId) {
191 SetVlanId setVlanId = (SetVlanId) sourceAction;
192 SetVlanIdActionBuilder setVlanIdActionBuilder = new SetVlanIdActionBuilder();
194 setVlanIdActionBuilder.setVlanId(new VlanId(setVlanId.getVlanId()));
196 targetAction = setVlanIdActionBuilder.build();
197 } else if (sourceAction instanceof SetVlanPcp) {
198 SetVlanPcp setVlanPcp = (SetVlanPcp) sourceAction;
199 SetVlanPcpActionBuilder setVlanPcpActionBuilder = new SetVlanPcpActionBuilder();
201 setVlanPcpActionBuilder.setVlanPcp(new VlanPcp((short) setVlanPcp.getPcp()));
203 targetAction = setVlanPcpActionBuilder.build();
204 } else if (sourceAction instanceof SwPath) {
205 targetAction = new SwPathActionBuilder().build();
208 targetActionBuilder.setAction(targetAction);
210 return targetActionBuilder.build();
213 private static Address addressFromAction(InetAddress inetAddress) {
214 String strInetAddresss = InetAddresses.toAddrString(inetAddress);
215 if (inetAddress instanceof Inet4Address) {
216 Ipv4Builder ipv4Builder = new Ipv4Builder();
217 ipv4Builder.setIpv4Address(new Ipv4Prefix(strInetAddresss));
218 return ipv4Builder.build();
219 } else if (inetAddress instanceof Inet6Address) {
220 Ipv6Builder ipv6Builder = new Ipv6Builder();
221 ipv6Builder.setIpv6Address(new Ipv6Prefix(strInetAddresss));
222 return ipv6Builder.build();
227 private static List<Uri> nodeConnectorToUri(NodeConnector nodeConnector) {
228 // TODO Define mapping
232 private static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Match matchFrom(
234 if (sourceMatch != null) {
235 org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.MatchBuilder targetBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.MatchBuilder();
237 targetBuilder.setEthernetMatch(ethernetMatchFrom(sourceMatch));
238 targetBuilder.setIpMatch(ipMatchFrom(sourceMatch));
239 targetBuilder.setVlanMatch(vlanMatchFrom(sourceMatch));
240 targetBuilder.setLayer3Match(layer3Match(sourceMatch));
241 targetBuilder.setLayer4Match(layer4Match(sourceMatch));
243 return targetBuilder.build();
249 private static Layer4Match layer4Match(final Match sourceMatch) {
250 MatchField nwProto = sourceMatch.getField(MatchType.NW_PROTO);
251 Short nwProtocolSource = null;
252 if (nwProto != null && nwProto.getValue() != null) {
253 nwProtocolSource = (short) ((byte) nwProto.getValue());
254 switch (nwProtocolSource) {
256 return Layer4MatchAsTcp(sourceMatch);
258 return Layer4MatchAsUdp(sourceMatch);
260 return Layer4MatchAsSctp(sourceMatch);
266 private static Layer4Match Layer4MatchAsSctp(final Match sourceMatch) {
267 SctpMatchBuilder sctpMatchBuilder = new SctpMatchBuilder();
269 Integer sourcePort = transportPortFrom(sourceMatch, MatchType.TP_SRC);
270 Integer destinationPort = transportPortFrom(sourceMatch, MatchType.TP_DST);
272 if (sourcePort != null) {
273 sctpMatchBuilder.setSctpSourcePort(new PortNumber(sourcePort));
275 if (destinationPort != null) {
276 sctpMatchBuilder.setSctpDestinationPort(new PortNumber(destinationPort));
279 return sctpMatchBuilder.build();
282 private static Layer4Match Layer4MatchAsUdp(final Match sourceMatch) {
283 UdpMatchBuilder udpMatchBuilder = new UdpMatchBuilder();
285 Integer sourcePort = transportPortFrom(sourceMatch, MatchType.TP_SRC);
286 Integer destinationPort = transportPortFrom(sourceMatch, MatchType.TP_DST);
288 if (sourcePort != null) {
289 udpMatchBuilder.setUdpSourcePort(new PortNumber(sourcePort));
292 if (destinationPort != null) {
293 udpMatchBuilder.setUdpDestinationPort(new PortNumber(destinationPort));
296 return udpMatchBuilder.build();
299 private static Layer4Match Layer4MatchAsTcp(final Match sourceMatch) {
300 TcpMatchBuilder tcpMatchBuilder = new TcpMatchBuilder();
302 Integer sourcePort = transportPortFrom(sourceMatch, MatchType.TP_SRC);
303 Integer destinationPort = transportPortFrom(sourceMatch, MatchType.TP_DST);
305 if (sourcePort != null) {
306 tcpMatchBuilder.setTcpSourcePort(new PortNumber(sourcePort));
308 if (destinationPort != null) {
309 tcpMatchBuilder.setTcpDestinationPort(new PortNumber(destinationPort));
312 return tcpMatchBuilder.build();
315 private static Integer transportPortFrom(final Match sourceMatch, final MatchType matchType) {
316 MatchField transportPort = sourceMatch.getField(matchType);
317 if (transportPort != null && transportPort.getValue() != null
318 && transportPort.getValue().getClass().equals(Short.class)) {
319 return new Integer(NetUtils.getUnsignedShort((short) transportPort.getValue()));
324 private static VlanMatch vlanMatchFrom(final Match sourceMatch) {
325 VlanMatchBuilder vlanMatchBuild = new VlanMatchBuilder();
327 MatchField vlan = sourceMatch.getField(MatchType.DL_VLAN);
328 if (vlan != null && vlan.getValue() != null) {
329 VlanIdBuilder vlanIDBuilder = new VlanIdBuilder();
330 vlanIDBuilder.setVlanId(new VlanId((int) (NetUtils.getUnsignedShort((short) vlan.getValue()))));
331 vlanMatchBuild.setVlanId(vlanIDBuilder.build());
334 MatchField vlanPriority = sourceMatch.getField(MatchType.DL_VLAN_PR);
335 if (vlanPriority != null && vlanPriority.getValue() != null) {
336 vlanMatchBuild.setVlanPcp(new VlanPcp((short) ((byte) vlanPriority.getValue())));
339 return vlanMatchBuild.build();
342 private static IpMatch ipMatchFrom(final Match sourceMatch) {
343 IpMatchBuilder targetIpMatchBuild = new IpMatchBuilder();
344 MatchField networkTos = sourceMatch.getField(MatchType.NW_TOS);
345 if (networkTos != null && networkTos.getValue() != null) {
346 Dscp dscp = new Dscp((short) (NetUtils.getUnsignedByte((Byte) networkTos.getValue())));
347 targetIpMatchBuild.setIpDscp(dscp);
350 MatchField protocol = sourceMatch.getField(MatchType.NW_PROTO);
351 if (protocol != null && protocol.getValue() != null) {
352 targetIpMatchBuild.setIpProtocol((short) ((byte) protocol.getValue()));
355 return targetIpMatchBuild.build();
359 private static EthernetMatch ethernetMatchFrom(final Match sourceMatch) {
360 final EthernetMatchBuilder targetEthMatchBuild = new EthernetMatchBuilder();
362 EthernetSourceBuilder ethSourBuild = new EthernetSourceBuilder()
363 .setAddress(ethernetSourceAddressFrom(sourceMatch));
364 targetEthMatchBuild.setEthernetSource(ethSourBuild.build());
366 EthernetDestinationBuilder ethDestBuild = new EthernetDestinationBuilder()
367 .setAddress(ethernetDestAddressFrom(sourceMatch));
368 targetEthMatchBuild.setEthernetDestination(ethDestBuild.build());
370 final MatchField dataLinkType = sourceMatch.getField(MatchType.DL_TYPE);
371 if (dataLinkType != null && dataLinkType.getValue() != null) {
372 EtherType etherType = new EtherType(new Long(NetUtils.getUnsignedShort((Short) dataLinkType.getValue())));
373 EthernetTypeBuilder ethType = new EthernetTypeBuilder().setType(etherType);
374 targetEthMatchBuild.setEthernetType(ethType.build());
376 return targetEthMatchBuild.build();
379 private static MacAddress ethernetSourceAddressFrom(final Match sourceMatch) {
380 final MatchField dataLinkSource = sourceMatch.getField(DL_SRC);
381 if (dataLinkSource != null && dataLinkSource.getValue() != null) {
382 return new MacAddress(new MacAddress(new String((byte[]) dataLinkSource.getValue())));
388 private static Layer3Match layer3Match(final Match sourceMatch) {
389 InetAddress inetSourceAddress = null;
390 MatchField netSource = sourceMatch.getField(MatchType.NW_SRC);
391 if (netSource != null && netSource.getValue() != null) {
392 inetSourceAddress = (InetAddress) (netSource.getValue());
395 InetAddress inetDestAddress = null;
396 MatchField netDest = sourceMatch.getField(MatchType.NW_DST);
397 if (netSource != null && netSource.getValue() != null) {
398 inetDestAddress = (InetAddress) (netDest.getValue());
401 if ((inetSourceAddress instanceof Inet4Address) && (inetDestAddress instanceof Inet4Address)) {
402 MatchField dataLinkType = sourceMatch.getField(DL_TYPE);
404 if (dataLinkType != null && dataLinkType.getValue() != null) {
405 dLType = (Short) (dataLinkType.getValue());
407 if (dLType != null && dLType.equals(ETHERNET_ARP)) {
408 return setLayer3MatchAsArp(sourceMatch, (Inet4Address) inetSourceAddress,
409 (Inet4Address) inetDestAddress);
411 return setLayer3MatchAsIpv4((Inet4Address) inetSourceAddress, (Inet4Address) inetDestAddress);
413 } else if ((inetSourceAddress instanceof Inet6Address) && (inetDestAddress instanceof Inet6Address)) {
414 return setLayer3MatchAsIpv6((Inet6Address) inetSourceAddress, (Inet6Address) inetDestAddress);
421 private static Layer3Match setLayer3MatchAsArp(final Match sourceMatch, final Inet4Address inetSourceAddress,
422 final Inet4Address inetDestAddress) {
423 String inetSourceAddressStr = InetAddresses.toAddrString(inetSourceAddress);
424 Ipv4Prefix ipv4SourcePrefix = new Ipv4Prefix(inetSourceAddressStr);
426 String inetDestAddressValue = InetAddresses.toAddrString(inetDestAddress);
427 Ipv4Prefix ipv4DestPrefix = new Ipv4Prefix(inetDestAddressValue);
429 ArpMatchBuilder arpMatchBuilder = new ArpMatchBuilder();
431 arpMatchBuilder.setArpSourceTransportAddress(ipv4SourcePrefix);
432 arpMatchBuilder.setArpTargetTransportAddress(ipv4DestPrefix);
434 ArpSourceHardwareAddressBuilder arpSourceHardwareAddressBuilder = new ArpSourceHardwareAddressBuilder();
435 arpSourceHardwareAddressBuilder.setAddress(ethernetSourceAddressFrom(sourceMatch));
436 arpMatchBuilder.setArpSourceHardwareAddress(arpSourceHardwareAddressBuilder.build());
438 ArpTargetHardwareAddressBuilder arpTargetHardwareAddressBuilder = new ArpTargetHardwareAddressBuilder();
439 arpTargetHardwareAddressBuilder.setAddress(ethernetDestAddressFrom(sourceMatch));
440 arpMatchBuilder.setArpTargetHardwareAddress(arpTargetHardwareAddressBuilder.build());
442 return arpMatchBuilder.build();
446 private static MacAddress ethernetDestAddressFrom(final Match sourceMatch) {
447 final MatchField dataLinkDest = sourceMatch.getField(DL_DST);
448 if (dataLinkDest != null && dataLinkDest.getValue() != null) {
449 return new MacAddress(new String((byte[]) (dataLinkDest.getValue())));
454 private static Layer3Match setLayer3MatchAsIpv4(final Inet4Address inetSourceAddress,
455 final Inet4Address inetDestAddress) {
456 String inetSrcAddressString = InetAddresses.toAddrString(inetSourceAddress);
457 String inetDstAddressString = InetAddresses.toAddrString(inetDestAddress);
459 Ipv4MatchBuilder layer4MatchBuild = new Ipv4MatchBuilder();
460 layer4MatchBuild.setIpv4Source(new Ipv4Prefix(inetSrcAddressString));
461 layer4MatchBuild.setIpv4Destination(new Ipv4Prefix(inetDstAddressString));
462 return layer4MatchBuild.build();
466 private static Layer3Match setLayer3MatchAsIpv6(final Inet6Address inetSourceAddress,
467 final Inet6Address inetDestAddress) {
468 String inetSrcAddressString = InetAddresses.toAddrString(inetSourceAddress);
469 String inetDstAddressString = InetAddresses.toAddrString(inetDestAddress);
470 Ipv6MatchBuilder layer6MatchBuild = new Ipv6MatchBuilder();
472 layer6MatchBuild.setIpv6Source(new Ipv6Prefix(inetSrcAddressString));
473 layer6MatchBuild.setIpv6Destination(new Ipv6Prefix(inetDstAddressString));
474 return layer6MatchBuild.build();