本文整理汇总了Java中org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction类的典型用法代码示例。如果您正苦于以下问题:Java ModVlanIdInstruction类的具体用法?Java ModVlanIdInstruction怎么用?Java ModVlanIdInstruction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModVlanIdInstruction类属于org.onosproject.net.flow.instructions.L2ModificationInstruction包,在下文中一共展示了ModVlanIdInstruction类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: matchModVlanIdInstruction
点赞 3
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction; //导入依赖的package包/类
/**
* Matches the contents of a mod vlan id instruction.
*
* @param instructionJson JSON instruction to match
* @param description Description object used for recording errors
* @return true if contents match, false otherwise
*/
private boolean matchModVlanIdInstruction(JsonNode instructionJson,
Description description) {
ModVlanIdInstruction instructionToMatch =
(ModVlanIdInstruction) instruction;
final String jsonSubtype = instructionJson.get("subtype").textValue();
if (!instructionToMatch.subtype().name().equals(jsonSubtype)) {
description.appendText("subtype was " + jsonSubtype);
return false;
}
final String jsonType = instructionJson.get("type").textValue();
if (!instructionToMatch.type().name().equals(jsonType)) {
description.appendText("type was " + jsonType);
return false;
}
final short jsonVlanId = instructionJson.get("vlanId").shortValue();
final short vlanId = instructionToMatch.vlanId().toShort();
if (jsonVlanId != vlanId) {
description.appendText("vlan id was " + jsonVlanId);
return false;
}
return true;
}
开发者ID:shlee89,
项目名称:athena,
代码行数:33,
代码来源:InstructionJsonMatcher.java
示例2: readVlanFromTreatment
点赞 2
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction; //导入依赖的package包/类
private static VlanId readVlanFromTreatment(TrafficTreatment treatment) {
if (treatment == null) {
return null;
}
for (Instruction i : treatment.allInstructions()) {
if (i instanceof ModVlanIdInstruction) {
return ((ModVlanIdInstruction) i).vlanId();
}
}
return null;
}
开发者ID:shlee89,
项目名称:athena,
代码行数:12,
代码来源:Ofdpa2Pipeline.java
示例3: matchesSafely
点赞 2
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction; //导入依赖的package包/类
@Override
public boolean matchesSafely(JsonNode jsonInstruction, Description description) {
// check type
final JsonNode jsonTypeNode = jsonInstruction.get("type");
final String jsonType = jsonTypeNode.textValue();
final String type = instruction.type().name();
if (!jsonType.equals(type)) {
description.appendText("type was " + type);
return false;
}
if (instruction instanceof PushHeaderInstructions) {
return matchPushHeaderInstruction(jsonInstruction, description);
} else if (instruction instanceof OutputInstruction) {
return matchOutputInstruction(jsonInstruction, description);
} else if (instruction instanceof GroupInstruction) {
return matchGroupInstruction(jsonInstruction, description);
} else if (instruction instanceof MeterInstruction) {
return matchMeterInstruction(jsonInstruction, description);
} else if (instruction instanceof SetQueueInstruction) {
return matchSetQueueInstruction(jsonInstruction, description);
} else if (instruction instanceof ModOchSignalInstruction) {
return matchModOchSingalInstruction(jsonInstruction, description);
} else if (instruction instanceof ModEtherInstruction) {
return matchModEtherInstruction(jsonInstruction, description);
} else if (instruction instanceof ModVlanIdInstruction) {
return matchModVlanIdInstruction(jsonInstruction, description);
} else if (instruction instanceof ModVlanPcpInstruction) {
return matchModVlanPcpInstruction(jsonInstruction, description);
} else if (instruction instanceof ModIPInstruction) {
return matchModIpInstruction(jsonInstruction, description);
} else if (instruction instanceof ModIPv6FlowLabelInstruction) {
return matchModIPv6FlowLabelInstruction(jsonInstruction, description);
} else if (instruction instanceof ModMplsLabelInstruction) {
return matchModMplsLabelInstruction(jsonInstruction, description);
} else if (instruction instanceof ModOduSignalIdInstruction) {
return matchModOduSingalIdInstruction(jsonInstruction, description);
} else if (instruction instanceof NoActionInstruction) {
return true;
}
return false;
}
开发者ID:shlee89,
项目名称:athena,
代码行数:45,
代码来源:InstructionJsonMatcher.java
示例4: getTagManipulation
点赞 2
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction; //导入依赖的package包/类
private static TagManipulation getTagManipulation(FlowRule fr) {
boolean isPop = false;
boolean isPush = false;
VlanId vlanId = null;
EthType ethType = EtherType.VLAN.ethType(); //Default
for (Instruction inst:fr.treatment().allInstructions()) {
if (inst.type() == Instruction.Type.L2MODIFICATION) {
L2ModificationInstruction l2Mod = (L2ModificationInstruction) inst;
if (l2Mod.subtype() == L2ModificationInstruction.L2SubType.VLAN_POP) {
isPop = true;
} else if (l2Mod.subtype() == L2ModificationInstruction.L2SubType.VLAN_PUSH) {
isPush = true;
ethType = ((ModVlanHeaderInstruction) l2Mod).ethernetType();
} else if (l2Mod.subtype() == L2ModificationInstruction.L2SubType.VLAN_ID) {
vlanId = ((ModVlanIdInstruction) l2Mod).vlanId();
}
}
}
if (isPop) {
//The should be no vlanId in this case
TagPop pop = new DefaultTagPop();
org.onosproject.yang.gen.v1.mseaunievcservice.rev20160317.mseaunievcservice
.evcperuniextensionattributes.tagmanipulation
.tagpop.TagPop popInner =
new org.onosproject.yang.gen.v1.mseaunievcservice.rev20160317
.mseaunievcservice.evcperuniextensionattributes
.tagmanipulation.tagpop.DefaultTagPop();
pop.tagPop(popInner);
return pop;
} else if (isPush && vlanId != null) {
TagPush push = new DefaultTagPush();
org.onosproject.yang.gen.v1.mseaunievcservice.rev20160317.mseaunievcservice
.evcperuniextensionattributes.tagmanipulation
.tagpush.TagPush pushInner =
new org.onosproject.yang.gen.v1.mseaunievcservice.rev20160317
.mseaunievcservice.evcperuniextensionattributes
.tagmanipulation.tagpush.DefaultTagPush();
pushInner.outerTagVlan(new VlanIdType(vlanId.id()));
pushInner.pushTagType(ethType.equals(EtherType.VLAN.ethType()) ?
PushTagTypeEnum.PUSHCTAG : PushTagTypeEnum.PUSHSTAG);
push.tagPush(pushInner);
return push;
} else if (vlanId != null) { //This is overwrite, as it has vlanId, but not push or pop
TagOverwrite ovr = new DefaultTagOverwrite();
org.onosproject.yang.gen.v1.mseaunievcservice.rev20160317.mseaunievcservice
.evcperuniextensionattributes.tagmanipulation
.tagoverwrite.TagOverwrite ovrInner =
new org.onosproject.yang.gen.v1.mseaunievcservice.rev20160317
.mseaunievcservice.evcperuniextensionattributes
.tagmanipulation.tagoverwrite.DefaultTagOverwrite();
ovrInner.outerTagVlan(new VlanIdType(vlanId.id()));
ovr.tagOverwrite(ovrInner);
return ovr;
}
return null;
}
开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:61,
代码来源:EA1000FlowRuleProgrammable.java
示例5: updateBuilder
点赞 2
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction; //导入依赖的package包/类
/**
* Update the selector builder using a L2 instruction.
*
* @param builder the builder to update
* @param l2instruction the l2 instruction to use
*/
private void updateBuilder(TrafficSelector.Builder builder, L2ModificationInstruction l2instruction) {
switch (l2instruction.subtype()) {
case ETH_SRC:
case ETH_DST:
ModEtherInstruction ethInstr = (ModEtherInstruction) l2instruction;
switch (ethInstr.subtype()) {
case ETH_SRC:
builder.matchEthSrc(ethInstr.mac());
break;
case ETH_DST:
builder.matchEthDst(ethInstr.mac());
break;
default:
throw new IntentCompilationException(UNSUPPORTED_ETH_SUBTYPE);
}
break;
case VLAN_ID:
ModVlanIdInstruction vlanIdInstr = (ModVlanIdInstruction) l2instruction;
builder.matchVlanId(vlanIdInstr.vlanId());
break;
case VLAN_PUSH:
//FIXME
break;
case VLAN_POP:
//TODO how do we handle dropped label? remove the selector?
throw new IntentCompilationException(UNSUPPORTED_POP_ACTION);
case VLAN_PCP:
ModVlanPcpInstruction vlanPcpInstruction = (ModVlanPcpInstruction) l2instruction;
builder.matchVlanPcp(vlanPcpInstruction.vlanPcp());
break;
case MPLS_LABEL:
case MPLS_PUSH:
//FIXME
ModMplsLabelInstruction mplsInstr = (ModMplsLabelInstruction) l2instruction;
builder.matchMplsLabel(mplsInstr.label());
break;
case MPLS_POP:
//TODO how do we handle dropped label? remove the selector?
throw new IntentCompilationException(UNSUPPORTED_POP_ACTION);
case DEC_MPLS_TTL:
// no-op
break;
case MPLS_BOS:
ModMplsBosInstruction mplsBosInstr = (ModMplsBosInstruction) l2instruction;
builder.matchMplsBos(mplsBosInstr.mplsBos());
break;
case TUNNEL_ID:
ModTunnelIdInstruction tunInstr = (ModTunnelIdInstruction) l2instruction;
builder.matchTunnelId(tunInstr.tunnelId());
break;
default:
throw new IntentCompilationException(UNSUPPORTED_L2);
}
}
开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:72,
代码来源:LinkCollectionCompiler.java
示例6: matchesSafely
点赞 2
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction; //导入依赖的package包/类
@Override
public boolean matchesSafely(JsonNode jsonInstruction, Description description) {
// check type
final JsonNode jsonTypeNode = jsonInstruction.get("type");
final String jsonType = jsonTypeNode.textValue();
final String type = instruction.type().name();
if (!jsonType.equals(type)) {
description.appendText("type was " + type);
return false;
}
if (instruction instanceof ModMplsHeaderInstruction) {
return matchModMplsHeaderInstruction(jsonInstruction, description);
} else if (instruction instanceof OutputInstruction) {
return matchOutputInstruction(jsonInstruction, description);
} else if (instruction instanceof GroupInstruction) {
return matchGroupInstruction(jsonInstruction, description);
} else if (instruction instanceof MeterInstruction) {
return matchMeterInstruction(jsonInstruction, description);
} else if (instruction instanceof SetQueueInstruction) {
return matchSetQueueInstruction(jsonInstruction, description);
} else if (instruction instanceof ModOchSignalInstruction) {
return matchModOchSingalInstruction(jsonInstruction, description);
} else if (instruction instanceof ModEtherInstruction) {
return matchModEtherInstruction(jsonInstruction, description);
} else if (instruction instanceof ModVlanIdInstruction) {
return matchModVlanIdInstruction(jsonInstruction, description);
} else if (instruction instanceof ModVlanPcpInstruction) {
return matchModVlanPcpInstruction(jsonInstruction, description);
} else if (instruction instanceof ModIPInstruction) {
return matchModIpInstruction(jsonInstruction, description);
} else if (instruction instanceof ModIPv6FlowLabelInstruction) {
return matchModIPv6FlowLabelInstruction(jsonInstruction, description);
} else if (instruction instanceof ModMplsLabelInstruction) {
return matchModMplsLabelInstruction(jsonInstruction, description);
} else if (instruction instanceof ModOduSignalIdInstruction) {
return matchModOduSingalIdInstruction(jsonInstruction, description);
} else if (instruction instanceof NoActionInstruction) {
return true;
}
return false;
}
开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:45,
代码来源:InstructionJsonMatcher.java