本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch类的典型用法代码示例。如果您正苦于以下问题:Java EthernetMatch类的具体用法?Java EthernetMatch怎么用?Java EthernetMatch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EthernetMatch类属于org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match包,在下文中一共展示了EthernetMatch类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mergeEthernetMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
private static EthernetMatch mergeEthernetMatch(MatchBuilder match, EthernetMatchBuilder ethMatchBuilder) {
EthernetMatch ethMatch = match.getEthernetMatch();
if (ethMatch == null) {
return ethMatchBuilder.build();
}
if (ethMatch.getEthernetDestination() != null) {
ethMatchBuilder.setEthernetDestination(ethMatch.getEthernetDestination());
}
if (ethMatch.getEthernetSource() != null) {
ethMatchBuilder.setEthernetSource(ethMatch.getEthernetSource());
}
if (ethMatch.getEthernetType() != null) {
ethMatchBuilder.setEthernetType(ethMatch.getEthernetType());
}
return ethMatchBuilder.build();
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:21,代码来源:AclMatches.java
示例2: buildEthMatchTest
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
@Test
public void buildEthMatchTest() {
AceEthBuilder aceEthBuilder = new AceEthBuilder();
aceEthBuilder.setDestinationMacAddress(new MacAddress(MAC_DST_STR));
aceEthBuilder.setSourceMacAddress(new MacAddress(MAC_SRC_STR));
MatchesBuilder matchesBuilder = new MatchesBuilder();
matchesBuilder.setAceType(aceEthBuilder.build());
// Create the aclMatches that is the object to be tested
AclMatches aclMatches = new AclMatches(matchesBuilder.build());
MatchBuilder matchBuilder = aclMatches.buildMatch();
// The ethernet match should be there with src/dst values
EthernetMatch ethMatch = matchBuilder.getEthernetMatch();
assertNotNull(ethMatch);
assertEquals(ethMatch.getEthernetSource().getAddress().getValue(), MAC_SRC_STR);
assertEquals(ethMatch.getEthernetDestination().getAddress().getValue(), MAC_DST_STR);
// The rest should be null
assertNull(matchBuilder.getIpMatch());
assertNull(matchBuilder.getLayer3Match());
assertNull(matchBuilder.getLayer4Match());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:25,代码来源:AclMatchesTest.java
示例3: generateRibForwardingObj
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
private ForwardingObjectiveBuilder generateRibForwardingObj(AtriumIpPrefix prefix, Integer nextId) {
ForwardingObjectiveBuilder forwardingObjBuilder = new ForwardingObjectiveBuilder();
MatchBuilder matchBuilder = new MatchBuilder();
// set Ethernet type - IPv4
EthernetMatch etherMatch = AtriumUtils.getEtherMatch(IPV4_ETH_TYPE);
matchBuilder.setEthernetMatch(etherMatch);
// set IP DST - prefix
Layer3Match l3Match = AtriumUtils.createLayer3Match(prefix, false);
matchBuilder.setLayer3Match(l3Match);
forwardingObjBuilder.setMatch(matchBuilder.build());
// set priority
int priority = prefix.prefixLength() * PRIORITY_MULTIPLIER + PRIORITY_OFFSET;
forwardingObjBuilder.setPriority(Integer.valueOf(priority));
forwardingObjBuilder.setFlag(Flag.Specific);
if (nextId != null) {
forwardingObjBuilder.setNextId(nextId);
}
return forwardingObjBuilder;
}
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:25,代码来源:Bgprouter.java
示例4: gnerateFilterObjectiveBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
private FilterObjectiveBuilder gnerateFilterObjectiveBuilder(AtriumInterface intf) {
checkNotNull(intf);
Set<AtriumInterfaceIpAddress> ipAddresses = intf.ipAddresses();
MacAddress ethDstMac = intf.mac();
AtriumVlanId vlanId = intf.vlan();
FilterObjectiveBuilder fobjBuilder = new FilterObjectiveBuilder();
// Match ethernet destination
EthernetMatch ethMatch = AtriumUtils.getEtherMatch(ethDstMac, IPV4_ETH_TYPE, false);
// Match vlan
VlanMatch vlanMatch = AtriumUtils.getVlanMatch(vlanId.toShort());
fobjBuilder.setEthernetMatch(ethMatch);
fobjBuilder.setVlanMatch(vlanMatch);
fobjBuilder.setInPort(intf.connectPoint().getId());
// Match IP Dst
for (AtriumInterfaceIpAddress infAddr : ipAddresses) {
Ipv4Match l3Match = AtriumUtils.getL3Match(infAddr, false);
fobjBuilder.setLayer3Match(l3Match);
}
return fobjBuilder;
}
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:27,代码来源:Bgprouter.java
示例5: addArpFlowToController
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
public void addArpFlowToController(NodeId dpnId) {
NodeRef nodeRef = new NodeRef(
InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(dpnId)).build());
ForwardingObjectiveBuilder fwdObjBuilder = new ForwardingObjectiveBuilder();
fwdObjBuilder.setOperation(Operation.Add);
fwdObjBuilder.setFlag(Flag.Versatile);
MatchBuilder matchBuilder = new MatchBuilder();
EthernetMatch etherMatch = AtriumUtils.getEtherMatch(Bgprouter.ARP_ETH_TYPE);
matchBuilder.setEthernetMatch(etherMatch);
ActionData puntAction = new ActionData(ActionUtils.punt_to_controller, new String[] { null });
fwdObjBuilder.setMatch(matchBuilder.build());
List<Action> actions = new ArrayList<>();
actions.add(puntAction.buildAction());
fwdObjBuilder.setAction(actions);
ForwardInputBuilder forwardInputBuilderSrc = new ForwardInputBuilder();
forwardInputBuilderSrc.setNode(nodeRef);
forwardInputBuilderSrc.setForwardingObjective(fwdObjBuilder.build());
flowObjectivesService.forward(forwardInputBuilderSrc.build());
}
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:26,代码来源:Bgprouter.java
示例6: createSetFieldDestinationMacAddress
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
/**
*
* @param order An integer representing the order of the Action
* within the table.
* @param macAddress Destination MAC address
* @return Action with an order
*/
public static Action createSetFieldDestinationMacAddress(int order, String macAddress) {
Action action;
ActionBuilder ab = new ActionBuilder();
MacAddress address = MacAddress.getDefaultInstance(macAddress);
EthernetDestination destination = new EthernetDestinationBuilder().setAddress(address).build();
EthernetMatchBuilder builder = new EthernetMatchBuilder();
builder.setEthernetDestination(destination);
EthernetMatch ethernetMatch = builder.build();
SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
setFieldBuilder.setEthernetMatch(ethernetMatch);
SetField setField = setFieldBuilder.build();
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action acction = new SetFieldCaseBuilder().
setSetField(setField).build();
ab.setOrder(order).setKey(new ActionKey(order)).setAction(acction);
action = ab.build();
return action;
}
开发者ID:opendaylight,项目名称:nic,代码行数:28,代码来源:FlowUtils.java
示例7: createArpReplyToControllerFlow
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
protected FlowBuilder createArpReplyToControllerFlow() {
final FlowBuilder arpFlow = new FlowBuilder()
.setPriority(OFRendererConstants.ARP_REPLY_TO_CONTROLLER_FLOW_PRIORITY)
.setIdleTimeout(0)
.setHardTimeout(0)
.setCookie(new FlowCookie(BigInteger.valueOf(flowCookie.incrementAndGet())))
.setFlags(new FlowModFlags(false, false, false, false, false));
final EthernetMatch ethernetMatch = FlowUtils.createEthernetMatch();
/** NOTE:
* Setting layer 3 match seems to be messing with the flow ID
* check for possible bug on openflow plugin side.
* Use following code for specific ARP REQUEST or REPLY packet capture
* ArpMatch arpMatch = FlowUtils.createArpMatch();
*/
final Match match = new MatchBuilder().setEthernetMatch(ethernetMatch).build();//.setLayer3Match(arpMatch).build();
arpFlow.setMatch(match);
final Instructions instructions = createOutputInstructions(OutputPortValues.CONTROLLER, OutputPortValues.NORMAL);
arpFlow.setInstructions(instructions);
final String flowName = createFlowName();
arpFlow.setFlowName(flowName);
final FlowId flowId = new FlowId(flowName);
arpFlow.setId(flowId);
arpFlow.setKey(new FlowKey(flowId));
return arpFlow;
}
开发者ID:opendaylight,项目名称:nic,代码行数:26,代码来源:ArpFlowManager.java
示例8: ethernetMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的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();
}
开发者ID:sdnhub,项目名称:SDNHub_Opendaylight_Tutorial,代码行数:19,代码来源:MatchUtils.java
示例9: buildIpv4MatchTest
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
@Test
public void buildIpv4MatchTest() {
AceIpv4Builder aceIpv4 = new AceIpv4Builder();
aceIpv4.setDestinationIpv4Network(new Ipv4Prefix(IPV4_DST_STR));
aceIpv4.setSourceIpv4Network(new Ipv4Prefix(IPV4_SRC_STR));
AceIpBuilder aceIpBuilder = new AceIpBuilder();
aceIpBuilder.setAceIpVersion(aceIpv4.build());
MatchesBuilder matchesBuilder = new MatchesBuilder();
matchesBuilder.setAceType(aceIpBuilder.build());
// Create the aclMatches that is the object to be tested
AclMatches aclMatches = new AclMatches(matchesBuilder.build());
MatchBuilder matchBuilder = aclMatches.buildMatch();
// The layer3 match should be there with src/dst values
Ipv4Match l3 = (Ipv4Match) matchBuilder.getLayer3Match();
assertNotNull(l3);
assertEquals(l3.getIpv4Destination().getValue().toString(), IPV4_DST_STR);
assertEquals(l3.getIpv4Source().getValue().toString(), IPV4_SRC_STR);
// There should be an IPv4 etherType set
EthernetMatch ethMatch = matchBuilder.getEthernetMatch();
assertNotNull(ethMatch);
assertEquals(ethMatch.getEthernetType().getType().getValue(), Long.valueOf(NwConstants.ETHTYPE_IPV4));
// The rest should be null
assertNull(matchBuilder.getIpMatch());
assertNull(matchBuilder.getLayer4Match());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:32,代码来源:AclMatchesTest.java
示例10: buildIpv4DscpMatchTest
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
@Test
public void buildIpv4DscpMatchTest() {
AceIpBuilder aceIpBuilder = new AceIpBuilder();
aceIpBuilder.setAceIpVersion(new AceIpv4Builder().build());
aceIpBuilder.setDscp(new Dscp(DSCP_VALUE));
MatchesBuilder matchesBuilder = new MatchesBuilder();
matchesBuilder.setAceType(aceIpBuilder.build());
// Create the aclMatches that is the object to be tested
AclMatches aclMatches = new AclMatches(matchesBuilder.build());
MatchBuilder matchBuilder = aclMatches.buildMatch();
// There should be an IPv4 etherType set
EthernetMatch ethMatch = matchBuilder.getEthernetMatch();
assertNotNull(ethMatch);
assertEquals(ethMatch.getEthernetType().getType().getValue(), Long.valueOf(NwConstants.ETHTYPE_IPV4));
// Check the DSCP value
IpMatch ipMatch = matchBuilder.getIpMatch();
assertNotNull(ipMatch);
assertEquals(ipMatch.getIpDscp().getValue(), Short.valueOf(DSCP_VALUE));
// The rest should be null
assertNull(matchBuilder.getLayer3Match());
assertNull(matchBuilder.getLayer4Match());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:28,代码来源:AclMatchesTest.java
示例11: buildIpv6MatchTest
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
@Test
public void buildIpv6MatchTest() {
AceIpv6Builder aceIpv6 = new AceIpv6Builder();
aceIpv6.setDestinationIpv6Network(new Ipv6Prefix(IPV6_DST_STR));
aceIpv6.setSourceIpv6Network(new Ipv6Prefix(IPV6_SRC_STR));
AceIpBuilder aceIpBuilder = new AceIpBuilder();
aceIpBuilder.setAceIpVersion(aceIpv6.build());
MatchesBuilder matchesBuilder = new MatchesBuilder();
matchesBuilder.setAceType(aceIpBuilder.build());
// Create the aclMatches that is the object to be tested
AclMatches aclMatches = new AclMatches(matchesBuilder.build());
MatchBuilder matchBuilder = aclMatches.buildMatch();
// The layer3 match should be there with src/dst values
Ipv6Match l3 = (Ipv6Match) matchBuilder.getLayer3Match();
assertNotNull(l3);
assertEquals(l3.getIpv6Destination().getValue().toString(), IPV6_DST_STR);
assertEquals(l3.getIpv6Source().getValue().toString(), IPV6_SRC_STR);
// There should be an IPv6 etherType set
EthernetMatch ethMatch = matchBuilder.getEthernetMatch();
assertNotNull(ethMatch);
assertEquals(ethMatch.getEthernetType().getType().getValue(), Long.valueOf(NwConstants.ETHTYPE_IPV6));
// The rest should be null
assertNull(matchBuilder.getIpMatch());
assertNull(matchBuilder.getLayer4Match());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:32,代码来源:AclMatchesTest.java
示例12: addIcmpFlowToController
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
public void addIcmpFlowToController(NodeId dpnId) {
NodeRef nodeRef = new NodeRef(
InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(dpnId)).build());
ForwardingObjectiveBuilder fwdObjBuilder = new ForwardingObjectiveBuilder();
fwdObjBuilder.setOperation(Operation.Add);
fwdObjBuilder.setFlag(Flag.Versatile);
MatchBuilder matchBuilder = new MatchBuilder();
// set Ethernet type - IPv4
EthernetMatch etherMatch = AtriumUtils.getEtherMatch(Bgprouter.IPV4_ETH_TYPE);
matchBuilder.setEthernetMatch(etherMatch);
// Ip type Match
IpMatch ipMatch = AtriumUtils.getIcmpIpMatchType();
matchBuilder.setIpMatch(ipMatch);
ActionData puntAction = new ActionData(ActionUtils.punt_to_controller, new String[] { null });
fwdObjBuilder.setMatch(matchBuilder.build());
List<Action> actions = new ArrayList<>();
actions.add(puntAction.buildAction());
fwdObjBuilder.setAction(actions);
ForwardInputBuilder forwardInputBuilderSrc = new ForwardInputBuilder();
forwardInputBuilderSrc.setNode(nodeRef);
forwardInputBuilderSrc.setForwardingObjective(fwdObjBuilder.build());
flowObjectivesService.forward(forwardInputBuilderSrc.build());
}
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:32,代码来源:Bgprouter.java
示例13: getEtherMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的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();
}
}
开发者ID:onfsdn,项目名称:atrium-odl,代码行数:19,代码来源:AtriumUtils.java
示例14: ethernetMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的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();
}
开发者ID:opendaylight,项目名称:faas,代码行数:14,代码来源:OfMatchUtils.java
示例15: testCreateSetFieldDestinationMacAddressAction
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
@Test
public void testCreateSetFieldDestinationMacAddressAction() throws Exception {
ActionBuilder ab = mock(ActionBuilder.class);
PowerMockito.whenNew(ActionBuilder.class).withNoArguments().thenReturn(ab);
EthernetMatchBuilder ethernetMatchBuilder = mock(EthernetMatchBuilder.class);
PowerMockito.whenNew(EthernetMatchBuilder.class).withNoArguments().thenReturn(ethernetMatchBuilder);
when(ethernetMatchBuilder.setEthernetDestination(any(EthernetDestination.class))).thenReturn(ethernetMatchBuilder);
when(ab.setOrder(any(Integer.class))).thenReturn(ab);
PowerMockito.whenNew(ActionKey.class).withAnyArguments().thenReturn(mock(ActionKey.class));
when(ab.setKey(any(ActionKey.class))).thenReturn(ab);
SetFieldCaseBuilder setFieldCaseBuilder = mock(SetFieldCaseBuilder.class);
PowerMockito.whenNew(SetFieldCaseBuilder.class).withNoArguments().thenReturn(setFieldCaseBuilder);
when(setFieldCaseBuilder.setSetField(any(SetField.class))).thenReturn(setFieldCaseBuilder);
when(ab.setAction(any(SetFieldCase.class))).thenReturn(ab);
SetFieldBuilder setFieldBuilder = mock(SetFieldBuilder.class);
PowerMockito.whenNew(SetFieldBuilder.class).withNoArguments().thenReturn(setFieldBuilder);
when(setFieldBuilder.setProtocolMatchFields(any(ProtocolMatchFields.class))).thenReturn(setFieldBuilder);
when(ethernetMatchBuilder.build()).thenReturn(mock(EthernetMatch.class));
when(setFieldBuilder.build()).thenReturn(mock(SetField.class));
when(setFieldCaseBuilder.build()).thenReturn(mock(SetFieldCase.class));
Action action = mock(Action.class);
when(ab.build()).thenReturn(action);
assertEquals("Failed to return correct Action object", action, FlowUtils.createSetFieldDestinationMacAddress(0, "d2:00:1f:e5:8b:e4"));
}
开发者ID:opendaylight,项目名称:nic,代码行数:30,代码来源:FlowUtilsTest.java
示例16: testCreateArpReplyControllerFlow
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
@Test
public void testCreateArpReplyControllerFlow() {
flowBuilder = arpFlowManager.createArpReplyToControllerFlow();
Assert.assertEquals(flowBuilder.getPriority().intValue(),
OFRendererConstants.ARP_REPLY_TO_CONTROLLER_FLOW_PRIORITY);
Assert.assertEquals(flowBuilder.getIdleTimeout().intValue(), 0);
Assert.assertEquals(flowBuilder.getHardTimeout().intValue(), 0);
Assert.assertNotNull(flowBuilder.getCookie());
Assert.assertNotNull(flowBuilder.getFlags());
final Match match = flowBuilder.getMatch();
final EthernetMatch ethernetMatch = FlowUtils.createEthernetMatch();
Assert.assertEquals(match.getEthernetMatch(), ethernetMatch);
}
开发者ID:opendaylight,项目名称:nic,代码行数:16,代码来源:ArpFlowManagerTest.java
示例17: buildIpv4TcpMatchTest
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
@Test
public void buildIpv4TcpMatchTest() {
AceIpBuilder aceIpBuilder = new AceIpBuilder();
aceIpBuilder.setAceIpVersion(new AceIpv4Builder().build());
aceIpBuilder.setProtocol(IPProtocols.TCP.shortValue());
SourcePortRangeBuilder srcPortRange = new SourcePortRangeBuilder();
srcPortRange.setLowerPort(new PortNumber(TCP_SRC_LOWER_PORT));
srcPortRange.setUpperPort(new PortNumber(TCP_SRC_UPPER_PORT));
aceIpBuilder.setSourcePortRange(srcPortRange.build());
DestinationPortRangeBuilder dstPortRange = new DestinationPortRangeBuilder();
dstPortRange.setLowerPort(new PortNumber(TCP_DST_LOWER_PORT));
dstPortRange.setUpperPort(new PortNumber(TCP_DST_UPPER_PORT));
aceIpBuilder.setDestinationPortRange(dstPortRange.build());
MatchesBuilder matchesBuilder = new MatchesBuilder();
matchesBuilder.setAceType(aceIpBuilder.build());
// Create the aclMatches that is the object to be tested
AclMatches aclMatches = new AclMatches(matchesBuilder.build());
MatchBuilder matchBuilder = aclMatches.buildMatch();
// There should be an IPv4 etherType set
EthernetMatch ethMatch = matchBuilder.getEthernetMatch();
assertNotNull(ethMatch);
assertEquals(ethMatch.getEthernetType().getType().getValue(), Long.valueOf(NwConstants.ETHTYPE_IPV4));
// Make sure its TCP
IpMatch ipMatch = matchBuilder.getIpMatch();
assertNotNull(ipMatch);
assertEquals(ipMatch.getIpProtocol(), Short.valueOf(IPProtocols.TCP.shortValue()));
// Currently ranges arent supported, only the lower port is used
TcpMatch tcpMatch = (TcpMatch) matchBuilder.getLayer4Match();
assertEquals(tcpMatch.getTcpSourcePort().getValue(), Integer.valueOf(TCP_SRC_LOWER_PORT));
assertEquals(tcpMatch.getTcpDestinationPort().getValue(), Integer.valueOf(TCP_DST_LOWER_PORT));
// The layer3 match should be null
assertNull(matchBuilder.getLayer3Match());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:42,代码来源:AclMatchesTest.java
示例18: buildIpv4UdpMatchTest
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
@Test
public void buildIpv4UdpMatchTest() {
AceIpBuilder aceIpBuilder = new AceIpBuilder();
aceIpBuilder.setAceIpVersion(new AceIpv4Builder().build());
aceIpBuilder.setProtocol(IPProtocols.UDP.shortValue());
SourcePortRangeBuilder srcPortRange = new SourcePortRangeBuilder();
srcPortRange.setLowerPort(new PortNumber(UDP_SRC_LOWER_PORT));
srcPortRange.setUpperPort(new PortNumber(UDP_SRC_UPPER_PORT));
aceIpBuilder.setSourcePortRange(srcPortRange.build());
DestinationPortRangeBuilder dstPortRange = new DestinationPortRangeBuilder();
dstPortRange.setLowerPort(new PortNumber(UDP_DST_LOWER_PORT));
dstPortRange.setUpperPort(new PortNumber(UDP_DST_UPPER_PORT));
aceIpBuilder.setDestinationPortRange(dstPortRange.build());
MatchesBuilder matchesBuilder = new MatchesBuilder();
matchesBuilder.setAceType(aceIpBuilder.build());
// Create the aclMatches that is the object to be tested
AclMatches aclMatches = new AclMatches(matchesBuilder.build());
MatchBuilder matchBuilder = aclMatches.buildMatch();
// There should be an IPv4 etherType set
EthernetMatch ethMatch = matchBuilder.getEthernetMatch();
assertNotNull(ethMatch);
assertEquals(ethMatch.getEthernetType().getType().getValue(), Long.valueOf(NwConstants.ETHTYPE_IPV4));
// Make sure its UDP
IpMatch ipMatch = matchBuilder.getIpMatch();
assertNotNull(ipMatch);
assertEquals(ipMatch.getIpProtocol(), Short.valueOf(IPProtocols.UDP.shortValue()));
// Currently ranges arent supported, only the lower port is used
UdpMatch udpMatch = (UdpMatch) matchBuilder.getLayer4Match();
assertEquals(udpMatch.getUdpSourcePort().getValue(), Integer.valueOf(UDP_SRC_LOWER_PORT));
assertEquals(udpMatch.getUdpDestinationPort().getValue(), Integer.valueOf(UDP_DST_LOWER_PORT));
// The layer3 match should be null
assertNull(matchBuilder.getLayer3Match());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:42,代码来源:AclMatchesTest.java
示例19: createEthernetMatch
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch; //导入依赖的package包/类
/**
* Creates {@link EthernetMatch} containing ARP ether-type and the given destination MAC address
* @return EthernetMatch
*/
public static EthernetMatch createEthernetMatch() {
return new EthernetMatchBuilder().setEthernetType(
new EthernetTypeBuilder().setType(new EtherType(Long.valueOf(EtherTypes.ARP.intValue()))).build())
.build();
}
开发者ID:opendaylight,项目名称:nic,代码行数:10,代码来源:FlowUtils.java
注:本文中的org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论