• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Criterion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.onosproject.net.flow.criteria.Criterion的典型用法代码示例。如果您正苦于以下问题:Java Criterion类的具体用法?Java Criterion怎么用?Java Criterion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Criterion类属于org.onosproject.net.flow.criteria包,在下文中一共展示了Criterion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildConnectivityDetails

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
private void buildConnectivityDetails(ConnectivityIntent intent,
                                      StringBuilder sb) {
    Set<Criterion> criteria = intent.selector().criteria();
    List<Instruction> instructions = intent.treatment().allInstructions();
    List<Constraint> constraints = intent.constraints();

    if (!criteria.isEmpty()) {
        sb.append("Selector: ").append(criteria);
    }
    if (!instructions.isEmpty()) {
        sb.append("Treatment: ").append(instructions);
    }
    if (constraints != null && !constraints.isEmpty()) {
        sb.append("Constraints: ").append(constraints);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:IntentViewMessageHandler.java


示例2: processSpecific

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
private Collection<FlowRule> processSpecific(ForwardingObjective fwd) {
    log.debug("Processing specific forwarding objective");
    TrafficSelector selector = fwd.selector();
    EthTypeCriterion ethType =
            (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE);
    if (ethType != null) {
        short et = ethType.ethType().toShort();
        if (et == Ethernet.TYPE_IPV4) {
            return processSpecificRoute(fwd);
        } else if (et == Ethernet.TYPE_VLAN) {
            /* The ForwardingObjective must specify VLAN ethtype in order to use the Transit Circuit */
            return processSpecificSwitch(fwd);
        }
    }

    fail(fwd, ObjectiveError.UNSUPPORTED);
    return ImmutableSet.of();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:AbstractCorsaPipeline.java


示例3: processSpecificSwitch

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
@Override
protected Collection<FlowRule> processSpecificSwitch(ForwardingObjective fwd) {
    TrafficSelector filteredSelector =
            DefaultTrafficSelector.builder()
                    .matchInPort(
                            ((PortCriterion) fwd.selector().getCriterion(Criterion.Type.IN_PORT)).port())
                    .matchVlanId(
                            ((VlanIdCriterion) fwd.selector().getCriterion(Criterion.Type.VLAN_VID)).vlanId())
                    .build();

    Builder ruleBuilder = DefaultFlowRule.builder()
            .fromApp(fwd.appId())
            .withPriority(fwd.priority())
            .forDevice(deviceId)
            .withSelector(filteredSelector)
            .withTreatment(fwd.treatment())
            .forTable(VLAN_CIRCUIT_TABLE);

    if (fwd.permanent()) {
        ruleBuilder.makePermanent();
    } else {
        ruleBuilder.makeTemporary(fwd.timeout());
    }

    return Collections.singletonList(ruleBuilder.build());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:CorsaPipelineV3.java


示例4: testForwardingObjectiveEncode

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
/**
 * Tests encoding of a ForwardingObjective object.
 */
@Test
public void testForwardingObjectiveEncode() {

    Criterion criterion1 = Criteria.matchVlanId(VlanId.ANY);
    Criterion criterion2 = Criteria.matchEthType((short) 0x8844);
    TrafficSelector selector = DefaultTrafficSelector.builder()
            .add(criterion1)
            .add(criterion2)
            .build();

    ForwardingObjective forwardingObj = DefaultForwardingObjective.builder()
            .makePermanent()
            .fromApp(APP_ID)
            .withPriority(60)
            .withFlag(ForwardingObjective.Flag.SPECIFIC)
            .nextStep(1)
            .withSelector(selector)
            .add();

    ObjectNode forwardingObjJson = forwardingObjectiveCodec.encode(forwardingObj, context);
    assertThat(forwardingObjJson, matchesForwardingObjective(forwardingObj));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:ForwardingObjectiveCodecTest.java


示例5: cleanAllFlowRules

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
private void cleanAllFlowRules() {
    Iterable<Device> deviceList = deviceService.getAvailableDevices();

    for (Device d : deviceList) {
        DeviceId id = d.id();
        log.trace("Searching for flow rules to remove from: " + id);
        for (FlowEntry r : flowRuleService.getFlowEntries(id)) {
            boolean match = false;
            for (Instruction i : r.treatment().allInstructions()) {
                if (i.type() == Instruction.Type.OUTPUT) {
                    OutputInstruction oi = (OutputInstruction) i;
                    // if the flow has matching src and dst
                    for (Criterion cr : r.selector().criteria()) {
                        if (cr.type() == Criterion.Type.ETH_DST || cr.type() == Criterion.Type.ETH_SRC) {
                                    match = true;
                        }
                    }
                }
            }
            if (match) {
                log.trace("Removed flow rule from device: " + id);
                flowRuleService.removeFlowRules((FlowRule) r);
            }
        }
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:SimpleLoadBalancer.java


示例6: testTrafficSelectorEncode

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
/**
 * Tests encoding of a traffic selector object.
 */
@Test
public void testTrafficSelectorEncode() {

    Criterion inPort = Criteria.matchInPort(PortNumber.portNumber(0));
    Criterion ethSrc = Criteria.matchEthSrc(MacAddress.valueOf("11:22:33:44:55:66"));
    Criterion ethDst = Criteria.matchEthDst(MacAddress.valueOf("44:55:66:77:88:99"));
    Criterion ethType = Criteria.matchEthType(Ethernet.TYPE_IPV4);

    TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder();
    TrafficSelector selector = sBuilder
            .add(inPort)
            .add(ethSrc)
            .add(ethDst)
            .add(ethType)
            .build();

    ObjectNode selectorJson = trafficSelectorCodec.encode(selector, context);
    assertThat(selectorJson, TrafficSelectorJsonMatcher.matchesTrafficSelector(selector));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:TrafficSelectorCodecTest.java


示例7: encodeCriterion

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
@Override
public ObjectNode encodeCriterion(ObjectNode root, Criterion criterion) {
    OduSignalId oduSignalId = ((OduSignalIdCriterion) criterion).oduSignalId();
    ObjectNode child = root.putObject(CriterionCodec.ODU_SIGNAL_ID);

    child.put(CriterionCodec.TRIBUTARY_PORT_NUMBER, oduSignalId.tributaryPortNumber());
    child.put(CriterionCodec.TRIBUTARY_SLOT_LEN, oduSignalId.tributarySlotLength());
    child.put(CriterionCodec.TRIBUTARY_SLOT_BITMAP, HexString.toHexString(oduSignalId.tributarySlotBitmap()));

    return root;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:EncodeCriterionCodecHelper.java


示例8: matchOchSignalTypeTest

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
/**
 * Tests Och signal type criterion.
 */
@Test
public void matchOchSignalTypeTest() {
    Criterion criterion = Criteria.matchOchSignalType(OchSignalType.FIXED_GRID);
    ObjectNode result = criterionCodec.encode(criterion, context);
    assertThat(result, matchesCriterion(criterion));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java


示例9: isSupportedEthDstObjective

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
private boolean isSupportedEthDstObjective(ForwardingObjective fwd) {
    TrafficSelector selector = fwd.selector();
    EthCriterion ethDst = (EthCriterion) selector
            .getCriterion(Criterion.Type.ETH_DST);
    VlanIdCriterion vlanId = (VlanIdCriterion) selector
            .getCriterion(Criterion.Type.VLAN_VID);
    return !(ethDst == null && vlanId == null);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:9,代码来源:Ofdpa2Pipeline.java


示例10: readIpDstFromSelector

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
protected static IpPrefix readIpDstFromSelector(TrafficSelector selector) {
    if (selector == null) {
        return null;
    }
    Criterion criterion = selector.getCriterion(Criterion.Type.IPV4_DST);
    return (criterion == null) ? null : ((IPCriterion) criterion).ip();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:Ofdpa2Pipeline.java


示例11: isSupportedEthTypeObjective

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
private boolean isSupportedEthTypeObjective(ForwardingObjective fwd) {
    TrafficSelector selector = fwd.selector();
    EthTypeCriterion ethType = (EthTypeCriterion) selector
            .getCriterion(Criterion.Type.ETH_TYPE);
    if ((ethType == null) ||
            ((ethType.ethType().toShort() != Ethernet.TYPE_IPV4) &&
                    (ethType.ethType().toShort() != Ethernet.MPLS_UNICAST))) {
        return false;
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:SpringOpenTTP.java


示例12: isSupportedEthDstObjective

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
private boolean isSupportedEthDstObjective(ForwardingObjective fwd) {
    TrafficSelector selector = fwd.selector();
    EthCriterion ethDst = (EthCriterion) selector
            .getCriterion(Criterion.Type.ETH_DST);
    VlanIdCriterion vlanId = (VlanIdCriterion) selector
            .getCriterion(Criterion.Type.VLAN_VID);
    if (ethDst == null && vlanId == null) {
        return false;
    }
    return true;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:SpringOpenTTP.java


示例13: matchIPv6NDTargetLinkLayerAddressTest

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
/**
 * Tests IPV6 TLL criterion.
 */
@Test
public void matchIPv6NDTargetLinkLayerAddressTest() {
    Criterion criterion = Criteria.matchIPv6NDTargetLinkLayerAddress(mac1);
    ObjectNode result = criterionCodec.encode(criterion, context);
    assertThat(result, matchesCriterion(criterion));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java


示例14: processVersatile

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
private Collection<FlowRule> processVersatile(ForwardingObjective fwd) {
    log.debug("Processing versatile forwarding objective");
    TrafficSelector selector = fwd.selector();
    TrafficTreatment treatment = fwd.treatment();
    Collection<FlowRule> flowrules = new ArrayList<FlowRule>();

    // first add this rule for basic single-table operation
    // or non-ARP related multi-table operation
    FlowRule rule = DefaultFlowRule.builder()
            .forDevice(deviceId)
            .withSelector(selector)
            .withTreatment(treatment)
            .withPriority(fwd.priority())
            .fromApp(fwd.appId())
            .makePermanent()
            .forTable(ACL_TABLE).build();
    flowrules.add(rule);

    EthTypeCriterion ethType =
            (EthTypeCriterion) selector.getCriterion(Criterion.Type.ETH_TYPE);
    if (ethType == null) {
        log.warn("No ethType in versatile forwarding obj. Not processing further.");
        return flowrules;
    }

    // now deal with possible mix of ARP with filtering objectives
    // in multi-table scenarios
    if (ethType.ethType().toShort() == Ethernet.TYPE_ARP) {
        if (filters.isEmpty()) {
            pendingVersatiles.add(fwd);
            return flowrules;
        }
        for (Filter filter : filters) {
            flowrules.addAll(processVersatilesWithFilters(filter, fwd));
        }
    }
    return flowrules;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:39,代码来源:PicaPipeline.java


示例15: matchVlanIdTest

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
/**
 * Tests VLAN Id criterion.
 */
@Test
public void matchVlanIdTest() {
    Criterion criterion = Criteria.matchVlanId(VlanId.ANY);
    ObjectNode result = criterionCodec.encode(criterion, context);
    assertThat(result, matchesCriterion(criterion));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java


示例16: matchEthDstTest

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
/**
 * Tests ethernet destination criterion.
 */
@Test
public void matchEthDstTest() {
    Criterion criterion = Criteria.matchEthDst(mac1);
    ObjectNode result = criterionCodec.encode(criterion, context);
    assertThat(result, matchesCriterion(criterion));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java


示例17: setUp

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
/**
 * Sets up for each test.  Creates a context and fetches the criterion
 * codec.
 */
@Before
public void setUp() {
    context = new MockCodecContext();
    criterionCodec = context.codec(Criterion.class);
    assertThat(criterionCodec, notNullValue());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:CriterionCodecTest.java


示例18: processIpTraffic

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
@Override
protected Collection<FlowRule> processIpTraffic(ForwardingObjective fwd, FlowRule.Builder rule) {
    IPCriterion ipSrc = (IPCriterion) fwd.selector()
            .getCriterion(Criterion.Type.IPV4_SRC);
    if (ipSrc != null) {
        log.warn("Driver does not currently handle matching Src IP");
        fail(fwd, ObjectiveError.UNSUPPORTED);
        return Collections.emptySet();
    }
    IPCriterion ipDst = (IPCriterion) fwd.selector()
            .getCriterion(Criterion.Type.IPV4_DST);
    if (ipDst != null) {
        log.error("Driver handles Dst IP matching as specific forwarding "
                + "objective, not versatile");
        fail(fwd, ObjectiveError.UNSUPPORTED);
        return Collections.emptySet();
    }
    IPProtocolCriterion ipProto = (IPProtocolCriterion) fwd.selector()
            .getCriterion(Criterion.Type.IP_PROTO);
    if (ipProto != null && ipProto.protocol() == IPv4.PROTOCOL_TCP) {
        log.warn("Driver automatically punts all packets reaching the "
                + "LOCAL table to the controller");
        pass(fwd);
        return Collections.emptySet();
    }
    return Collections.emptySet();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:OvsCorsaPipeline.java


示例19: decodePointToPointIntent

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
/**
 * Tests the point to point intent JSON codec.
 *
 * @throws IOException if JSON processing fails
 */
@Test
public void decodePointToPointIntent() throws IOException {
    JsonCodec<Intent> intentCodec = context.codec(Intent.class);
    assertThat(intentCodec, notNullValue());

    Intent intent = getIntent("PointToPointIntent.json", intentCodec);
    assertThat(intent, notNullValue());
    assertThat(intent, instanceOf(PointToPointIntent.class));

    PointToPointIntent pointIntent = (PointToPointIntent) intent;
    assertThat(pointIntent.priority(), is(55));
    assertThat(pointIntent.ingressPoint().deviceId(), is(did("0000000000000001")));
    assertThat(pointIntent.ingressPoint().port(), is(PortNumber.portNumber(1)));
    assertThat(pointIntent.egressPoint().deviceId(), is(did("0000000000000007")));
    assertThat(pointIntent.egressPoint().port(), is(PortNumber.portNumber(2)));

    assertThat(pointIntent.constraints(), hasSize(1));

    assertThat(pointIntent.selector(), notNullValue());
    assertThat(pointIntent.selector().criteria(), hasSize(1));
    Criterion criterion1 = pointIntent.selector().criteria().iterator().next();
    assertThat(criterion1, instanceOf(EthCriterion.class));
    EthCriterion ethCriterion = (EthCriterion) criterion1;
    assertThat(ethCriterion.mac().toString(), is("11:22:33:44:55:66"));
    assertThat(ethCriterion.type().name(), is("ETH_DST"));

    assertThat(pointIntent.treatment(), notNullValue());
    assertThat(pointIntent.treatment().allInstructions(), hasSize(1));
    Instruction instruction1 = pointIntent.treatment().allInstructions().iterator().next();
    assertThat(instruction1, instanceOf(ModEtherInstruction.class));
    ModEtherInstruction ethInstruction = (ModEtherInstruction) instruction1;
    assertThat(ethInstruction.mac().toString(), is("22:33:44:55:66:77"));
    assertThat(ethInstruction.type().toString(), is("L2MODIFICATION"));
    assertThat(ethInstruction.subtype().toString(), is("ETH_SRC"));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:41,代码来源:IntentCodecTest.java


示例20: matchInPhyPortTest

import org.onosproject.net.flow.criteria.Criterion; //导入依赖的package包/类
/**
 * Tests in physical port criterion.
 */
@Test
public void matchInPhyPortTest() {
    Criterion criterion = Criteria.matchInPhyPort(port);
    ObjectNode result = criterionCodec.encode(criterion, context);
    assertThat(result, matchesCriterion(criterion));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:CriterionCodecTest.java



注:本文中的org.onosproject.net.flow.criteria.Criterion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EaseMobException类代码示例发布时间:2022-05-23
下一篇:
Java ActionManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap