use of org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction in project onos by opennetworkinglab.
the class InstructionJsonMatcher method matchModOduSingalIdInstruction.
/**
* Matches the contents of a mod ODU singal Id instruction.
*
* @param instructionJson JSON instruction to match
* @param description Description object used for recording errors
* @return true if contents matches, false otherwise
*/
private boolean matchModOduSingalIdInstruction(JsonNode instructionJson, Description description) {
ModOduSignalIdInstruction instructionToMatch = (ModOduSignalIdInstruction) instruction;
String jsonSubType = instructionJson.get("subtype").textValue();
if (!instructionToMatch.subtype().name().equals(jsonSubType)) {
description.appendText("subtype was " + jsonSubType);
return false;
}
String jsonType = instructionJson.get("type").textValue();
if (!instructionToMatch.type().name().equals(jsonType)) {
description.appendText("type was " + jsonType);
return false;
}
final JsonNode jsonOduSignal = instructionJson.get("oduSignalId");
int jsonTpn = jsonOduSignal.get("tributaryPortNumber").intValue();
int jsonTsLen = jsonOduSignal.get("tributarySlotLength").intValue();
byte[] tributaryBitMap = HexString.fromHexString(jsonOduSignal.get("tributarySlotBitmap").asText());
OduSignalId jsonOduSignalId = OduSignalId.oduSignalId(jsonTpn, jsonTsLen, tributaryBitMap);
if (!instructionToMatch.oduSignalId().equals(jsonOduSignalId)) {
description.appendText("oduSignalId was " + instructionToMatch);
return false;
}
return true;
}
use of org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction in project onos by opennetworkinglab.
the class FlowModBuilderVer13 method buildL1Modification.
protected OFAction buildL1Modification(Instruction i) {
L1ModificationInstruction l1m = (L1ModificationInstruction) i;
OFOxm<?> oxm = null;
switch(l1m.subtype()) {
case ODU_SIGID:
ModOduSignalIdInstruction modOduSignalIdInstruction = (ModOduSignalIdInstruction) l1m;
OduSignalId oduSignalId = modOduSignalIdInstruction.oduSignalId();
OduSignalID oduSignalID = new OduSignalID((short) oduSignalId.tributaryPortNumber(), (short) oduSignalId.tributarySlotLength(), oduSignalId.tributarySlotBitmap());
oxm = factory().oxms().expOduSigId(oduSignalID);
break;
default:
log.warn("Unimplemented action type {}.", l1m.subtype());
break;
}
if (oxm != null) {
return factory().actions().buildSetField().setField(oxm).build();
}
return null;
}
use of org.onosproject.net.flow.instructions.L1ModificationInstruction.ModOduSignalIdInstruction in project onos by opennetworkinglab.
the class InstructionJsonMatcher method matchesSafely.
@Override
public boolean matchesSafely(JsonNode jsonInstruction, Description description) {
// check type
final JsonNode jsonTypeNode = jsonInstruction.get("type");
final String jsonType = jsonTypeNode.textValue();
final String type = instruction.type().name();
if (!jsonType.equals(type)) {
description.appendText("type was " + type);
return false;
}
if (instruction instanceof ModMplsHeaderInstruction) {
return matchModMplsHeaderInstruction(jsonInstruction, description);
} else if (instruction instanceof OutputInstruction) {
return matchOutputInstruction(jsonInstruction, description);
} else if (instruction instanceof GroupInstruction) {
return matchGroupInstruction(jsonInstruction, description);
} else if (instruction instanceof MeterInstruction) {
return matchMeterInstruction(jsonInstruction, description);
} else if (instruction instanceof SetQueueInstruction) {
return matchSetQueueInstruction(jsonInstruction, description);
} else if (instruction instanceof ModOchSignalInstruction) {
return matchModOchSingalInstruction(jsonInstruction, description);
} else if (instruction instanceof ModEtherInstruction) {
return matchModEtherInstruction(jsonInstruction, description);
} else if (instruction instanceof ModVlanIdInstruction) {
return matchModVlanIdInstruction(jsonInstruction, description);
} else if (instruction instanceof ModVlanPcpInstruction) {
return matchModVlanPcpInstruction(jsonInstruction, description);
} else if (instruction instanceof ModIPInstruction) {
return matchModIpInstruction(jsonInstruction, description);
} else if (instruction instanceof ModIPv6FlowLabelInstruction) {
return matchModIPv6FlowLabelInstruction(jsonInstruction, description);
} else if (instruction instanceof ModMplsLabelInstruction) {
return matchModMplsLabelInstruction(jsonInstruction, description);
} else if (instruction instanceof ModOduSignalIdInstruction) {
return matchModOduSingalIdInstruction(jsonInstruction, description);
} else if (instruction instanceof PiInstruction) {
return matchPiInstruction(jsonInstruction, description);
} else if (instruction instanceof NoActionInstruction) {
return true;
}
return false;
}
Aggregations