本文整理汇总了Java中org.onosproject.net.flow.criteria.Criteria.matchVlanId方法的典型用法代码示例。如果您正苦于以下问题:Java Criteria.matchVlanId方法的具体用法?Java Criteria.matchVlanId怎么用?Java Criteria.matchVlanId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.flow.criteria.Criteria
的用法示例。
在下文中一共展示了Criteria.matchVlanId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFilteringObjectiveEncode
import org.onosproject.net.flow.criteria.Criteria; //导入方法依赖的package包/类
/**
* Tests encoding of a FilteringObjective object.
*/
@Test
public void testFilteringObjectiveEncode() {
Criterion condition1 = Criteria.matchVlanId(VlanId.ANY);
Criterion condition2 = Criteria.matchEthType((short) 0x8844);
FilteringObjective filteringObj = DefaultFilteringObjective.builder()
.makePermanent()
.permit()
.fromApp(APP_ID)
.withPriority(60)
.addCondition(condition1)
.addCondition(condition2)
.add();
// TODO: need to add test case for TrafficTreatment (META in filteringObj)
ObjectNode filteringObjJson = filteringObjectiveCodec.encode(filteringObj, context);
assertThat(filteringObjJson, matchesFilteringObjective(filteringObj));
}
示例2: testForwardingObjectiveEncode
import org.onosproject.net.flow.criteria.Criteria; //导入方法依赖的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));
}
示例3: decodeCriterion
import org.onosproject.net.flow.criteria.Criteria; //导入方法依赖的package包/类
@Override
public Criterion decodeCriterion(ObjectNode json) {
short vlanId = (short) nullIsIllegal(json.get(CriterionCodec.VLAN_ID),
CriterionCodec.VLAN_ID + MISSING_MEMBER_MESSAGE).asInt();
return Criteria.matchVlanId(VlanId.vlanId(vlanId));
}
示例4: matchVlanIdTest
import org.onosproject.net.flow.criteria.Criteria; //导入方法依赖的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));
}
示例5: 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);
}