本文整理汇总了Java中org.onosproject.net.flow.instructions.Instructions.modL1OduSignalId方法的典型用法代码示例。如果您正苦于以下问题:Java Instructions.modL1OduSignalId方法的具体用法?Java Instructions.modL1OduSignalId怎么用?Java Instructions.modL1OduSignalId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onosproject.net.flow.instructions.Instructions
的用法示例。
在下文中一共展示了Instructions.modL1OduSignalId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeL1
import org.onosproject.net.flow.instructions.Instructions; //导入方法依赖的package包/类
/**
* Decodes a Layer 1 instruction.
*
* @return instruction object decoded from the JSON
* @throws IllegalArgumentException if the JSON is invalid
*/
private Instruction decodeL1() {
String subType = json.get(InstructionCodec.SUBTYPE).asText();
if (subType.equals(L1ModificationInstruction.L1SubType.ODU_SIGID.name())) {
int tributaryPortNumber = nullIsIllegal(json.get(InstructionCodec.TRIBUTARY_PORT_NUMBER),
InstructionCodec.TRIBUTARY_PORT_NUMBER + InstructionCodec.MISSING_MEMBER_MESSAGE).asInt();
int tributarySlotLen = nullIsIllegal(json.get(InstructionCodec.TRIBUTARY_SLOT_LEN),
InstructionCodec.TRIBUTARY_SLOT_LEN + InstructionCodec.MISSING_MEMBER_MESSAGE).asInt();
byte[] tributarySlotBitmap = null;
tributarySlotBitmap = HexString.fromHexString(
nullIsIllegal(json.get(InstructionCodec.TRIBUTARY_SLOT_BITMAP),
InstructionCodec.TRIBUTARY_SLOT_BITMAP + InstructionCodec.MISSING_MEMBER_MESSAGE).asText());
return Instructions.modL1OduSignalId(OduSignalId.oduSignalId(tributaryPortNumber, tributarySlotLen,
tributarySlotBitmap));
}
throw new IllegalArgumentException("L1 Instruction subtype "
+ subType + " is not supported");
}
示例2: modOduSignalIdInstructionTest
import org.onosproject.net.flow.instructions.Instructions; //导入方法依赖的package包/类
/**
* Tests the encoding of mod ODU signal ID instructions.
*/
@Test
public void modOduSignalIdInstructionTest() {
OduSignalId oduSignalId = OduSignalId.oduSignalId(1, 8, new byte[] {8, 0, 0, 0, 0, 0, 0, 0, 0, 0});
L1ModificationInstruction.ModOduSignalIdInstruction instruction =
(L1ModificationInstruction.ModOduSignalIdInstruction)
Instructions.modL1OduSignalId(oduSignalId);
ObjectNode instructionJson =
instructionCodec.encode(instruction, context);
assertThat(instructionJson, matchesInstruction(instruction));
}