当前位置: 首页>>代码示例>>Java>>正文


Java EthernetTypeBuilder.setType方法代码示例

本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder.setType方法的典型用法代码示例。如果您正苦于以下问题:Java EthernetTypeBuilder.setType方法的具体用法?Java EthernetTypeBuilder.setType怎么用?Java EthernetTypeBuilder.setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder的用法示例。


在下文中一共展示了EthernetTypeBuilder.setType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDmacDestIpMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
public static MatchBuilder createDmacDestIpMatch(MatchBuilder matchBuilder, String destMac,
        Ipv4Prefix destIpPrefix) {

    EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x0800L));
    ethernetMatch.setEthernetType(ethTypeBuilder.build());

    if (destMac != null) {
        EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
        ethDestinationBuilder.setAddress(new MacAddress(destMac));
        ethernetMatch.setEthernetDestination(ethDestinationBuilder.build());
        matchBuilder.setEthernetMatch(ethernetMatch.build());
    }

    if (destIpPrefix != null) {
        Ipv4Prefix canonicalizedIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(destIpPrefix);
        Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
        ipv4match.setIpv4Destination(canonicalizedIpv4Prefix);
        matchBuilder.setLayer3Match(ipv4match.build());
    }

    return matchBuilder;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:25,代码来源:OfMatchUtils.java

示例2: createDstL3IPv4Match

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * @param matchBuilder
 *            MatchBuilder Object without a match yet
 * @param dstip
 *            String containing an IPv4 prefix
 * @return matchBuilder Map Object with a match
 */
public static MatchBuilder createDstL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix dstip) {

    EthernetMatchBuilder eth = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x0800L));
    eth.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(eth.build());

    Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
    Ipv4Prefix canonicalizedIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(dstip);
    ipv4match.setIpv4Destination(canonicalizedIpv4Prefix);

    matchBuilder.setLayer3Match(ipv4match.build());

    return matchBuilder;

}
 
开发者ID:opendaylight,项目名称:faas,代码行数:25,代码来源:OfMatchUtils.java

示例3: createSetSrcTcpMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Create Source TCP Port Match
 *
 * @param matchBuilder
 *            MatchBuilder Object without a match yet
 * @param tcpport
 *            Integer representing a source TCP port
 * @return matchBuilder Map MatchBuilder Object with a match
 */
public static MatchBuilder createSetSrcTcpMatch(MatchBuilder matchBuilder, PortNumber tcpport) {

    EthernetMatchBuilder ethType = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x0800L));
    ethType.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(ethType.build());

    IpMatchBuilder ipmatch = new IpMatchBuilder();
    ipmatch.setIpProtocol((short) 6);
    matchBuilder.setIpMatch(ipmatch.build());

    TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
    tcpmatch.setTcpSourcePort(tcpport);
    matchBuilder.setLayer4Match(tcpmatch.build());

    return matchBuilder;

}
 
开发者ID:opendaylight,项目名称:faas,代码行数:29,代码来源:OfMatchUtils.java

示例4: createDhcpMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Create a DHCP match with port provided.
 *
 * @param matchBuilder
 *            the match builder
 * @param srcPort
 *            the source port
 * @param dstPort
 *            the destination port
 * @return the DHCP match
 */
public static MatchBuilder createDhcpMatch(MatchBuilder matchBuilder, int srcPort, int dstPort) {

    EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x0800L));
    ethernetMatch.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(ethernetMatch.build());

    IpMatchBuilder ipmatch = new IpMatchBuilder();
    ipmatch.setIpProtocol(UDP_SHORT);
    matchBuilder.setIpMatch(ipmatch.build());

    UdpMatchBuilder udpmatch = new UdpMatchBuilder();
    udpmatch.setUdpSourcePort(new PortNumber(srcPort));
    udpmatch.setUdpDestinationPort(new PortNumber(dstPort));
    matchBuilder.setLayer4Match(udpmatch.build());

    return matchBuilder;

}
 
开发者ID:opendaylight,项目名称:faas,代码行数:32,代码来源:OfMatchUtils.java

示例5: createSrcL3Ipv4MatchWithMac

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Creates a Match with src ip address mac address set.
 *
 * @param matchBuilder
 *            MatchBuilder Object
 * @param srcip
 *            String containing an IPv4 prefix
 * @param srcMac
 *            The source macAddress
 * @return matchBuilder Map Object with a match
 */
public static MatchBuilder createSrcL3Ipv4MatchWithMac(MatchBuilder matchBuilder, Ipv4Prefix srcip,
        MacAddress srcMac) {

    Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
    Ipv4Prefix canonicalizedIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(srcip);
    ipv4MatchBuilder.setIpv4Source(canonicalizedIpv4Prefix);
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x0800L));
    EthernetMatchBuilder eth = new EthernetMatchBuilder();
    eth.setEthernetType(ethTypeBuilder.build());
    eth.setEthernetSource(new EthernetSourceBuilder().setAddress(srcMac).build());

    matchBuilder.setLayer3Match(ipv4MatchBuilder.build());
    matchBuilder.setEthernetMatch(eth.build());
    return matchBuilder;

}
 
开发者ID:opendaylight,项目名称:faas,代码行数:29,代码来源:OfMatchUtils.java

示例6: createIpv6ProtocolMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Create TCP Port Match
 *
 * @param matchBuilder
 *            MatchBuilder Object without a match yet
 * @param ipProtocol
 *            Integer representing the IP protocol
 * @return matchBuilder Map MatchBuilder Object with a match
 */
public static MatchBuilder createIpv6ProtocolMatch(MatchBuilder matchBuilder, short ipProtocol) {

    EthernetMatchBuilder ethType = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x86DDL));
    ethType.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(ethType.build());

    IpMatchBuilder ipMmatch = new IpMatchBuilder();
    if (ipProtocol == TCP_SHORT) {
        ipMmatch.setIpProtocol(TCP_SHORT);
    } else if (ipProtocol == UDP_SHORT) {
        ipMmatch.setIpProtocol(UDP_SHORT);
    } else if (ipProtocol == ICMP_SHORT) {
        ipMmatch.setIpProtocol(ICMP_SHORT);
    }
    matchBuilder.setIpMatch(ipMmatch.build());
    return matchBuilder;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:29,代码来源:OfMatchUtils.java

示例7: createTcpSynWithProtoMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Create tcp syn with proto match.
 *
 * @param matchBuilder
 *            the match builder
 * @return matchBuilder match builder
 */
public static MatchBuilder createTcpSynWithProtoMatch(MatchBuilder matchBuilder) {

    // Ethertype match
    EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x0800L));
    ethernetType.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(ethernetType.build());

    // TCP Protocol Match
    IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
    ipMatch.setIpProtocol((short) 6);
    matchBuilder.setIpMatch(ipMatch.build());

    TcpFlagsMatchBuilder tcpFlagMatch = new TcpFlagsMatchBuilder();
    tcpFlagMatch.setTcpFlags(TCP_SYN);
    matchBuilder.setTcpFlagsMatch(tcpFlagMatch.build());
    return matchBuilder;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:27,代码来源:OfMatchUtils.java

示例8: createV4EtherMatchWithType

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Creates a ether net match with ether type set to 0x0800L.
 *
 * @param matchBuilder
 *            MatchBuilder Object
 * @param srcMac
 *            The source macAddress
 * @param dstMac
 *            The destination mac address
 * @return matchBuilder Map Object with a match
 */
public static MatchBuilder createV4EtherMatchWithType(MatchBuilder matchBuilder, String srcMac, String dstMac,
        Long type) {
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(type));
    EthernetMatchBuilder eth = new EthernetMatchBuilder();
    eth.setEthernetType(ethTypeBuilder.build());
    if (null != srcMac) {
        eth.setEthernetSource(new EthernetSourceBuilder().setAddress(new MacAddress(srcMac)).build());
    }
    if (null != dstMac) {
        eth.setEthernetDestination(new EthernetDestinationBuilder().setAddress(new MacAddress(dstMac)).build());
    }
    matchBuilder.setEthernetMatch(eth.build());
    return matchBuilder;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:27,代码来源:OfMatchUtils.java

示例9: createDhcpv6Match

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Create a DHCP match with port provided.
 *
 * @param matchBuilder
 *            the match builder
 * @param srcPort
 *            the source port
 * @param dstPort
 *            the destination port
 * @return the DHCP match
 */
public static MatchBuilder createDhcpv6Match(MatchBuilder matchBuilder, int srcPort, int dstPort) {

    EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x86DDL));
    ethernetMatch.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(ethernetMatch.build());

    IpMatchBuilder ipmatch = new IpMatchBuilder();
    ipmatch.setIpProtocol(UDP_SHORT);
    matchBuilder.setIpMatch(ipmatch.build());

    UdpMatchBuilder udpmatch = new UdpMatchBuilder();
    udpmatch.setUdpSourcePort(new PortNumber(srcPort));
    udpmatch.setUdpDestinationPort(new PortNumber(dstPort));
    matchBuilder.setLayer4Match(udpmatch.build());

    return matchBuilder;

}
 
开发者ID:opendaylight,项目名称:faas,代码行数:32,代码来源:OfMatchUtils.java

示例10: createVlanIdMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Create Ethernet Destination Match
 *
 * @param matchBuilder MatchBuilder Object without a match yet
 * @param vlanId       Integer representing a VLAN ID Integer representing a VLAN ID
 * @return matchBuilder Map MatchBuilder Object with a match
 */
public static MatchBuilder createVlanIdMatch(MatchBuilder matchBuilder, Integer vlanId, boolean present) {
    EthernetMatchBuilder eth = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(VLANTAGGED_LONG));
    eth.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(eth.build());

    VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
    VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
    vlanIdBuilder.setVlanId(new VlanId(vlanId));
    vlanIdBuilder.setVlanIdPresent(present);
    vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
    matchBuilder.setVlanMatch(vlanMatchBuilder.build());

    return matchBuilder;
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:24,代码来源:MatchUtils.java

示例11: createDstL3IPv4Match

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * @param matchBuilder MatchBuilder Object without a match yet
 * @param dstip        String containing an IPv4 prefix
 * @return matchBuilder Map Object with a match
 */
public static MatchBuilder createDstL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix dstip) {

    EthernetMatchBuilder eth = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(IPV4_LONG));
    eth.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(eth.build());

    Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
    ipv4match.setIpv4Destination(dstip);

    matchBuilder.setLayer3Match(ipv4match.build());

    return matchBuilder;

}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:22,代码来源:MatchUtils.java

示例12: createSrcL3IPv4Match

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * @param matchBuilder MatchBuilder Object without a match yet
 * @param srcip        String containing an IPv4 prefix
 * @return matchBuilder Map Object with a match
 */
public static MatchBuilder createSrcL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix srcip) {

    EthernetMatchBuilder eth = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(IPV4_LONG));
    eth.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(eth.build());

    Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
    ipv4match.setIpv4Source(srcip);
    matchBuilder.setLayer3Match(ipv4match.build());

    return matchBuilder;

}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:21,代码来源:MatchUtils.java

示例13: createSetSrcTcpMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Create Source TCP Port Match
 *
 * @param matchBuilder @param matchbuilder MatchBuilder Object without a match yet
 * @param tcpport      Integer representing a source TCP port
 * @return matchBuilder Map MatchBuilder Object with a match
 */
public static MatchBuilder createSetSrcTcpMatch(MatchBuilder matchBuilder, PortNumber tcpport) {

    EthernetMatchBuilder ethType = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(IPV4_LONG));
    ethType.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(ethType.build());

    IpMatchBuilder ipmatch = new IpMatchBuilder();
    ipmatch.setIpProtocol((short) 6);
    matchBuilder.setIpMatch(ipmatch.build());

    TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
    tcpmatch.setTcpSourcePort(tcpport);
    matchBuilder.setLayer4Match(tcpmatch.build());

    return matchBuilder;

}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:27,代码来源:MatchUtils.java

示例14: createSetDstTcpMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Create Destination TCP Port Match
 *
 * @param matchBuilder MatchBuilder Object without a match yet
 * @param tcpDstPort   Integer representing a destination TCP port
 * @return matchBuilder Map MatchBuilder Object with a match
 */
public static MatchBuilder createSetDstTcpMatch(MatchBuilder matchBuilder, PortNumber tcpDstPort) {

    EthernetMatchBuilder ethType = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(IPV4_LONG));
    ethType.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(ethType.build());

    IpMatchBuilder ipmatch = new IpMatchBuilder();
    ipmatch.setIpProtocol((short) 6);
    matchBuilder.setIpMatch(ipmatch.build());

    TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
    tcpmatch.setTcpDestinationPort(tcpDstPort);
    matchBuilder.setLayer4Match(tcpmatch.build());

    return matchBuilder;
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:26,代码来源:MatchUtils.java

示例15: createTcpFlagMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入方法依赖的package包/类
/**
 * Test match for TCP_Flags
 *
 * @param matchBuilder MatchBuilder Object without a match yet
 * @param tcpPort  PortNumber representing a destination TCP port
 * @param tcpFlag  int representing a tcp_flag
 * @return match containing TCP_Flag (), IP Protocol (TCP), TCP_Flag (SYN)
 * <p/>
 * Defined TCP Flag values in OVS v2.1+
 * TCP_FIN 0x001 / TCP_SYN 0x002 / TCP_RST 0x004
 * TCP_PSH 0x008 / TCP_ACK 0x010 / TCP_URG 0x020
 * TCP_ECE 0x040 / TCP_CWR 0x080 / TCP_NS  0x100
 */
public static MatchBuilder createTcpFlagMatch(MatchBuilder matchBuilder, PortNumber tcpPort, int tcpFlag) {

    // Ethertype match
    EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
    EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(IPV4_LONG));
    ethernetType.setEthernetType(ethTypeBuilder.build());
    matchBuilder.setEthernetMatch(ethernetType.build());

    // TCP Protocol Match
    IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
    ipMatch.setIpProtocol((short) 6);
    matchBuilder.setIpMatch(ipMatch.build());

    // TCP Port Match
    PortNumber dstPort = new PortNumber(tcpPort);
    TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
    tcpMatch.setTcpDestinationPort(dstPort);
    matchBuilder.setLayer4Match(tcpMatch.build());

    TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
    tcpFlagMatch.setTcpFlag(tcpFlag);
    matchBuilder.setTcpFlagMatch(tcpFlagMatch.build());
    return matchBuilder;
}
 
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:39,代码来源:MatchUtils.java


注:本文中的org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder.setType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。