Search in sources :

Example 1 with ModTransportPortInstruction

use of org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction in project onos by opennetworkinglab.

the class FlowModBuilderVer13 method buildL4Modification.

protected OFAction buildL4Modification(Instruction i) {
    L4ModificationInstruction l4m = (L4ModificationInstruction) i;
    ModTransportPortInstruction tp;
    OFOxm<?> oxm = null;
    switch(l4m.subtype()) {
        case TCP_SRC:
            tp = (ModTransportPortInstruction) l4m;
            oxm = factory().oxms().tcpSrc(TransportPort.of(tp.port().toInt()));
            break;
        case TCP_DST:
            tp = (ModTransportPortInstruction) l4m;
            oxm = factory().oxms().tcpDst(TransportPort.of(tp.port().toInt()));
            break;
        case UDP_SRC:
            tp = (ModTransportPortInstruction) l4m;
            oxm = factory().oxms().udpSrc(TransportPort.of(tp.port().toInt()));
            break;
        case UDP_DST:
            tp = (ModTransportPortInstruction) l4m;
            oxm = factory().oxms().udpDst(TransportPort.of(tp.port().toInt()));
            break;
        default:
            log.warn("Unimplemented action type {}.", l4m.subtype());
            break;
    }
    if (oxm != null) {
        return factory().actions().buildSetField().setField(oxm).build();
    }
    return null;
}
Also used : L4ModificationInstruction(org.onosproject.net.flow.instructions.L4ModificationInstruction) ModTransportPortInstruction(org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction)

Aggregations

L4ModificationInstruction (org.onosproject.net.flow.instructions.L4ModificationInstruction)1 ModTransportPortInstruction (org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction)1