Search in sources :

Example 6 with L3ModificationInstruction

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

the class HPPipelineV2 method checkUnSupportedFeatures.

// Return TRUE if ForwardingObjective fwd includes UNSUPPORTED features
@Override
protected boolean checkUnSupportedFeatures(TrafficSelector selector, TrafficTreatment treatment) {
    boolean unsupportedFeatures = false;
    for (Criterion criterion : selector.criteria()) {
        if (this.unsupportedCriteria.contains(criterion.type())) {
            log.warn("HP V2 Driver - unsupported criteria {}", criterion.type());
            unsupportedFeatures = true;
        }
    }
    for (Instruction instruction : treatment.allInstructions()) {
        if (this.unsupportedInstructions.contains(instruction.type())) {
            log.warn("HP V2 Driver - unsupported instruction {}", instruction.type());
            unsupportedFeatures = true;
        }
        if (instruction.type() == Instruction.Type.L2MODIFICATION) {
            if (this.unsupportedL2mod.contains(((L2ModificationInstruction) instruction).subtype())) {
                log.warn("HP V2 Driver - unsupported L2MODIFICATION instruction {}", ((L2ModificationInstruction) instruction).subtype());
                unsupportedFeatures = true;
            }
        }
        if (instruction.type() == Instruction.Type.L3MODIFICATION) {
            if (this.unsupportedL3mod.contains(((L3ModificationInstruction) instruction).subtype())) {
                log.warn("HP V2 Driver - unsupported L3MODIFICATION instruction {}", ((L3ModificationInstruction) instruction).subtype());
                unsupportedFeatures = true;
            }
        }
    }
    return unsupportedFeatures;
}
Also used : EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) PortCriterion(org.onosproject.net.flow.criteria.PortCriterion) EthCriterion(org.onosproject.net.flow.criteria.EthCriterion) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) IPCriterion(org.onosproject.net.flow.criteria.IPCriterion) Criterion(org.onosproject.net.flow.criteria.Criterion) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) Instruction(org.onosproject.net.flow.instructions.Instruction) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction)

Example 7 with L3ModificationInstruction

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

the class HPPipelineV3 method checkUnSupportedFeatures.

// Return TRUE if ForwardingObjective fwd includes UNSUPPORTED features
@Override
protected boolean checkUnSupportedFeatures(TrafficSelector selector, TrafficTreatment treatment) {
    boolean unsupportedFeatures = false;
    for (Criterion criterion : selector.criteria()) {
        if (this.unsupportedCriteria.contains(criterion.type())) {
            log.warn("HP V3 Driver - unsupported criteria {}", criterion.type());
            unsupportedFeatures = true;
        }
    }
    for (Instruction instruction : treatment.allInstructions()) {
        if (this.unsupportedInstructions.contains(instruction.type())) {
            log.warn("HP V3 Driver - unsupported instruction {}", instruction.type());
            unsupportedFeatures = true;
        }
        if (instruction.type() == Instruction.Type.L2MODIFICATION) {
            if (this.unsupportedL2mod.contains(((L2ModificationInstruction) instruction).subtype())) {
                log.warn("HP V3 Driver - unsupported L2MODIFICATION instruction {}", ((L2ModificationInstruction) instruction).subtype());
                unsupportedFeatures = true;
            }
        }
        if (instruction.type() == Instruction.Type.L3MODIFICATION) {
            if (this.unsupportedL3mod.contains(((L3ModificationInstruction) instruction).subtype())) {
                log.warn("HP V3 Driver - unsupported L3MODIFICATION instruction {}", ((L3ModificationInstruction) instruction).subtype());
                unsupportedFeatures = true;
            }
        }
    }
    return unsupportedFeatures;
}
Also used : EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) PortCriterion(org.onosproject.net.flow.criteria.PortCriterion) EthCriterion(org.onosproject.net.flow.criteria.EthCriterion) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) IPCriterion(org.onosproject.net.flow.criteria.IPCriterion) Criterion(org.onosproject.net.flow.criteria.Criterion) L4ModificationInstruction(org.onosproject.net.flow.instructions.L4ModificationInstruction) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) Instruction(org.onosproject.net.flow.instructions.Instruction) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction)

Example 8 with L3ModificationInstruction

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

the class HPPipelineV3500 method checkUnSupportedFeatures.

// Return TRUE if ForwardingObjective fwd includes unsupported features
@Override
protected boolean checkUnSupportedFeatures(TrafficSelector selector, TrafficTreatment treatment) {
    boolean unsupportedFeatures = false;
    for (Criterion criterion : selector.criteria()) {
        if (this.unsupportedCriteria.contains(criterion.type())) {
            log.warn("HP V3500 Driver - unsupported criteria {}", criterion.type());
            unsupportedFeatures = true;
        }
    }
    for (Instruction instruction : treatment.allInstructions()) {
        if (this.unsupportedInstructions.contains(instruction.type())) {
            log.warn("HP V3500 Driver - unsupported instruction {}", instruction.type());
            unsupportedFeatures = true;
        }
        if (instruction.type() == Instruction.Type.L2MODIFICATION) {
            if (this.unsupportedL2mod.contains(((L2ModificationInstruction) instruction).subtype())) {
                log.warn("HP V3500 Driver - unsupported L2MODIFICATION instruction {}", ((L2ModificationInstruction) instruction).subtype());
                unsupportedFeatures = true;
            }
        }
        if (instruction.type() == Instruction.Type.L3MODIFICATION) {
            if (this.unsupportedL3mod.contains(((L3ModificationInstruction) instruction).subtype())) {
                log.warn("HP V3500 Driver - unsupported L3MODIFICATION instruction {}", ((L3ModificationInstruction) instruction).subtype());
                unsupportedFeatures = true;
            }
        }
    }
    return unsupportedFeatures;
}
Also used : EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) PortCriterion(org.onosproject.net.flow.criteria.PortCriterion) EthCriterion(org.onosproject.net.flow.criteria.EthCriterion) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) IPCriterion(org.onosproject.net.flow.criteria.IPCriterion) Criterion(org.onosproject.net.flow.criteria.Criterion) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) Instruction(org.onosproject.net.flow.instructions.Instruction) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction)

Example 9 with L3ModificationInstruction

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

the class GroupModBuilder method buildL3Modification.

private OFAction buildL3Modification(Instruction i) {
    L3ModificationInstruction l3m = (L3ModificationInstruction) i;
    L3ModificationInstruction.ModIPInstruction ip;
    Ip4Address ip4;
    Ip6Address ip6;
    OFOxm<?> oxm = null;
    switch(l3m.subtype()) {
        case IPV4_SRC:
            ip = (L3ModificationInstruction.ModIPInstruction) i;
            ip4 = ip.ip().getIp4Address();
            oxm = factory.oxms().ipv4Src(IPv4Address.of(ip4.toInt()));
            break;
        case IPV4_DST:
            ip = (L3ModificationInstruction.ModIPInstruction) i;
            ip4 = ip.ip().getIp4Address();
            oxm = factory.oxms().ipv4Dst(IPv4Address.of(ip4.toInt()));
            break;
        case IPV6_SRC:
            ip = (L3ModificationInstruction.ModIPInstruction) i;
            ip6 = ip.ip().getIp6Address();
            oxm = factory.oxms().ipv6Src(IPv6Address.of(ip6.toOctets()));
            break;
        case IPV6_DST:
            ip = (L3ModificationInstruction.ModIPInstruction) i;
            ip6 = ip.ip().getIp6Address();
            oxm = factory.oxms().ipv6Dst(IPv6Address.of(ip6.toOctets()));
            break;
        case IPV6_FLABEL:
            L3ModificationInstruction.ModIPv6FlowLabelInstruction flowLabelInstruction = (L3ModificationInstruction.ModIPv6FlowLabelInstruction) i;
            int flowLabel = flowLabelInstruction.flowLabel();
            oxm = factory.oxms().ipv6Flabel(IPv6FlowLabel.of(flowLabel));
            break;
        case DEC_TTL:
            return factory.actions().decNwTtl();
        case TTL_IN:
            return factory.actions().copyTtlIn();
        case TTL_OUT:
            return factory.actions().copyTtlOut();
        default:
            log.warn("Unimplemented action type {}.", l3m.subtype());
            break;
    }
    if (oxm != null) {
        return factory.actions().buildSetField().setField(oxm).build();
    }
    return null;
}
Also used : L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) Ip6Address(org.onlab.packet.Ip6Address) Ip4Address(org.onlab.packet.Ip4Address)

Example 10 with L3ModificationInstruction

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

the class HPPipelineV3 method tableIdForForwardingObjective.

@Override
protected int tableIdForForwardingObjective(TrafficSelector selector, TrafficTreatment treatment) {
    boolean hardwareProcess = true;
    log.debug("HP V3 Driver - Evaluating the ForwardingObjective for proper TableID");
    // Check criteria supported in hardware
    for (Criterion criterion : selector.criteria()) {
        if (!this.hardwareCriteria.contains(criterion.type())) {
            log.warn("HP V3 Driver - criterion {} only supported in SOFTWARE", criterion.type());
            hardwareProcess = false;
            break;
        }
        // HP3800 does not support hardware match on ETH_TYPE of value TYPE_VLAN
        if (criterion.type() == Criterion.Type.ETH_TYPE) {
            if (((EthTypeCriterion) criterion).ethType().toShort() == Ethernet.TYPE_VLAN) {
                log.warn("HP V3 Driver -  ETH_TYPE == VLAN (0x8100) is only supported in software");
                hardwareProcess = false;
                break;
            }
        }
    }
    // If criteria can be processed in hardware, then check treatment
    if (hardwareProcess) {
        for (Instruction instruction : treatment.allInstructions()) {
            // Check if the instruction type is contained in the hardware instruction
            if (!this.hardwareInstructions.contains(instruction.type())) {
                log.warn("HP V3 Driver - instruction {} only supported in SOFTWARE", instruction.type());
                hardwareProcess = false;
                break;
            }
            /**
             * If output is CONTROLLER_PORT the flow entry could be installed in hardware
             * but is anyway processed in software because OPENFLOW header has to be added
             */
            if (instruction.type() == Instruction.Type.OUTPUT) {
                if (((Instructions.OutputInstruction) instruction).port() == PortNumber.CONTROLLER) {
                    log.warn("HP V3 Driver - Forwarding to CONTROLLER only supported in software");
                    hardwareProcess = false;
                    break;
                }
            }
            // Check if the specific L2MODIFICATION.subtype is supported in hardware
            if (instruction.type() == Instruction.Type.L2MODIFICATION) {
                if (!this.hardwareInstructionsL2mod.contains(((L2ModificationInstruction) instruction).subtype())) {
                    log.warn("HP V3 Driver - L2MODIFICATION.subtype {} only supported in SOFTWARE", ((L2ModificationInstruction) instruction).subtype());
                    hardwareProcess = false;
                    break;
                }
            }
            // Check if the specific L3MODIFICATION.subtype is supported in hardware
            if (instruction.type() == Instruction.Type.L3MODIFICATION) {
                if (!this.hardwareInstructionsL3mod.contains(((L3ModificationInstruction) instruction).subtype())) {
                    log.warn("HP V3 Driver - L3MODIFICATION.subtype {} only supported in SOFTWARE", ((L3ModificationInstruction) instruction).subtype());
                    hardwareProcess = false;
                    break;
                }
            }
            // Check if the specific L4MODIFICATION.subtype is supported in hardware
            if (instruction.type() == Instruction.Type.L4MODIFICATION) {
                if (!this.hardwareInstructionsL4mod.contains(((L4ModificationInstruction) instruction).subtype())) {
                    log.warn("HP V3 Driver - L4MODIFICATION.subtype {} only supported in SOFTWARE", ((L4ModificationInstruction) instruction).subtype());
                    hardwareProcess = false;
                    break;
                }
            }
            // TODO --- check if all the buckets contains one and only one output action
            if (instruction.type() == Instruction.Type.GROUP) {
                boolean groupInstalled = false;
                GroupId groupId = ((Instructions.GroupInstruction) instruction).groupId();
                Iterable<Group> groupsOnDevice = groupService.getGroups(deviceId);
                for (Group group : groupsOnDevice) {
                    if ((group.state() == Group.GroupState.ADDED) && (group.id().equals(groupId))) {
                        groupInstalled = true;
                        if (group.type() != Group.Type.ALL) {
                            log.warn("HP V3 Driver - group type {} only supported in SOFTWARE", group.type().toString());
                            hardwareProcess = false;
                        }
                        break;
                    }
                }
                if (!groupInstalled) {
                    log.warn("HP V3 Driver - referenced group is not installed on the device.");
                    hardwareProcess = false;
                }
            }
        }
    }
    if (hardwareProcess) {
        log.warn("HP V3 Driver - This flow rule is supported in HARDWARE");
        return HP_HARDWARE_TABLE;
    } else {
        // TODO: create a specific flow in table 100 to redirect selected traffic on table 200
        log.warn("HP V3 Driver - This flow rule is only supported in SOFTWARE");
        return HP_SOFTWARE_TABLE;
    }
}
Also used : Group(org.onosproject.net.group.Group) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) L4ModificationInstruction(org.onosproject.net.flow.instructions.L4ModificationInstruction) EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) PortCriterion(org.onosproject.net.flow.criteria.PortCriterion) EthCriterion(org.onosproject.net.flow.criteria.EthCriterion) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) IPCriterion(org.onosproject.net.flow.criteria.IPCriterion) Criterion(org.onosproject.net.flow.criteria.Criterion) EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) Instructions(org.onosproject.net.flow.instructions.Instructions) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction) L4ModificationInstruction(org.onosproject.net.flow.instructions.L4ModificationInstruction) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) Instruction(org.onosproject.net.flow.instructions.Instruction) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction) GroupId(org.onosproject.core.GroupId)

Aggregations

L3ModificationInstruction (org.onosproject.net.flow.instructions.L3ModificationInstruction)15 Instruction (org.onosproject.net.flow.instructions.Instruction)11 L2ModificationInstruction (org.onosproject.net.flow.instructions.L2ModificationInstruction)11 IPCriterion (org.onosproject.net.flow.criteria.IPCriterion)9 EthTypeCriterion (org.onosproject.net.flow.criteria.EthTypeCriterion)8 Criterion (org.onosproject.net.flow.criteria.Criterion)7 EthCriterion (org.onosproject.net.flow.criteria.EthCriterion)7 VlanIdCriterion (org.onosproject.net.flow.criteria.VlanIdCriterion)7 PortCriterion (org.onosproject.net.flow.criteria.PortCriterion)6 Ip4Address (org.onlab.packet.Ip4Address)3 DefaultFlowRule (org.onosproject.net.flow.DefaultFlowRule)3 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)3 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)3 FlowRule (org.onosproject.net.flow.FlowRule)3 TrafficSelector (org.onosproject.net.flow.TrafficSelector)3 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)3 MplsCriterion (org.onosproject.net.flow.criteria.MplsCriterion)3 L4ModificationInstruction (org.onosproject.net.flow.instructions.L4ModificationInstruction)3 Group (org.onosproject.net.group.Group)3 ArrayDeque (java.util.ArrayDeque)2