Search in sources :

Example 11 with EthernetDestinationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder in project openflowplugin by opendaylight.

the class MatchConvertorV10Test method createMatchBuilderWithDefaults.

private static MatchBuilder createMatchBuilderWithDefaults() {
    EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
    EthernetTypeBuilder ethernetTypeBuilder = new EthernetTypeBuilder();
    // IEEE802.3
    EtherType etherType = new EtherType(ETH_TYPE_802_3);
    ethernetTypeBuilder.setType(etherType);
    ethernetMatchBuilder.setEthernetType(ethernetTypeBuilder.build());
    EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
    ethernetDestinationBuilder.setAddress(ZERO_MAC);
    ethernetDestinationBuilder.setMask(ZERO_MAC);
    ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build());
    EthernetSourceBuilder ethernetSourceBuilder = new EthernetSourceBuilder();
    ethernetSourceBuilder.setMask(FF_MAC);
    ethernetSourceBuilder.setAddress(FF_MAC);
    ethernetMatchBuilder.setEthernetSource(ethernetSourceBuilder.build());
    MatchBuilder matchBuilder = new MatchBuilder();
    matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
    NodeConnectorId nodeConnectorId = NodeConnectorId.getDefaultInstance(NODE_CONNECTOR_ID);
    matchBuilder.setInPhyPort(nodeConnectorId);
    matchBuilder.setInPort(nodeConnectorId);
    IpMatchBuilder ipMatchBuilder = new IpMatchBuilder();
    ipMatchBuilder.setIpDscp(Dscp.getDefaultInstance(DSCP));
    ipMatchBuilder.setIpEcn(ZERO);
    ipMatchBuilder.setIpProto(IpVersion.Ipv4);
    ipMatchBuilder.setIpProtocol(IP_PROTOCOL);
    matchBuilder.setIpMatch(ipMatchBuilder.build());
    Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
    ipv4MatchBuilder.setIpv4Destination(IPV4_PREFIX);
    ipv4MatchBuilder.setIpv4Source(IPV4_PREFIX);
    matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
    matchBuilder.setInPort(new NodeConnectorId(NODE_CONNECTOR_ID));
    return matchBuilder;
}
Also used : EthernetDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) EthernetSourceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder) EthernetTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) Icmpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Example 12 with EthernetDestinationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder in project openflowplugin by opendaylight.

the class OpenflowpluginTestCommandProvider method createEthernetMatch.

private static MatchBuilder createEthernetMatch() {
    final MatchBuilder match = new MatchBuilder();
    // ethernettype
    final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
    // match
    final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
    final EtherType type = new EtherType(0x0800L);
    ethmatch.setEthernetType(ethtype.setType(type).build());
    // ethernet
    final EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder();
    // macaddress
    // match
    final MacAddress macdest = new MacAddress(DEST_MAC_ADDRESS);
    ethdest.setAddress(macdest);
    ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00"));
    ethmatch.setEthernetDestination(ethdest.build());
    final EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
    final MacAddress macsrc = new MacAddress(SRC_MAC_ADDRESS);
    ethsrc.setAddress(macsrc);
    ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00"));
    ethmatch.setEthernetSource(ethsrc.build());
    match.setEthernetMatch(ethmatch.build());
    return match;
}
Also used : EthernetDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder) EthernetSourceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder) EthernetTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ArpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder) Icmpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder) TunnelIpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) TcpFlagsMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Example 13 with EthernetDestinationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder in project openflowplugin by opendaylight.

the class MatchV10ResponseConvertor method convert.

@Override
public MatchBuilder convert(MatchV10 source, VersionDatapathIdConvertorData datapathIdConvertorData) {
    MatchBuilder matchBuilder = new MatchBuilder();
    EthernetMatchBuilder ethMatchBuilder = new EthernetMatchBuilder();
    VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
    Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
    IpMatchBuilder ipMatchBuilder = new IpMatchBuilder();
    OpenflowVersion ofVersion = OpenflowVersion.get(datapathIdConvertorData.getVersion());
    BigInteger datapathid = datapathIdConvertorData.getDatapathId();
    if (!source.getWildcards().isINPORT() && source.getInPort() != null) {
        matchBuilder.setInPort(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathid, (long) source.getInPort(), ofVersion));
    }
    if (!source.getWildcards().isDLSRC() && source.getDlSrc() != null) {
        EthernetSourceBuilder ethSrcBuilder = new EthernetSourceBuilder();
        ethSrcBuilder.setAddress(source.getDlSrc());
        ethMatchBuilder.setEthernetSource(ethSrcBuilder.build());
        matchBuilder.setEthernetMatch(ethMatchBuilder.build());
    }
    if (!source.getWildcards().isDLDST() && source.getDlDst() != null) {
        EthernetDestinationBuilder ethDstBuilder = new EthernetDestinationBuilder();
        ethDstBuilder.setAddress(source.getDlDst());
        ethMatchBuilder.setEthernetDestination(ethDstBuilder.build());
        matchBuilder.setEthernetMatch(ethMatchBuilder.build());
    }
    if (!source.getWildcards().isDLTYPE() && source.getDlType() != null) {
        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
        ethTypeBuilder.setType(new org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType((long) source.getDlType()));
        ethMatchBuilder.setEthernetType(ethTypeBuilder.build());
        matchBuilder.setEthernetMatch(ethMatchBuilder.build());
    }
    if (!source.getWildcards().isDLVLAN() && source.getDlVlan() != null) {
        VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
        int vlanId = source.getDlVlan() == 0xffff ? 0 : source.getDlVlan();
        vlanIdBuilder.setVlanId(new org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId(vlanId));
        vlanIdBuilder.setVlanIdPresent(vlanId != 0);
        vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
        matchBuilder.setVlanMatch(vlanMatchBuilder.build());
    }
    if (!source.getWildcards().isDLVLANPCP() && source.getDlVlanPcp() != null) {
        vlanMatchBuilder.setVlanPcp(new org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp(source.getDlVlanPcp()));
        matchBuilder.setVlanMatch(vlanMatchBuilder.build());
    }
    if (!source.getWildcards().isDLTYPE() && source.getNwSrc() != null) {
        final Ipv4Prefix prefix;
        if (source.getNwSrcMask() != null) {
            prefix = IetfInetUtil.INSTANCE.ipv4PrefixFor(source.getNwSrc(), source.getNwSrcMask());
        } else {
            // Openflow Spec : 1.3.2
            // An all-one-bits oxm_mask is equivalent to specifying 0 for oxm_hasmask and omitting oxm_mask.
            // So when user specify 32 as a mast, switch omit that mast and we get null as a mask in flow
            // statistics response.
            prefix = IetfInetUtil.INSTANCE.ipv4PrefixFor(source.getNwSrc());
        }
        if (!NO_IP.equals(prefix.getValue())) {
            ipv4MatchBuilder.setIpv4Source(prefix);
            matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
        }
    }
    if (!source.getWildcards().isDLTYPE() && source.getNwDst() != null) {
        final Ipv4Prefix prefix;
        if (source.getNwDstMask() != null) {
            prefix = IetfInetUtil.INSTANCE.ipv4PrefixFor(source.getNwDst(), source.getNwDstMask());
        } else {
            // Openflow Spec : 1.3.2
            // An all-one-bits oxm_mask is equivalent to specifying 0 for oxm_hasmask and omitting oxm_mask.
            // So when user specify 32 as a mast, switch omit that mast and we get null as a mask in flow
            // statistics response.
            prefix = IetfInetUtil.INSTANCE.ipv4PrefixFor(source.getNwDst());
        }
        if (!NO_IP.equals(prefix.getValue())) {
            ipv4MatchBuilder.setIpv4Destination(prefix);
            matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
        }
    }
    if (!source.getWildcards().isNWPROTO() && source.getNwProto() != null) {
        Short nwProto = source.getNwProto();
        ipMatchBuilder.setIpProtocol(nwProto);
        matchBuilder.setIpMatch(ipMatchBuilder.build());
        int proto = nwProto.intValue();
        if (proto == PROTO_TCP) {
            TcpMatchBuilder tcpMatchBuilder = new TcpMatchBuilder();
            boolean hasTcp = false;
            if (!source.getWildcards().isTPSRC() && source.getTpSrc() != null) {
                tcpMatchBuilder.setTcpSourcePort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(source.getTpSrc()));
                hasTcp = true;
            }
            if (!source.getWildcards().isTPDST() && source.getTpDst() != null) {
                tcpMatchBuilder.setTcpDestinationPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(source.getTpDst()));
                hasTcp = true;
            }
            if (hasTcp) {
                matchBuilder.setLayer4Match(tcpMatchBuilder.build());
            }
        } else if (proto == PROTO_UDP) {
            UdpMatchBuilder udpMatchBuilder = new UdpMatchBuilder();
            boolean hasUdp = false;
            if (!source.getWildcards().isTPSRC() && source.getTpSrc() != null) {
                udpMatchBuilder.setUdpSourcePort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(source.getTpSrc()));
                hasUdp = true;
            }
            if (!source.getWildcards().isTPDST() && source.getTpDst() != null) {
                udpMatchBuilder.setUdpDestinationPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(source.getTpDst()));
                hasUdp = true;
            }
            if (hasUdp) {
                matchBuilder.setLayer4Match(udpMatchBuilder.build());
            }
        } else if (proto == PROTO_ICMPV4) {
            Icmpv4MatchBuilder icmpv4MatchBuilder = new Icmpv4MatchBuilder();
            boolean hasIcmpv4 = false;
            if (!source.getWildcards().isTPSRC()) {
                Integer type = source.getTpSrc();
                if (type != null) {
                    icmpv4MatchBuilder.setIcmpv4Type(type.shortValue());
                    hasIcmpv4 = true;
                }
            }
            if (!source.getWildcards().isTPDST()) {
                Integer code = source.getTpDst();
                if (code != null) {
                    icmpv4MatchBuilder.setIcmpv4Code(code.shortValue());
                    hasIcmpv4 = true;
                }
            }
            if (hasIcmpv4) {
                matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build());
            }
        }
    }
    if (!source.getWildcards().isNWTOS() && source.getNwTos() != null) {
        Short dscp = ActionUtil.tosToDscp(source.getNwTos());
        ipMatchBuilder.setIpDscp(new Dscp(dscp));
        matchBuilder.setIpMatch(ipMatchBuilder.build());
    }
    return matchBuilder;
}
Also used : Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) OpenflowVersion(org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion) Collections(java.util.Collections) EthernetTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) Icmpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder) VlanIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) EthernetDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder) BigInteger(java.math.BigInteger) EthernetSourceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder) BigInteger(java.math.BigInteger) Dscp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) Icmpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)

Example 14 with EthernetDestinationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder in project openflowplugin by opendaylight.

the class EthernetDestinationEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final MacAddress address = new MacAddress("00:01:02:03:04:05");
    final MacAddress mask = new MacAddress("00:00:00:00:00:00");
    final Match match = new MatchBuilder().setEthernetMatch(new EthernetMatchBuilder().setEthernetDestination(new EthernetDestinationBuilder().setAddress(address).setMask(mask).build()).build()).build();
    assertMatch(match, true, (out) -> {
        final byte[] addressBytes = new byte[6];
        out.readBytes(addressBytes);
        assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(), address.getValue());
        final byte[] maskBytes = new byte[6];
        out.readBytes(maskBytes);
        assertEquals(new MacAddress(ByteBufUtils.macAddressToString(maskBytes)).getValue(), mask.getValue());
    });
    final Match matchNoMask = new MatchBuilder().setEthernetMatch(new EthernetMatchBuilder().setEthernetDestination(new EthernetDestinationBuilder().setAddress(address).build()).build()).build();
    assertMatch(matchNoMask, false, (out) -> {
        final byte[] addressBytes = new byte[6];
        out.readBytes(addressBytes);
        assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(), address.getValue());
    });
}
Also used : EthernetDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) Test(org.junit.Test)

Example 15 with EthernetDestinationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder in project openflowplugin by opendaylight.

the class TestFlowHelper method createFlowAndStatisticsMapListBuilder.

/**
 * Creates flow and statistics builder.
 * @param index data seed
 * @return flow stats builder with dummy content
 */
protected static FlowAndStatisticsMapListBuilder createFlowAndStatisticsMapListBuilder(int index) {
    FlowAndStatisticsMapListBuilder flowAndStatisticsMapListBuilder = new FlowAndStatisticsMapListBuilder();
    flowAndStatisticsMapListBuilder.setPriority(index);
    flowAndStatisticsMapListBuilder.setTableId((short) index);
    flowAndStatisticsMapListBuilder.setCookie(new FlowCookie(BigInteger.TEN));
    EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
    EthernetSourceBuilder ethernetSourceBuilder = new EthernetSourceBuilder();
    MacAddress macAddress = new MacAddress("00:00:00:00:00:0" + index);
    ethernetSourceBuilder.setAddress(macAddress);
    ethernetMatchBuilder.setEthernetSource(ethernetSourceBuilder.build());
    EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
    ethernetDestinationBuilder.setAddress(new MacAddress("00:00:00:0" + index + ":00:00"));
    ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build());
    MatchBuilder matchBuilder = new MatchBuilder();
    matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
    flowAndStatisticsMapListBuilder.setMatch(matchBuilder.build());
    return flowAndStatisticsMapListBuilder;
}
Also used : FlowAndStatisticsMapListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder) EthernetDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder) FlowCookie(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie) EthernetSourceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Aggregations

EthernetDestinationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder)16 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)15 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)12 EthernetSourceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder)12 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)11 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)8 EthernetTypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder)7 EtherType (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType)6 Icmpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder)5 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)5 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)5 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)5 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)5 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)5 Test (org.junit.Test)4 BigInteger (java.math.BigInteger)3 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)3 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match)3 Icmpv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)3 ArpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder)3