/**
* Matches the contents of a mod MPLS label instruction.
*
* @param instructionJson JSON instruction to match
* @param description Description object used for recording errors
* @return true if contents match, false otherwise
*/
private boolean matchModMplsLabelInstruction(JsonNode instructionJson,
Description description) {
ModMplsLabelInstruction instructionToMatch =
(ModMplsLabelInstruction) 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 int jsonLabel = instructionJson.get("label").intValue();
final int label = instructionToMatch.label().toInt();
if (label != jsonLabel) {
description.appendText("MPLS label was " + jsonLabel);
return false;
}
return true;
}
InstructionJsonMatcher.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:athena
作者:
评论列表
文章目录