use of org.onosproject.driver.extensions.DefaultMoveExtensionTreatment in project onos by opennetworkinglab.
the class MoveExtensionTreatmentCodec method decode.
@Override
public MoveExtensionTreatment decode(ObjectNode json, CodecContext context) {
if (json == null || !json.isObject()) {
return null;
}
// parse extension treatment type
ExtensionTreatmentType type = new ExtensionTreatmentType(nullIsIllegal(json.get(TYPE), TYPE + MISSING_MEMBER_MESSAGE).asInt());
// parse src off set
int srcOfs = nullIsIllegal(json.get(SRC_OFS), SRC_OFS + MISSING_MEMBER_MESSAGE).asInt();
// parse dst off set
int dstOfs = nullIsIllegal(json.get(DST_OFS), DST_OFS + MISSING_MEMBER_MESSAGE).asInt();
// parse n bits
int nBits = nullIsIllegal(json.get(N_BITS), N_BITS + MISSING_MEMBER_MESSAGE).asInt();
// parse src
int src = nullIsIllegal(json.get(SRC), SRC + MISSING_MEMBER_MESSAGE).asInt();
// parse dst
int dst = nullIsIllegal(json.get(DST), DST + MISSING_MEMBER_MESSAGE).asInt();
return new DefaultMoveExtensionTreatment(srcOfs, dstOfs, nBits, src, dst, type);
}
Aggregations