private OchSignal createLambda(int i) { return new OchSignal(GridType.FLEX, ChannelSpacing.CHL_6P25GHZ, i, 1); }
private OchSignal createOchSignal() throws IllegalArgumentException { if (signal == null) { return null; } try { String[] splitted = signal.split("/"); checkArgument(splitted.length == 4, "signal requires 4 parameters: " + SIGNAL_FORMAT); int slotGranularity = Integer.parseInt(splitted[0]); String chSpacing = splitted[1]; ChannelSpacing channelSpacing = checkNotNull(CHANNEL_SPACING_MAP.get(chSpacing), String.format("invalid channel spacing: %s", chSpacing)); int multiplier = Integer.parseInt(splitted[2]); String gdType = splitted[3].toUpperCase(); GridType gridType = GridType.valueOf(gdType); return new OchSignal(gridType, channelSpacing, multiplier, slotGranularity); } catch (RuntimeException e) { /* catching RuntimeException as both NullPointerException (thrown by * checkNotNull) and IllegalArgumentException (thrown by checkArgument) * are subclasses of RuntimeException. */ String msg = String.format("Invalid signal format: %s, expected format is %s.", signal, SIGNAL_FORMAT); print(msg); throw new IllegalArgumentException(msg, e); } }
/** * Creates an instance of {@link OchSignal} from JSON representation. * * @param obj JSON Object representing OchSignal * @return OchSignal * @throws IllegalArgumentException - if JSON object is ill-formed * @see OchSignalCodec#encode(OchSignal) */ public static OchSignal decode(ObjectNode obj) { final GridType gridType; final ChannelSpacing channelSpacing; final int spacingMultiplier; final int slotGranularity; String s; s = obj.get("channelSpacing").textValue(); checkArgument(s != null, "ill-formed channelSpacing"); channelSpacing = Enum.valueOf(ChannelSpacing.class, s); s = obj.get("gridType").textValue(); checkArgument(s != null, "ill-formed gridType"); gridType = Enum.valueOf(GridType.class, s); JsonNode node; node = obj.get("spacingMultiplier"); checkArgument(node.canConvertToInt(), "ill-formed spacingMultiplier"); spacingMultiplier = node.asInt(); node = obj.get("slotGranularity"); checkArgument(node.canConvertToInt(), "ill-formed slotGranularity"); slotGranularity = node.asInt(); return new OchSignal(gridType, channelSpacing, spacingMultiplier, slotGranularity); }
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));
Spectrum.U_BAND_MIN, Spectrum.O_BAND_MAX, Frequency.ofGHz(50), annotations); case 5: // OCH port OchSignal signal = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 0, 4); return ochPortDescription(portNo, enabled, OduSignalType.ODU4, true, signal, annotations);
OchSignal signalId = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 1, 1);