/** * Rewrite match object to use LINC OF optical extensions. * * @param match original match * @return rewritten match */ private Match rewriteMatch(Match match) { Match.Builder mBuilder = factory().buildMatch(); for (MatchField mf : match.getMatchFields()) { if (mf == MatchField.EXP_OCH_SIG_ID) { mBuilder.setExact(MatchField.OCH_SIGID, (CircuitSignalID) match.get(mf)); continue; } if (mf == MatchField.EXP_OCH_SIGTYPE) { mBuilder.setExact(MatchField.OCH_SIGTYPE, (U8) match.get(mf)); continue; } mBuilder.setExact(mf, match.get(mf)); } return mBuilder.build(); }
/** * Rewrite actions to use LINC OF optical extensions. * * @param actions original actions * @return rewritten actions */ private List<OFAction> rewriteActions(List<OFAction> actions) { List<OFAction> newActions = new LinkedList<>(); for (OFAction action : actions) { if (!(action instanceof OFActionSetField)) { newActions.add(action); continue; } OFActionSetField sf = (OFActionSetField) action; if (!(sf.getField() instanceof OFOxmExpOchSigId)) { newActions.add(action); continue; } OFOxmExpOchSigId oxm = (OFOxmExpOchSigId) sf.getField(); CircuitSignalID signalId = oxm.getValue(); newActions.add( factory().actions().circuit(factory().oxms().ochSigid(signalId))); } return newActions; }
private OFAction buildL0Modification(Instruction i) { L0ModificationInstruction l0m = (L0ModificationInstruction) i; OFOxm<?> oxm = null; switch (l0m.subtype()) { case OCH: try { ModOchSignalInstruction modOchSignalInstruction = (ModOchSignalInstruction) l0m; OchSignal signal = modOchSignalInstruction.lambda(); byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType()); byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing()); oxm = factory().oxms().expOchSigId( new CircuitSignalID(gridType, channelSpacing, (short) signal.spacingMultiplier(), (short) signal.slotGranularity())); } catch (NoMappingFoundException e) { log.warn(e.getMessage()); break; } break; default: log.warn("Unimplemented action type {}.", l0m.subtype()); break; } if (oxm != null) { return factory().actions().buildSetField().setField(oxm).build(); } return null; }
private OFAction buildModOchSignalInstruction(ModOchSignalInstruction instruction) { OchSignal signal = instruction.lambda(); byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType()); byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing()); return factory().actions().circuit(factory().oxms().expOchSigId( new CircuitSignalID(gridType, channelSpacing, (short) signal.spacingMultiplier(), (short) signal.slotGranularity()) )); }
private OFAction buildL0Modification(Instruction i) { L0ModificationInstruction l0m = (L0ModificationInstruction) i; switch (l0m.subtype()) { case LAMBDA: ModLambdaInstruction ml = (ModLambdaInstruction) i; return factory().actions().circuit(factory().oxms().ochSigidBasic( new CircuitSignalID((byte) 1, (byte) 2, ml.lambda(), (short) 1))); default: log.warn("Unimplemented action type {}.", l0m.subtype()); break; } return null; }
private OFAction buildL0Modification(Instruction i) { L0ModificationInstruction l0m = (L0ModificationInstruction) i; switch (l0m.subtype()) { case LAMBDA: L0ModificationInstruction.ModLambdaInstruction ml = (L0ModificationInstruction.ModLambdaInstruction) i; return factory.actions().circuit(factory.oxms().ochSigidBasic( new CircuitSignalID((byte) 1, (byte) 2, ml.lambda(), (short) 1))); default: log.warn("Unimplemented action type {}.", l0m.subtype()); break; } return null; }
protected OFAction buildL0Modification(Instruction i) { L0ModificationInstruction l0m = (L0ModificationInstruction) i; OFOxm<?> oxm = null; switch (l0m.subtype()) { case OCH: try { ModOchSignalInstruction modOchSignalInstruction = (ModOchSignalInstruction) l0m; OchSignal signal = modOchSignalInstruction.lambda(); byte gridType = OpenFlowValueMapper.lookupGridType(signal.gridType()); byte channelSpacing = OpenFlowValueMapper.lookupChannelSpacing(signal.channelSpacing()); oxm = factory().oxms().expOchSigId( new CircuitSignalID(gridType, channelSpacing, (short) signal.spacingMultiplier(), (short) signal.slotGranularity())); } catch (NoMappingFoundException e) { log.warn(e.getMessage()); break; } break; default: log.warn("Unimplemented action type {}.", l0m.subtype()); break; } if (oxm != null) { return factory().actions().buildSetField().setField(oxm).build(); } return null; }