- return matchBuilder;
- }
-
- /**
- * Method converts Openflow 1.3+ specific flow match to MD-SAL format flow
- * match
- *
- * @param swMatch source match
- * @param datapathid datapath id
- * @param ofVersion openflow version
- * @return md-sal match instance
- * @author avishnoi@in.ibm.com
- */
- public static MatchBuilder fromOFMatchToSALMatch(
- @Nonnull final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match swMatch,
- @Nonnull final BigInteger datapathid, @Nonnull final OpenflowVersion ofVersion) {
- return OfMatchToSALMatchConvertor(swMatch.getMatchEntry(), datapathid, ofVersion);
- }
-
- private static MatchBuilder OfMatchToSALMatchConvertor(final List<MatchEntry> swMatchList, final BigInteger datapathid,
- final OpenflowVersion ofVersion) {
-
- MatchBuilder matchBuilder = new MatchBuilder();
- EthernetMatchBuilder ethMatchBuilder = new EthernetMatchBuilder();
- VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
- IpMatchBuilder ipMatchBuilder = new IpMatchBuilder();
- TcpMatchBuilder tcpMatchBuilder = new TcpMatchBuilder();
- UdpMatchBuilder udpMatchBuilder = new UdpMatchBuilder();
- SctpMatchBuilder sctpMatchBuilder = new SctpMatchBuilder();
- Icmpv4MatchBuilder icmpv4MatchBuilder = new Icmpv4MatchBuilder();
- Icmpv6MatchBuilder icmpv6MatchBuilder = new Icmpv6MatchBuilder();
- Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
- ArpMatchBuilder arpMatchBuilder = new ArpMatchBuilder();
- Ipv6MatchBuilder ipv6MatchBuilder = new Ipv6MatchBuilder();
- ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = new ProtocolMatchFieldsBuilder();
- TunnelIpv4MatchBuilder tunnelIpv4MatchBuilder = new TunnelIpv4MatchBuilder();
-
- for (MatchEntry ofMatch : swMatchList) {
-
- if (ofMatch.getOxmMatchField().equals(InPort.class)) {
- PortNumber portNumber = ((InPortCase) ofMatch.getMatchEntryValue()).getInPort().getPortNumber();
- if (portNumber != null) {
- matchBuilder.setInPort(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathid, portNumber.getValue(), ofVersion));
- }
- } else if (ofMatch.getOxmMatchField().equals(InPhyPort.class)) {
- PortNumber portNumber = ((InPhyPortCase) ofMatch.getMatchEntryValue()).getInPhyPort().getPortNumber();
- matchBuilder.setInPhyPort(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathid,
- portNumber.getValue(), ofVersion));
- } else if (ofMatch.getOxmMatchField().equals(Metadata.class)) {
- MetadataBuilder metadataBuilder = new MetadataBuilder();
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.Metadata metadata = ((MetadataCase) ofMatch.getMatchEntryValue()).getMetadata();
- if (metadata != null) {
- metadataBuilder.setMetadata(new BigInteger(OFConstants.SIGNUM_UNSIGNED, metadata.getMetadata()));
- byte[] metadataMask = metadata.getMask();
- if (metadataMask != null) {
- metadataBuilder.setMetadataMask(new BigInteger(OFConstants.SIGNUM_UNSIGNED, metadataMask));
- }
- matchBuilder.setMetadata(metadataBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(EthSrc.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.src._case.EthSrc ethSrcCase = ((EthSrcCase) ofMatch.getMatchEntryValue()).getEthSrc();
- if (ethSrcCase != null) {
- EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
- ethSourceBuilder.setAddress(ethSrcCase.getMacAddress());
- byte[] mask = ethSrcCase.getMask();
- if (mask != null) {
- ethSourceBuilder.setMask(new MacAddress(macAddressToString(mask)));
- }
- ethMatchBuilder.setEthernetSource(ethSourceBuilder.build());
- matchBuilder.setEthernetMatch(ethMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(EthDst.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.dst._case.EthDst ethDstCase = ((EthDstCase) ofMatch.getMatchEntryValue()).getEthDst();
- if (ethDstCase != null) {
- EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
- ethDestinationBuilder.setAddress(ethDstCase.getMacAddress());
- byte[] destinationMask = ethDstCase.getMask();
- if (destinationMask != null) {
- ethDestinationBuilder.setMask(new MacAddress(macAddressToString(destinationMask)));
- }
- ethMatchBuilder.setEthernetDestination(ethDestinationBuilder.build());
- matchBuilder.setEthernetMatch(ethMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(EthType.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.eth.type._case.EthType ethTypeCase = ((EthTypeCase) ofMatch.getMatchEntryValue()).getEthType();
- if (ethTypeCase != null) {
- EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- ethTypeBuilder
- .setType(new org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType(
- (long) ethTypeCase.getEthType().getValue()));
- ethMatchBuilder.setEthernetType(ethTypeBuilder.build());
- matchBuilder.setEthernetMatch(ethMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(VlanVid.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.vid._case.VlanVid vlanVid = ((VlanVidCase) ofMatch.getMatchEntryValue()).getVlanVid();
- if (vlanVid != null) {
- VlanIdBuilder vlanBuilder = new VlanIdBuilder();
- vlanBuilder.setVlanId(new org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId(
- vlanVid.getVlanVid()))
- .setVlanIdPresent(vlanVid.isCfiBit());
- vlanBuilder.setVlanIdPresent(vlanVid.isCfiBit());
- vlanMatchBuilder.setVlanId(vlanBuilder.build());
-
- matchBuilder.setVlanMatch(vlanMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(VlanPcp.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.pcp._case.VlanPcp vlanPcp = ((VlanPcpCase) ofMatch.getMatchEntryValue()).getVlanPcp();
- if (vlanPcp != null) {
- vlanMatchBuilder
- .setVlanPcp(new org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp(
- vlanPcp.getVlanPcp()));
- matchBuilder.setVlanMatch(vlanMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(IpDscp.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ip.dscp._case.IpDscp ipDscp = ((IpDscpCase) ofMatch.getMatchEntryValue()).getIpDscp();
- if (ipDscp != null) {
- ipMatchBuilder.setIpDscp(new Dscp(ipDscp.getDscp().getValue()));
- matchBuilder.setIpMatch(ipMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(IpEcn.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ip.ecn._case.IpEcn ipEcn = ((IpEcnCase) ofMatch.getMatchEntryValue()).getIpEcn();
- if (ipEcn != null) {
- ipMatchBuilder.setIpEcn(ipEcn.getEcn());
- matchBuilder.setIpMatch(ipMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(IpProto.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ip.proto._case.IpProto ipProto = ((IpProtoCase) ofMatch.getMatchEntryValue()).getIpProto();
- Short protocolNumber = ipProto.getProtocolNumber();
- if (protocolNumber != null) {
- ipMatchBuilder.setIpProtocol(protocolNumber);
- matchBuilder.setIpMatch(ipMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(TcpSrc.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrc tcpSrc = ((TcpSrcCase) ofMatch.getMatchEntryValue()).getTcpSrc();
- if (tcpSrc != null) {
- tcpMatchBuilder.setTcpSourcePort(tcpSrc.getPort());
- matchBuilder.setLayer4Match(tcpMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(TcpDst.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDst tcpDst = ((TcpDstCase) ofMatch.getMatchEntryValue()).getTcpDst();
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber portNumber = tcpDst.getPort();
- if (portNumber != null) {
- tcpMatchBuilder.setTcpDestinationPort(portNumber);
- matchBuilder.setLayer4Match(tcpMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(UdpSrc.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrc udpSrc = ((UdpSrcCase) ofMatch.getMatchEntryValue()).getUdpSrc();
- if (udpSrc != null) {
- udpMatchBuilder.setUdpSourcePort(udpSrc.getPort());
- matchBuilder.setLayer4Match(udpMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(UdpDst.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.dst._case.UdpDst udpDst = ((UdpDstCase) ofMatch.getMatchEntryValue()).getUdpDst();
- if (udpDst != null) {
- udpMatchBuilder.setUdpDestinationPort(udpDst.getPort());
- matchBuilder.setLayer4Match(udpMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(SctpSrc.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.sctp.src._case.SctpSrc sctpSrc = ((SctpSrcCase) ofMatch.getMatchEntryValue()).getSctpSrc();
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber portNumber = sctpSrc.getPort();
- if (portNumber != null) {
- sctpMatchBuilder.setSctpSourcePort(portNumber);
- matchBuilder.setLayer4Match(sctpMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(SctpDst.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.sctp.dst._case.SctpDst sctpDst = ((SctpDstCase) ofMatch.getMatchEntryValue()).getSctpDst();
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber portNumber = sctpDst.getPort();
- if (portNumber != null) {
- sctpMatchBuilder.setSctpDestinationPort(portNumber);
- matchBuilder.setLayer4Match(sctpMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Icmpv4Type.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.type._case.Icmpv4Type icmpv4Type = ((Icmpv4TypeCase) ofMatch.getMatchEntryValue()).getIcmpv4Type();
- Short type = icmpv4Type.getIcmpv4Type();
- if (type != null) {
- icmpv4MatchBuilder.setIcmpv4Type(type);
- matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Icmpv4Code.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.code._case.Icmpv4Code icmpv4Code = ((Icmpv4CodeCase) ofMatch.getMatchEntryValue()).getIcmpv4Code();
- Short v4code = icmpv4Code.getIcmpv4Code();
- if (v4code != null) {
- icmpv4MatchBuilder.setIcmpv4Code(v4code);
- matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Icmpv6Type.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.type._case.Icmpv6Type icmpv6Type = ((Icmpv6TypeCase) ofMatch.getMatchEntryValue()).getIcmpv6Type();
- Short v6type = icmpv6Type.getIcmpv6Type();
- if (v6type != null) {
- icmpv6MatchBuilder.setIcmpv6Type(v6type);
- matchBuilder.setIcmpv6Match(icmpv6MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Icmpv6Code.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.code._case.Icmpv6Code icmpv6Code = ((Icmpv6CodeCase) ofMatch.getMatchEntryValue()).getIcmpv6Code();
- Short v6code = icmpv6Code.getIcmpv6Code();
- if (v6code != null) {
- icmpv6MatchBuilder.setIcmpv6Code(v6code);
- matchBuilder.setIcmpv6Match(icmpv6MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Ipv4Src.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.src._case.Ipv4Src ipv4Address = ((Ipv4SrcCase) ofMatch.getMatchEntryValue()).getIpv4Src();
- if (ipv4Address != null) {
- byte[] mask = ipv4Address.getMask();
- String ipv4PrefixStr = ipv4Address.getIpv4Address().getValue();
- setIpv4MatchBuilderFields(ipv4MatchBuilder, ofMatch, mask, ipv4PrefixStr);
- matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Ipv4Dst.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.dst._case.Ipv4Dst ipv4Address = ((Ipv4DstCase) ofMatch.getMatchEntryValue()).getIpv4Dst();
- if (ipv4Address != null) {
- byte[] mask = ipv4Address.getMask();
- String ipv4PrefixStr = ipv4Address.getIpv4Address().getValue();
- setIpv4MatchBuilderFields(ipv4MatchBuilder, ofMatch, mask, ipv4PrefixStr);
- matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(TunnelIpv4Dst.class)
- || ofMatch.getOxmMatchField().equals(TunnelIpv4Src.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.dst._case.Ipv4Dst tunnelIpv4Dst = ((Ipv4DstCase) ofMatch.getMatchEntryValue()).getIpv4Dst();
- if (tunnelIpv4Dst != null) {
- String ipv4PrefixStr = tunnelIpv4Dst.getIpv4Address().getValue();
- byte[] mask = tunnelIpv4Dst.getMask();
- ipv4PrefixStr += IpConversionUtil.PREFIX_SEPARATOR + ByteBuffer.wrap(tunnelIpv4Dst.getMask()).getInt();
- setIpv4MatchBuilderFields(ipv4MatchBuilder, ofMatch, mask, ipv4PrefixStr);
- matchBuilder.setLayer3Match(tunnelIpv4MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(TunnelIpv4Src.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv4.src._case.Ipv4Src tunnelIpv4Dst = ((Ipv4SrcCase) ofMatch.getMatchEntryValue()).getIpv4Src();
- if (tunnelIpv4Dst != null) {
- String ipv4PrefixStr = tunnelIpv4Dst.getIpv4Address().getValue();
- byte[] mask = tunnelIpv4Dst.getMask();
- ipv4PrefixStr += IpConversionUtil.PREFIX_SEPARATOR + ByteBuffer.wrap(tunnelIpv4Dst.getMask()).getInt();
- setIpv4MatchBuilderFields(ipv4MatchBuilder, ofMatch, mask, ipv4PrefixStr);
- matchBuilder.setLayer3Match(tunnelIpv4MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(ArpOp.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.arp.op._case.ArpOp arpOp = ((ArpOpCase) ofMatch.getMatchEntryValue()).getArpOp();
- if (arpOp != null) {
- arpMatchBuilder.setArpOp(arpOp.getOpCode());
-
- matchBuilder.setLayer3Match(arpMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(ArpSpa.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.arp.spa._case.ArpSpa arpSpa = ((ArpSpaCase) ofMatch.getMatchEntryValue()).getArpSpa();
- if (arpSpa != null) {
- int mask = 32;
- if (null != arpSpa.getMask()){
- mask = IpConversionUtil.countBits(arpSpa.getMask());
- }
- Ipv4Prefix ipv4Prefix = IpConversionUtil.createPrefix(arpSpa.getIpv4Address(), mask);
- arpMatchBuilder.setArpSourceTransportAddress(ipv4Prefix);
- matchBuilder.setLayer3Match(arpMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(ArpTpa.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.arp.tpa._case.ArpTpa arpTpa = ((ArpTpaCase) ofMatch.getMatchEntryValue()).getArpTpa();
- if (arpTpa != null) {
- int mask = 32;
- if (null != arpTpa.getMask()){
- mask = IpConversionUtil.countBits(arpTpa.getMask());
- }
- Ipv4Prefix ipv4Prefix = IpConversionUtil.createPrefix(arpTpa.getIpv4Address(), mask);
-
- arpMatchBuilder.setArpTargetTransportAddress(ipv4Prefix);
- matchBuilder.setLayer3Match(arpMatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(ArpSha.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.arp.sha._case.ArpSha arpSha = ((ArpShaCase) ofMatch.getMatchEntryValue()).getArpSha();
- MacAddress macAddress = arpSha.getMacAddress();
- if (macAddress != null) {
- if (ofMatch.getOxmMatchField().equals(ArpSha.class)) {
- ArpSourceHardwareAddressBuilder arpSourceHardwareAddressBuilder = new ArpSourceHardwareAddressBuilder();
- arpSourceHardwareAddressBuilder.setAddress(macAddress);
- byte[] mask = arpSha.getMask();
- if (mask != null) {
- arpSourceHardwareAddressBuilder.setMask(new MacAddress(ByteBufUtils
- .macAddressToString(mask)));
- }
- arpMatchBuilder.setArpSourceHardwareAddress(arpSourceHardwareAddressBuilder.build());
- matchBuilder.setLayer3Match(arpMatchBuilder.build());
- }
- }
- } else if (ofMatch.getOxmMatchField().equals(ArpTha.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.arp.tha._case.ArpTha arpTha = ((ArpThaCase) ofMatch.getMatchEntryValue()).getArpTha();
- MacAddress macAddress = arpTha.getMacAddress();
- if (macAddress != null) {
- if (ofMatch.getOxmMatchField().equals(ArpTha.class)) {
- ArpTargetHardwareAddressBuilder arpTargetHardwareAddressBuilder = new ArpTargetHardwareAddressBuilder();
- arpTargetHardwareAddressBuilder.setAddress(macAddress);
- byte[] mask = arpTha.getMask();
- if (mask != null) {
- arpTargetHardwareAddressBuilder.setMask(new MacAddress(ByteBufUtils
- .macAddressToString(mask)));
- }
- arpMatchBuilder.setArpTargetHardwareAddress(arpTargetHardwareAddressBuilder.build());
- matchBuilder.setLayer3Match(arpMatchBuilder.build());
- }
- }
- } else if (ofMatch.getOxmMatchField().equals(Ipv6Src.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.src._case.Ipv6Src ipv6Src = ((Ipv6SrcCase) ofMatch.getMatchEntryValue()).getIpv6Src();
-
- if (ipv6Src != null) {
- String ipv6PrefixStr = ipv6Src.getIpv6Address().getValue();
- byte[] mask = ipv6Src.getMask();
- setIpv6MatchBuilderFields(ipv6MatchBuilder, ofMatch, ipv6PrefixStr, mask);
- matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Ipv6Dst.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.dst._case.Ipv6Dst ipv6Dst = ((Ipv6DstCase) ofMatch.getMatchEntryValue()).getIpv6Dst();
-
- if (ipv6Dst != null) {
- String ipv6PrefixStr = ipv6Dst.getIpv6Address().getValue();
- byte[] mask = ipv6Dst.getMask();
- setIpv6MatchBuilderFields(ipv6MatchBuilder, ofMatch, ipv6PrefixStr, mask);
- matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Ipv6Flabel.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.flabel._case.Ipv6Flabel ipv6Flabel = ((Ipv6FlabelCase) ofMatch.getMatchEntryValue()).getIpv6Flabel();
- if (ipv6Flabel != null) {
- Ipv6LabelBuilder ipv6LabelBuilder = new Ipv6LabelBuilder();
- ipv6LabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(ipv6Flabel.getIpv6Flabel()));
- byte[] mask = ipv6Flabel.getMask();
- if (mask != null) {
- ipv6LabelBuilder.setFlabelMask(new Ipv6FlowLabel(Long.valueOf(ByteUtil
- .bytesToUnsignedInt(mask))));
- }
- ipv6MatchBuilder.setIpv6Label(ipv6LabelBuilder.build());
- matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Ipv6NdTarget.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.target._case.Ipv6NdTarget ipv6NdTarget = ((Ipv6NdTargetCase) ofMatch.getMatchEntryValue()).getIpv6NdTarget();
- if (ipv6NdTarget != null) {
- ipv6MatchBuilder.setIpv6NdTarget(ipv6NdTarget.getIpv6Address());
- matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Ipv6NdSll.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.sll._case.Ipv6NdSll ipv6NdSll = ((Ipv6NdSllCase) ofMatch.getMatchEntryValue()).getIpv6NdSll();
- if (ipv6NdSll != null) {
- ipv6MatchBuilder.setIpv6NdSll(ipv6NdSll.getMacAddress());
- matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Ipv6NdTll.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.tll._case.Ipv6NdTll ipv6NdTll = ((Ipv6NdTllCase) ofMatch.getMatchEntryValue()).getIpv6NdTll();
- if (ipv6NdTll != null) {
- ipv6MatchBuilder.setIpv6NdTll(ipv6NdTll.getMacAddress());
- matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(Ipv6Exthdr.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.exthdr._case.Ipv6Exthdr ipv6Exthdr = ((Ipv6ExthdrCase) ofMatch.getMatchEntryValue()).getIpv6Exthdr();
- if (ipv6Exthdr != null) {
- Ipv6ExtHeaderBuilder ipv6ExtHeaderBuilder = new Ipv6ExtHeaderBuilder();
-
- Ipv6ExthdrFlags pField = ipv6Exthdr.getPseudoField();
- Integer bitmap = MatchConvertorUtil.ipv6ExthdrFlagsToInt(pField);
-
- ipv6ExtHeaderBuilder.setIpv6Exthdr(bitmap);
- byte[] mask = ipv6Exthdr.getMask();
- if (mask != null) {
- ipv6ExtHeaderBuilder.setIpv6ExthdrMask(ByteUtil.bytesToUnsignedShort(mask));
- }
- ipv6MatchBuilder.setIpv6ExtHeader(ipv6ExtHeaderBuilder.build());
- matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(MplsLabel.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.label._case.MplsLabel mplsLabel = ((MplsLabelCase) ofMatch.getMatchEntryValue()).getMplsLabel();
- if (mplsLabel != null) {
- protocolMatchFieldsBuilder.setMplsLabel(mplsLabel.getMplsLabel());
- matchBuilder.setProtocolMatchFields(protocolMatchFieldsBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(MplsBos.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.bos._case.MplsBos mplsBos = ((MplsBosCase) ofMatch.getMatchEntryValue()).getMplsBos();
- if (mplsBos != null) {
- protocolMatchFieldsBuilder.setMplsBos(mplsBos.isBos() ? (short) 1 : (short) 0);
- matchBuilder.setProtocolMatchFields(protocolMatchFieldsBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(MplsTc.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc mplsTc = ((MplsTcCase) ofMatch.getMatchEntryValue()).getMplsTc();
- if (mplsTc != null) {
- protocolMatchFieldsBuilder.setMplsTc(mplsTc.getTc());
- matchBuilder.setProtocolMatchFields(protocolMatchFieldsBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(PbbIsid.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.pbb.isid._case.PbbIsid pbbIsid = ((PbbIsidCase) ofMatch.getMatchEntryValue()).getPbbIsid();
- if (pbbIsid != null) {
- PbbBuilder pbbBuilder = new PbbBuilder();
- pbbBuilder.setPbbIsid(pbbIsid.getIsid());
- byte[] mask = pbbIsid.getMask();
- if (mask != null) {
- pbbBuilder.setPbbMask(ByteUtil.bytesToUnsignedMedium(mask));
- }
- protocolMatchFieldsBuilder.setPbb(pbbBuilder.build());
- matchBuilder.setProtocolMatchFields(protocolMatchFieldsBuilder.build());
- }
- } else if (ofMatch.getOxmMatchField().equals(TunnelId.class)) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelId tunnelId = ((TunnelIdCase) ofMatch.getMatchEntryValue()).getTunnelId();
- TunnelBuilder tunnelBuilder = new TunnelBuilder();
- if (tunnelId.getTunnelId()!= null) {
- tunnelBuilder.setTunnelId(new BigInteger(OFConstants.SIGNUM_UNSIGNED, tunnelId.getTunnelId()));
- byte[] mask = tunnelId.getMask();
- if (null != mask) {
- tunnelBuilder.setTunnelMask(new BigInteger(OFConstants.SIGNUM_UNSIGNED, mask));
- }
- matchBuilder.setTunnel(tunnelBuilder.build());
- }