本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder.setAddress方法的典型用法代码示例。如果您正苦于以下问题:Java EthernetSourceBuilder.setAddress方法的具体用法?Java EthernetSourceBuilder.setAddress怎么用?Java EthernetSourceBuilder.setAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder
的用法示例。
在下文中一共展示了EthernetSourceBuilder.setAddress方法的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: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: createEthAddressMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入方法依赖的package包/类
public static MatchBuilder createEthAddressMatch(MatchBuilder matchBuilder, String srcMac, String srcMask,
String destMac, String destMask) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x0800L));
ethernetMatch.setEthernetType(ethTypeBuilder.build());
if (srcMac != null) {
EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(new MacAddress(srcMac));
if (srcMask != null) {
ethSourceBuilder.setMask(new MacAddress(srcMask));
}
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
}
if (destMac != null) {
EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
ethDestinationBuilder.setAddress(new MacAddress(destMac));
if (destMask != null) {
ethDestinationBuilder.setMask(new MacAddress(destMask));
}
ethernetMatch.setEthernetDestination(ethDestinationBuilder.build());
}
matchBuilder.setEthernetMatch(ethernetMatch.build());
return matchBuilder;
}
示例10: 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(new MacAddress(sMacAddr));
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
matchBuilder.setEthernetMatch(ethernetMatch.build());
return matchBuilder;
}
示例11: createSmacTcpSynDstIpPrefixTcpPort
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入方法依赖的package包/类
/**
* Create smac tcp syn dst ip prefix tcp port.
*
* @param matchBuilder the match builder
* @param attachedMac the attached mac
* @param tcpPort the tcp port
* @param tcpFlag the tcp flag
* @param segmentationId the segmentation id
* @param dstIp the dst ip
* @return the match builder
*/
public static MatchBuilder createSmacTcpSynDstIpPrefixTcpPort(MatchBuilder matchBuilder, MacAddress attachedMac,
PortNumber tcpPort, Integer tcpFlag, String segmentationId, Ipv4Prefix dstIp) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(IPV4_LONG));
ethernetMatch.setEthernetType(ethTypeBuilder.build());
EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(new MacAddress(attachedMac));
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
matchBuilder.setEthernetMatch(ethernetMatch.build());
Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
ipv4match.setIpv4Destination(dstIp);
matchBuilder.setLayer3Match(ipv4match.build());
// TCP Protocol Match
IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
ipMatch.setIpProtocol(TCP_SHORT);
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());
TunnelBuilder tunnelBuilder = new TunnelBuilder();
tunnelBuilder.setTunnelId(new BigInteger(segmentationId));
matchBuilder.setTunnel(tunnelBuilder.build());
return matchBuilder;
}
示例12: 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(IPV4_LONG));
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());
TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
tcpFlagMatch.setTcpFlag(tcpFlag);
matchBuilder.setTcpFlagMatch(tcpFlagMatch.build());
TunnelBuilder tunnelBuilder = new TunnelBuilder();
tunnelBuilder.setTunnelId(new BigInteger(tunnelID));
matchBuilder.setTunnel(tunnelBuilder.build());
return matchBuilder;
}
示例13: 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(new MacAddress(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(IPV4_LONG));
ethernetType.setEthernetType(ethTypeBuilder.build());
matchBuilder.setEthernetMatch(ethernetType.build());
if (ipPrefix != null) {
Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
ipv4match.setIpv4Destination(ipPrefix);
matchBuilder.setLayer3Match(ipv4match.build());
}
// TCP Protocol Match
IpMatchBuilder ipMatch = new IpMatchBuilder(); // ipv4 version
ipMatch.setIpProtocol(TCP_SHORT);
matchBuilder.setIpMatch(ipMatch.build());
// TCP Flag Match
TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
tcpFlagMatch.setTcpFlag(TCP_SYN);
matchBuilder.setTcpFlagMatch(tcpFlagMatch.build());
return matchBuilder;
}
示例14: 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(IPV4_LONG));
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());
TcpFlagMatchBuilder tcpFlagMatch = new TcpFlagMatchBuilder();
tcpFlagMatch.setTcpFlag(tcpFlag);
matchBuilder.setTcpFlagMatch(tcpFlagMatch.build());
TunnelBuilder tunnelBuilder = new TunnelBuilder();
tunnelBuilder.setTunnelId(new BigInteger(tunnelID));
matchBuilder.setTunnel(tunnelBuilder.build());
return matchBuilder;
}
示例15: createSmacTcpSynDstIpPrefixTcpPort
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder; //导入方法依赖的package包/类
/**
* Create smac tcp syn dst ip prefix tcp port.
*
* @param matchBuilder
* the match builder
* @param attachedMac
* the attached mac
* @param tcpPort
* the tcp port
* @param tcpFlag
* the tcp flag
* @param segmentationId
* the segmentation id
* @param dstIp
* the dst ip
* @return the match builder
*/
public static MatchBuilder createSmacTcpSynDstIpPrefixTcpPort(MatchBuilder matchBuilder, MacAddress attachedMac,
PortNumber tcpPort, Integer tcpFlag, String segmentationId, Ipv4Prefix dstIp) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x0800L));
ethernetMatch.setEthernetType(ethTypeBuilder.build());
EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(attachedMac);
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
matchBuilder.setEthernetMatch(ethernetMatch.build());
Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
Ipv4Prefix canonicalizedIpv4Prefix = IpAddressUtils.canonicalizeIpPrefixToNetAddress(dstIp);
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 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(segmentationId));
matchBuilder.setTunnel(tunnelBuilder.build());
return matchBuilder;
}