本文整理汇总了Java中org.onosproject.net.flow.instructions.L0ModificationInstruction类的典型用法代码示例。如果您正苦于以下问题:Java L0ModificationInstruction类的具体用法?Java L0ModificationInstruction怎么用?Java L0ModificationInstruction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
L0ModificationInstruction类属于org.onosproject.net.flow.instructions包,在下文中一共展示了L0ModificationInstruction类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: encodeL0
点赞 3
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
/**
* Encode an L0 modification instruction.
*
* @param result json node that the instruction attributes are added to
*/
private void encodeL0(ObjectNode result) {
L0ModificationInstruction l0Instruction = (L0ModificationInstruction) instruction;
result.put(InstructionCodec.SUBTYPE, l0Instruction.subtype().name());
switch (l0Instruction.subtype()) {
case OCH:
L0ModificationInstruction.ModOchSignalInstruction ochSignalInstruction =
(L0ModificationInstruction.ModOchSignalInstruction) l0Instruction;
OchSignal ochSignal = ochSignalInstruction.lambda();
result.put(InstructionCodec.GRID_TYPE, ochSignal.gridType().name());
result.put(InstructionCodec.CHANNEL_SPACING, ochSignal.channelSpacing().name());
result.put(InstructionCodec.SPACING_MULTIPLIER, ochSignal.spacingMultiplier());
result.put(InstructionCodec.SLOT_GRANULARITY, ochSignal.slotGranularity());
break;
default:
log.info("Cannot convert L0 subtype of {}", l0Instruction.subtype());
}
}
开发者ID:shlee89,
项目名称:athena,
代码行数:25,
代码来源:EncodeInstructionCodecHelper.java
示例2: buildL0Modification
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
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;
}
开发者ID:shlee89,
项目名称:athena,
代码行数:28,
代码来源:FlowModBuilderVer13.java
示例3: buildL0Modification
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
private OFAction buildL0Modification(Instruction i) {
L0ModificationInstruction l0m = (L0ModificationInstruction) i;
switch (l0m.subtype()) {
default:
log.warn("Unimplemented action type {}.", l0m.subtype());
break;
}
return null;
}
开发者ID:shlee89,
项目名称:athena,
代码行数:10,
代码来源:GroupModBuilder.java
示例4: decodeL0
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的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
示例5: modOchSignalInstructionTest
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的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
示例6: buildL0Modification
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
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;
}
开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:14,
代码来源:FlowModBuilderVer13.java
示例7: buildL0Modification
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
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;
}
开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:15,
代码来源:GroupModBuilder.java
示例8: encodeL0
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
/**
* Encode an L0 modification instruction.
*
* @param result json node that the instruction attributes are added to
* @param instruction The L0 instruction
*/
private void encodeL0(ObjectNode result, L0ModificationInstruction instruction) {
result.put("subtype", instruction.subtype().name());
switch (instruction.subtype()) {
case LAMBDA:
final L0ModificationInstruction.ModLambdaInstruction modLambdaInstruction =
(L0ModificationInstruction.ModLambdaInstruction) instruction;
result.put("lambda", modLambdaInstruction.lambda());
break;
default:
log.info("Cannot convert L0 subtype of {}", instruction.subtype());
}
}
开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:21,
代码来源:InstructionCodec.java
示例9: modLambdaInstructionTest
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
/**
* Tests the encoding of mod lambda instructions.
*/
@Test
public void modLambdaInstructionTest() {
final L0ModificationInstruction.ModLambdaInstruction instruction =
(L0ModificationInstruction.ModLambdaInstruction)
Instructions.modL0Lambda((short) 55);
final ObjectNode instructionJson =
instructionCodec.encode(instruction, context);
assertThat(instructionJson, matchesInstruction(instruction));
}
开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:13,
代码来源:InstructionCodecTest.java
示例10: buildL0Modification
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
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;
}
开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:28,
代码来源:FlowModBuilderVer13.java
示例11: decodeL0
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的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 = nullIsIllegal(json.get(InstructionCodec.SUBTYPE),
InstructionCodec.SUBTYPE + InstructionCodec.ERROR_MESSAGE).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:opennetworkinglab,
项目名称:onos,
代码行数:36,
代码来源:DecodeInstructionCodecHelper.java
示例12: encode
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
@Override
public ObjectNode encode(Instruction instruction, CodecContext context) {
checkNotNull(instruction, "Instruction cannot be null");
final ObjectNode result = context.mapper().createObjectNode()
.put("type", instruction.type().toString());
switch (instruction.type()) {
case OUTPUT:
final Instructions.OutputInstruction outputInstruction =
(Instructions.OutputInstruction) instruction;
result.put("port", outputInstruction.port().toLong());
break;
case DROP:
break;
case L0MODIFICATION:
final L0ModificationInstruction l0ModificationInstruction =
(L0ModificationInstruction) instruction;
encodeL0(result, l0ModificationInstruction);
break;
case L2MODIFICATION:
final L2ModificationInstruction l2ModificationInstruction =
(L2ModificationInstruction) instruction;
encodeL2(result, l2ModificationInstruction, context);
break;
case L3MODIFICATION:
final L3ModificationInstruction l3ModificationInstruction =
(L3ModificationInstruction) instruction;
encodeL3(result, l3ModificationInstruction);
break;
default:
log.info("Cannot convert instruction type of {}", instruction.type());
break;
}
return result;
}
开发者ID:ravikumaran2015,
项目名称:ravikumaran201504,
代码行数:43,
代码来源:InstructionCodec.java
示例13: updateBuilder
点赞 2
import org.onosproject.net.flow.instructions.L0ModificationInstruction; //导入依赖的package包/类
/**
* Update selector builder by using treatment.
*
* @param builder builder to update
* @param treatment traffic treatment
*/
private void updateBuilder(TrafficSelector.Builder builder, TrafficTreatment treatment) {
treatment.allInstructions().forEach(instruction -> {
switch (instruction.type()) {
case L0MODIFICATION:
updateBuilder(builder, (L0ModificationInstruction) instruction);
break;
case L1MODIFICATION:
updateBuilder(builder, (L1ModificationInstruction) instruction);
break;
case L2MODIFICATION:
updateBuilder(builder, (L2ModificationInstruction) instruction);
break;
case L3MODIFICATION:
updateBuilder(builder, (L3ModificationInstruction) instruction);
break;
case L4MODIFICATION:
updateBuilder(builder, (L4ModificationInstruction) instruction);
break;
case NOACTION:
case OUTPUT:
case GROUP:
case QUEUE:
case TABLE:
case METER:
case METADATA:
case EXTENSION: // TODO is extension no-op or unsupported?
// Nothing to do
break;
default:
throw new IntentCompilationException(UNSUPPORTED_INSTRUCTION);
}
});
}
开发者ID:opennetworkinglab,
项目名称:onos,
代码行数:48,
代码来源:LinkCollectionCompiler.java