当前位置: 首页>>代码示例>>Java>>正文


Java Instructions.modL1OduSignalId方法代码示例

本文整理汇总了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");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:DecodeInstructionCodecHelper.java

示例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));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:InstructionCodecTest.java


注:本文中的org.onosproject.net.flow.instructions.Instructions.modL1OduSignalId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。