本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder类的典型用法代码示例。如果您正苦于以下问题:Java EthernetSourceBuilder类的具体用法?Java EthernetSourceBuilder怎么用?Java EthernetSourceBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EthernetSourceBuilder类属于org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields包,在下文中一共展示了EthernetSourceBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEthSrcDstMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
public static MatchBuilder createEthSrcDstMatch(MatchBuilder matchBuilder, MacAddress srcMac, MacAddress dstMac) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
if (srcMac != null) {
EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(srcMac);
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
}
if (dstMac != null) {
EthernetDestinationBuilder ethDestinationBuild = new EthernetDestinationBuilder();
ethDestinationBuild.setAddress(dstMac);
ethernetMatch.setEthernetDestination(ethDestinationBuild.build());
}
if (matchBuilder.getEthernetMatch() != null && matchBuilder.getEthernetMatch().getEthernetType() != null) {
ethernetMatch.setEthernetType(matchBuilder.getEthernetMatch().getEthernetType());
}
matchBuilder.setEthernetMatch(ethernetMatch.build());
return matchBuilder;
}
示例2: createSrcL3Ipv4MatchWithMac
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的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;
}
示例3: createSrcL3Ipv6MatchWithMac
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的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;
}
示例4: createV4EtherMatchWithType
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的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;
}
示例5: createEthMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
/**
* Create Ethernet Source Match
*
* @param matchBuilder MatchBuilder Object without a match yet
* @param srcMac String representing a source MAC
* @param dstMac String representing a destination MAC
* @return matchBuilder Map MatchBuilder Object with a match
*/
public static MatchBuilder createEthMatch(MatchBuilder matchBuilder, MacAddress srcMac, MacAddress dstMac) {
Preconditions.checkNotNull(matchBuilder);
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
if (srcMac != null) {
EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(srcMac);
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
}
if (dstMac != null) {
EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
ethDestinationBuilder.setAddress(dstMac);
ethernetMatch.setEthernetDestination(ethDestinationBuilder.build());
}
matchBuilder.setEthernetMatch(ethernetMatch.build());
return matchBuilder;
}
示例6: ethernetMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
public static EthernetMatch ethernetMatch(MacAddress srcMac,
MacAddress dstMac,
Long etherType) {
EthernetMatchBuilder emb = new EthernetMatchBuilder();
if (srcMac != null)
emb.setEthernetSource(new EthernetSourceBuilder()
.setAddress(srcMac)
.build());
if (dstMac != null)
emb.setEthernetDestination(new EthernetDestinationBuilder()
.setAddress(dstMac)
.build());
if (etherType != null)
emb.setEthernetType(new EthernetTypeBuilder()
.setType(new EtherType(etherType))
.build());
return emb.build();
}
示例7: getEtherMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
/**
* Gets the ether match.
*
* @param macAddress
* the src/destination MAC
* @param isSrc
* indicates source or destination MAC
* @return the ether match
*/
public static EthernetMatch getEtherMatch(MacAddress macAddress, boolean isSrc) {
if (isSrc) {
return new EthernetMatchBuilder()
.setEthernetSource(new EthernetSourceBuilder().setAddress(macAddress).build()).build();
} else {
return new EthernetMatchBuilder()
.setEthernetDestination(new EthernetDestinationBuilder().setAddress(macAddress).build()).build();
}
}
示例8: createEthSrcMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
/**
* Create Ethernet Source Match
*
* @param matchBuilder
* MatchBuilder Object without a match yet
* @param sMacAddr
* String representing a source MAC
* @return matchBuilder Map MatchBuilder Object with a match
*/
public static MatchBuilder createEthSrcMatch(MatchBuilder matchBuilder, MacAddress sMacAddr) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(sMacAddr);
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
matchBuilder.setEthernetMatch(ethernetMatch.build());
return matchBuilder;
}
示例9: createSmacTcpPortWithFlagMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
/**
* Create smac tcp port with flag match.
*
* @param matchBuilder
* the match builder
* @param attachedMac
* the attached mac
* @param tcpFlag
* the tcp flag
* @param tunnelID
* the tunnel iD
* @return matchBuilder
*/
public static MatchBuilder createSmacTcpPortWithFlagMatch(MatchBuilder matchBuilder, String attachedMac,
Integer tcpFlag, String tunnelID) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x0800L));
ethernetMatch.setEthernetType(ethTypeBuilder.build());
EthernetSourceBuilder ethSrcBuilder = new EthernetSourceBuilder();
ethSrcBuilder.setAddress(new MacAddress(attachedMac));
ethernetMatch.setEthernetSource(ethSrcBuilder.build());
matchBuilder.setEthernetMatch(ethernetMatch.build());
// TCP Protocol Match
IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
ipMatch.setIpProtocol(TCP_SHORT);
matchBuilder.setIpMatch(ipMatch.build());
TcpFlagsMatchBuilder tcpFlagMatch = new TcpFlagsMatchBuilder();
tcpFlagMatch.setTcpFlags(tcpFlag);
matchBuilder.setTcpFlagsMatch(tcpFlagMatch.build());
TunnelBuilder tunnelBuilder = new TunnelBuilder();
tunnelBuilder.setTunnelId(new BigInteger(tunnelID));
matchBuilder.setTunnel(tunnelBuilder.build());
return matchBuilder;
}
示例10: createSmacIpTcpSynMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
/**
* Create smac ip tcp syn match.
*
* @param matchBuilder
* the match builder
* @param dMacAddr
* the d mac addr
* @param mask
* the mask
* @param ipPrefix
* the ip prefix
* @return MatchBuilder containing the metadata match values
*/
public static MatchBuilder createSmacIpTcpSynMatch(MatchBuilder matchBuilder, MacAddress dMacAddr, MacAddress mask,
Ipv4Prefix ipPrefix) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
EthernetSourceBuilder ethSrcBuilder = new EthernetSourceBuilder();
ethSrcBuilder.setAddress(dMacAddr);
if (mask != null) {
ethSrcBuilder.setMask(mask);
}
ethernetMatch.setEthernetSource(ethSrcBuilder.build());
matchBuilder.setEthernetMatch(ethernetMatch.build());
// Ethertype match
EthernetMatchBuilder ethernetType = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x0800L));
ethernetType.setEthernetType(ethTypeBuilder.build());
matchBuilder.setEthernetMatch(ethernetType.build());
if (ipPrefix != null) {
Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
Ipv4Prefix canonicalizedIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(ipPrefix);
ipv4match.setIpv4Destination(canonicalizedIpv4Prefix);
matchBuilder.setLayer3Match(ipv4match.build());
}
// TCP Protocol Match
IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
ipMatch.setIpProtocol(TCP_SHORT);
matchBuilder.setIpMatch(ipMatch.build());
// TCP Flag Match
TcpFlagsMatchBuilder tcpFlagMatch = new TcpFlagsMatchBuilder();
tcpFlagMatch.setTcpFlags(TCP_SYN);
matchBuilder.setTcpFlagsMatch(tcpFlagMatch.build());
return matchBuilder;
}
示例11: createSmacTcpSyn
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
/**
* Create smac tcp syn.
*
* @param matchBuilder
* the match builder
* @param attachedMac
* the attached mac
* @param tcpPort
* the tcp port
* @param tcpFlag
* the tcp flag
* @param tunnelID
* the tunnel iD
* @return the match builder
*/
public static MatchBuilder createSmacTcpSyn(MatchBuilder matchBuilder, String attachedMac, PortNumber tcpPort,
Integer tcpFlag, String tunnelID) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x0800L));
ethernetMatch.setEthernetType(ethTypeBuilder.build());
EthernetSourceBuilder ethSrcBuilder = new EthernetSourceBuilder();
ethSrcBuilder.setAddress(new MacAddress(attachedMac));
ethernetMatch.setEthernetSource(ethSrcBuilder.build());
matchBuilder.setEthernetMatch(ethernetMatch.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());
TunnelBuilder tunnelBuilder = new TunnelBuilder();
tunnelBuilder.setTunnelId(new BigInteger(tunnelID));
matchBuilder.setTunnel(tunnelBuilder.build());
return matchBuilder;
}
示例12: createDhcpServerMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
/**
* Creates DHCP server packet match with DHCP mac address and port.
*
* @param matchBuilder
* the matchbuilder
* @param dhcpServerMac
* MAc address of the DHCP server of the subnet
* @param srcPort
* the source port
* @param dstPort
* the destination port
* @return the DHCP server match
*/
public static MatchBuilder createDhcpServerMatch(MatchBuilder matchBuilder, String dhcpServerMac, 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());
EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(new MacAddress(dhcpServerMac));
ethernetMatch.setEthernetSource(ethSourceBuilder.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;
}
示例13: createDhcpv6ServerMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
/**
* Creates DHCPv6 server packet match with DHCP mac address and port.
*
* @param matchBuilder
* the matchbuilder
* @param dhcpServerMac
* MAc address of the DHCP server of the subnet
* @param srcPort
* the source port
* @param dstPort
* the destination port
* @return the DHCP server match
*/
public static MatchBuilder createDhcpv6ServerMatch(MatchBuilder matchBuilder, String dhcpServerMac, 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());
EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(new MacAddress(dhcpServerMac));
ethernetMatch.setEthernetSource(ethSourceBuilder.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;
}
示例14: createV6EtherMatchWithType
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
/**
* Creates a ether net match with ether type set to 0x86DDL.
*
* @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 createV6EtherMatchWithType(MatchBuilder matchBuilder, String srcMac, String dstMac) {
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x86DDL));
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;
}
示例15: ethernetMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入依赖的package包/类
public static EthernetMatch ethernetMatch(MacAddress srcMac, MacAddress dstMac, Long etherType) {
EthernetMatchBuilder emb = new EthernetMatchBuilder();
if (srcMac != null) {
emb.setEthernetSource(new EthernetSourceBuilder().setAddress(srcMac).build());
}
if (dstMac != null) {
emb.setEthernetDestination(new EthernetDestinationBuilder().setAddress(dstMac).build());
}
if (etherType != null) {
emb.setEthernetType(new EthernetTypeBuilder().setType(new EtherType(etherType)).build());
}
return emb.build();
}