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


Java MatchBuilder.getEthernetMatch方法代码示例

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


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

示例1: mergeEthernetMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; //导入方法依赖的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.flow.types.rev131026.flow.MatchBuilder; //导入方法依赖的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: createEthSrcDstMatch

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; //导入方法依赖的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;
}
 
开发者ID:opendaylight,项目名称:faas,代码行数:21,代码来源:OfMatchUtils.java

示例4: buildIpv4MatchTest

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; //导入方法依赖的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

示例5: buildIpv4DscpMatchTest

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; //导入方法依赖的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

示例6: buildIpv6MatchTest

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; //导入方法依赖的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

示例7: buildIpv4TcpMatchTest

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; //导入方法依赖的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

示例8: buildIpv4UdpMatchTest

import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; //导入方法依赖的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


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