Search in sources :

Example 1 with MulticastMappingInstruction

use of org.onosproject.mapping.instructions.MulticastMappingInstruction in project onos by opennetworkinglab.

the class EncodeMappingInstructionCodecHelper method encodeMulticast.

/**
 * Encodes a multicast mapping instruction.
 *
 * @param result json node that the mapping instruction
 *               attributes are added to
 */
private void encodeMulticast(ObjectNode result) {
    MulticastMappingInstruction multicastMappingInstruction = (MulticastMappingInstruction) instruction;
    result.put(MappingInstructionCodec.SUBTYPE, multicastMappingInstruction.subtype().name());
    switch(multicastMappingInstruction.subtype()) {
        case WEIGHT:
            MulticastMappingInstruction.WeightMappingInstruction wmi = (MulticastMappingInstruction.WeightMappingInstruction) multicastMappingInstruction;
            result.put(MappingInstructionCodec.MULTICAST_WEIGHT, wmi.weight());
            break;
        case PRIORITY:
            MulticastMappingInstruction.PriorityMappingInstruction pmi = (MulticastMappingInstruction.PriorityMappingInstruction) multicastMappingInstruction;
            result.put(MappingInstructionCodec.MULTICAST_PRIORITY, pmi.priority());
            break;
        default:
            log.info("Cannot convert multicast subtype of {}", multicastMappingInstruction.subtype());
    }
}
Also used : MulticastMappingInstruction(org.onosproject.mapping.instructions.MulticastMappingInstruction)

Aggregations

MulticastMappingInstruction (org.onosproject.mapping.instructions.MulticastMappingInstruction)1