本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder类的典型用法代码示例。如果您正苦于以下问题:Java EthernetTypeBuilder类的具体用法?Java EthernetTypeBuilder怎么用?Java EthernetTypeBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EthernetTypeBuilder类属于org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields包,在下文中一共展示了EthernetTypeBuilder类的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;
}
示例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;
}
示例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;
}
示例4: 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(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.setTcpDestinationPort(tcpDstPort);
matchBuilder.setLayer4Match(tcpmatch.build());
return matchBuilder;
}
示例5: 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(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());
// TCP Port Match
PortNumber dstPort = new PortNumber(tcpPort);
TcpMatchBuilder tcpMatch = new TcpMatchBuilder();
tcpMatch.setTcpDestinationPort(dstPort);
matchBuilder.setLayer4Match(tcpMatch.build());
TcpFlagsMatchBuilder tcpFlagMatch = new TcpFlagsMatchBuilder();
tcpFlagMatch.setTcpFlags(tcpFlag);
matchBuilder.setTcpFlagsMatch(tcpFlagMatch.build());
return matchBuilder;
}
示例6: createIpProtocolMatch
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 createIpProtocolMatch(MatchBuilder matchBuilder, short ipProtocol) {
EthernetMatchBuilder ethType = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x0800L));
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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: 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;
}
示例12: createSrcL3Ipv6MatchWithMac
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 IPv6 prefix
* @param srcMac
* The source macAddress
* @return matchBuilder Map Object with a match
*/
public static MatchBuilder createSrcL3Ipv6MatchWithMac(MatchBuilder matchBuilder, Ipv6Prefix srcip,
MacAddress srcMac) {
Ipv6MatchBuilder ipv6MatchBuilder = new Ipv6MatchBuilder();
ipv6MatchBuilder.setIpv6Source(srcip);
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x86DDL));
EthernetMatchBuilder eth = new EthernetMatchBuilder();
eth.setEthernetType(ethTypeBuilder.build());
eth.setEthernetSource(new EthernetSourceBuilder().setAddress(srcMac).build());
matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
matchBuilder.setEthernetMatch(eth.build());
return matchBuilder;
}
示例13: 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;
}
示例14: createMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入依赖的package包/类
private Match createMatch(Ipv4Prefix ipv4Prefix) {
final Ipv4MatchBuilder ipv4MatchBuilder = new Ipv4MatchBuilder();
ipv4MatchBuilder.setIpv4Source(ipv4Prefix);
Layer3Match layer3Match = ipv4MatchBuilder.build();
final MatchBuilder matchBuilder = new MatchBuilder();
final EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
final EthernetTypeBuilder ethernetTypeBuilder = new EthernetTypeBuilder();
ethernetTypeBuilder.setType(new EtherType(ETHER_TYPE));
ethernetMatchBuilder.setEthernetType(ethernetTypeBuilder.build());
matchBuilder.setLayer3Match(layer3Match);
matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
return matchBuilder.build();
}
示例15: createLldpReplyToControllerFlow
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder; //导入依赖的package包/类
private FlowBuilder createLldpReplyToControllerFlow() {
FlowBuilder lldpFlow = new FlowBuilder().setFlowName(createFlowName())
.setIdleTimeout(0)
.setHardTimeout(0)
.setCookie(new FlowCookie(BigInteger.valueOf(flowCookie.incrementAndGet())))
.setFlags(new FlowModFlags(false, false, false, false, false))
.setPriority(OFRendererConstants.LLDP_REPLY_TO_CONTROLLER_FLOW_PRIORITY);
EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder()
.setEthernetType(new EthernetTypeBuilder()
.setType(new EtherType(Long.valueOf(OFRendererConstants.LLDP_ETHER_TYPE))).build());
Match match = new MatchBuilder().setEthernetMatch(ethernetMatchBuilder.build()).build();
lldpFlow.setMatch(match);
Instructions instructions = createOutputInstructions(OutputPortValues.CONTROLLER);
lldpFlow.setInstructions(instructions);
FlowId flowId = new FlowId(createFlowName());
lldpFlow.setId(flowId);
lldpFlow.setKey(new FlowKey(flowId));
return lldpFlow;
}