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


Java Instructions.modL0Lambda方法代码示例

本文整理汇总了Java中org.onosproject.net.flow.instructions.Instructions.modL0Lambda方法的典型用法代码示例。如果您正苦于以下问题:Java Instructions.modL0Lambda方法的具体用法?Java Instructions.modL0Lambda怎么用?Java Instructions.modL0Lambda使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.net.flow.instructions.Instructions的用法示例。


在下文中一共展示了Instructions.modL0Lambda方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decodeL0

import org.onosproject.net.flow.instructions.Instructions; //导入方法依赖的package包/类
/**
 * Decodes a Layer 0 instruction.
 *
 * @return instruction object decoded from the JSON
 * @throws IllegalArgumentException if the JSON is invalid
 */
private Instruction decodeL0() {
    String subType = json.get(InstructionCodec.SUBTYPE).asText();

    if (subType.equals(L0ModificationInstruction.L0SubType.OCH.name())) {
        String gridTypeString = nullIsIllegal(json.get(InstructionCodec.GRID_TYPE),
                InstructionCodec.GRID_TYPE + InstructionCodec.MISSING_MEMBER_MESSAGE).asText();
        GridType gridType = GridType.valueOf(gridTypeString);
        if (gridType == null) {
            throw new IllegalArgumentException("Unknown grid type  "
                    + gridTypeString);
        }
        String channelSpacingString = nullIsIllegal(json.get(InstructionCodec.CHANNEL_SPACING),
                InstructionCodec.CHANNEL_SPACING + InstructionCodec.MISSING_MEMBER_MESSAGE).asText();
        ChannelSpacing channelSpacing = ChannelSpacing.valueOf(channelSpacingString);
        if (channelSpacing == null) {
            throw new IllegalArgumentException("Unknown channel spacing  "
                    + channelSpacingString);
        }
        int spacingMultiplier = nullIsIllegal(json.get(InstructionCodec.SPACING_MULTIPLIER),
                InstructionCodec.SPACING_MULTIPLIER + InstructionCodec.MISSING_MEMBER_MESSAGE).asInt();
        int slotGranularity = nullIsIllegal(json.get(InstructionCodec.SLOT_GRANULARITY),
                InstructionCodec.SLOT_GRANULARITY + InstructionCodec.MISSING_MEMBER_MESSAGE).asInt();
        return Instructions.modL0Lambda(new OchSignal(gridType, channelSpacing,
                spacingMultiplier, slotGranularity));
    }
    throw new IllegalArgumentException("L0 Instruction subtype "
            + subType + " is not supported");
}
 
开发者ID:shlee89,项目名称:athena,代码行数:35,代码来源:DecodeInstructionCodecHelper.java

示例2: modOchSignalInstructionTest

import org.onosproject.net.flow.instructions.Instructions; //导入方法依赖的package包/类
/**
 * Tests the encoding of mod OCh signal instructions.
 */
@Test
public void modOchSignalInstructionTest() {
    L0ModificationInstruction.ModOchSignalInstruction instruction =
            (L0ModificationInstruction.ModOchSignalInstruction)
                    Instructions.modL0Lambda(Lambda.ochSignal(GridType.DWDM, ChannelSpacing.CHL_100GHZ, 4, 8));
    ObjectNode instructionJson =
            instructionCodec.encode(instruction, context);
    assertThat(instructionJson, matchesInstruction(instruction));
}
 
开发者ID:shlee89,项目名称:athena,代码行数:13,代码来源:InstructionCodecTest.java


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