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


Java Criteria.matchMetadata方法代码示例

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


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

示例1: decodeCriterion

import org.onosproject.net.flow.criteria.Criteria; //导入方法依赖的package包/类
@Override
public Criterion decodeCriterion(ObjectNode json) {
    long metadata = nullIsIllegal(json.get(CriterionCodec.METADATA),
            CriterionCodec.METADATA + MISSING_MEMBER_MESSAGE).asLong();

    return Criteria.matchMetadata(metadata);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:8,代码来源:DecodeCriterionCodecHelper.java

示例2: matchMetadataTest

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

示例3: installDownstreamRules

import org.onosproject.net.flow.criteria.Criteria; //导入方法依赖的package包/类
private void installDownstreamRules(ForwardingObjective fwd) {
    List<Pair<Instruction, Instruction>> vlanOps =
            vlanOps(fwd,
                    L2ModificationInstruction.L2SubType.VLAN_POP);

    if (vlanOps == null) {
        return;
    }

    Instructions.OutputInstruction output = (Instructions.OutputInstruction) fetchOutput(fwd, "downstream");

    if (output == null) {
        return;
    }

    Pair<Instruction, Instruction> popAndRewrite = vlanOps.remove(0);

    TrafficSelector selector = fwd.selector();

    Criterion outerVlan = selector.getCriterion(Criterion.Type.VLAN_VID);
    Criterion innerVlan = selector.getCriterion(Criterion.Type.INNER_VLAN_VID);
    Criterion inport = selector.getCriterion(Criterion.Type.IN_PORT);
    Criterion bullshit = Criteria.matchMetadata(output.port().toLong());

    if (outerVlan == null || innerVlan == null || inport == null) {
        log.error("Forwarding objective is underspecified: {}", fwd);
        fail(fwd, ObjectiveError.BADPARAMS);
        return;
    }

    Criterion innerVid = Criteria.matchVlanId(((VlanIdCriterion) innerVlan).vlanId());

    FlowRule.Builder outer = DefaultFlowRule.builder()
            .fromApp(fwd.appId())
            .forDevice(deviceId)
            .makePermanent()
            .withPriority(fwd.priority())
            .withSelector(buildSelector(inport, outerVlan, bullshit))
            .withTreatment(buildTreatment(popAndRewrite.getLeft(),
                                          Instructions.transition(QQ_TABLE)));

    FlowRule.Builder inner = DefaultFlowRule.builder()
            .fromApp(fwd.appId())
            .forDevice(deviceId)
            .forTable(QQ_TABLE)
            .makePermanent()
            .withPriority(fwd.priority())
            .withSelector(buildSelector(inport, innerVid))
            .withTreatment(buildTreatment(popAndRewrite.getLeft(),
                                          output));

    applyRules(fwd, inner, outer);

}
 
开发者ID:shlee89,项目名称:athena,代码行数:55,代码来源:OltPipeline.java


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