本文整理汇总了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);
}
示例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));
}
示例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);
}