Search in sources :

Example 31 with GroupId

use of org.onosproject.core.GroupId in project onos by opennetworkinglab.

the class OvsdbTunnelProviderTest method testTunnelAdded.

@Test
public void testTunnelAdded() {
    TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf("192.168.1.1"));
    TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf("192.168.1.3"));
    SparseAnnotations annotations = DefaultAnnotations.builder().set("bandwidth", "1024").build();
    List<Link> links = new ArrayList<Link>();
    links.add(link);
    TunnelDescription tunnel = new DefaultTunnelDescription(TunnelId.valueOf("1234"), src, dst, Tunnel.Type.VXLAN, new GroupId(0), this.provider.id(), TunnelName.tunnelName("tunnel12"), new DefaultPath(this.provider.id(), links, ScalarWeight.toWeight(0.3)), annotations);
    provider.tunnelAdded(tunnel);
    assertEquals(1, providerService.tunnelSet.size());
}
Also used : SparseAnnotations(org.onosproject.net.SparseAnnotations) TunnelEndPoint(org.onosproject.incubator.net.tunnel.TunnelEndPoint) IpTunnelEndPoint(org.onosproject.incubator.net.tunnel.IpTunnelEndPoint) ArrayList(java.util.ArrayList) DefaultTunnelDescription(org.onosproject.incubator.net.tunnel.DefaultTunnelDescription) TunnelDescription(org.onosproject.incubator.net.tunnel.TunnelDescription) DefaultTunnelDescription(org.onosproject.incubator.net.tunnel.DefaultTunnelDescription) DefaultPath(org.onosproject.net.DefaultPath) Link(org.onosproject.net.Link) DefaultLink(org.onosproject.net.DefaultLink) GroupId(org.onosproject.core.GroupId) Test(org.junit.Test)

Example 32 with GroupId

use of org.onosproject.core.GroupId in project onos by opennetworkinglab.

the class NullGroupProvider method groupAdd.

private void groupAdd(DeviceId deviceId, GroupOperation go) {
    GroupId gid = go.groupId();
    DefaultGroup group = new DefaultGroup(gid, deviceId, go.groupType(), go.buckets());
    group.setState(Group.GroupState.ADDED);
    groupTables.get(deviceId).put(gid, group);
}
Also used : DefaultGroup(org.onosproject.net.group.DefaultGroup) GroupId(org.onosproject.core.GroupId)

Example 33 with GroupId

use of org.onosproject.core.GroupId in project onos by opennetworkinglab.

the class HPPipelineV3800 method tableIdForForwardingObjective.

@Override
protected int tableIdForForwardingObjective(TrafficSelector selector, TrafficTreatment treatment) {
    boolean hardwareProcess = true;
    log.debug("HP V3800 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 V3800 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 V3800 Driver -  ETH_TYPE == VLAN (0x8100) is only supported in software");
                hardwareProcess = false;
                break;
            }
        }
    }
    // Check if a CLEAR action is included
    if (treatment.clearedDeferred()) {
        log.warn("HP V3800 Driver - CLEAR action only supported in SOFTWARE");
        hardwareProcess = false;
    }
    // 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 V3800 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 V3800 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 V3800 Driver - L2MODIFICATION.subtype {} only supported in SOFTWARE", ((L2ModificationInstruction) 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 V3800 Driver - group type {} only supported in SOFTWARE", group.type().toString());
                            hardwareProcess = false;
                        }
                        break;
                    }
                }
                if (!groupInstalled) {
                    log.warn("HP V3800 Driver - referenced group is not installed on the device.");
                    hardwareProcess = false;
                }
            }
        }
    }
    if (hardwareProcess) {
        log.warn("HP V3800 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 V3800 Driver - This flow rule is only supported in SOFTWARE");
        return HP_SOFTWARE_TABLE;
    }
}
Also used : Group(org.onosproject.net.group.Group) 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) 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)

Example 34 with GroupId

use of org.onosproject.core.GroupId 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)

Example 35 with GroupId

use of org.onosproject.core.GroupId in project onos by opennetworkinglab.

the class OpenFlowGroupProvider method performGroupOperation.

@Override
public void performGroupOperation(DeviceId deviceId, GroupOperations groupOps) {
    final Dpid dpid = Dpid.dpid(deviceId.uri());
    OpenFlowSwitch sw = controller.getSwitch(dpid);
    for (GroupOperation groupOperation : groupOps.operations()) {
        if (sw == null) {
            log.error("SW {} is not found", dpid);
            return;
        }
        switch(groupOperation.groupType()) {
            case SELECT:
            case INDIRECT:
            case ALL:
            case FAILOVER:
                break;
            case CLONE:
            default:
                log.warn("Group type {} not supported, ignoring operation [{}]", groupOperation.groupType(), groupOperation);
                // Next groupOperation.
                continue;
        }
        final Long groupModXid = XID_COUNTER.getAndIncrement();
        GroupModBuilder builder = null;
        if (driverService == null) {
            builder = GroupModBuilder.builder(groupOperation.buckets(), groupOperation.groupId(), groupOperation.groupType(), sw.factory(), Optional.of(groupModXid));
        } else {
            builder = GroupModBuilder.builder(groupOperation.buckets(), groupOperation.groupId(), groupOperation.groupType(), sw.factory(), Optional.of(groupModXid), Optional.of(driverService));
        }
        OFGroupMod groupMod = null;
        switch(groupOperation.opType()) {
            case ADD:
                groupMod = builder.buildGroupAdd();
                break;
            case MODIFY:
                groupMod = builder.buildGroupMod();
                break;
            case DELETE:
                groupMod = builder.buildGroupDel();
                break;
            default:
                log.error("Unsupported Group operation");
                return;
        }
        sw.sendMsg(groupMod);
        GroupId groudId = new GroupId(groupMod.getGroup().getGroupNumber());
        pendingGroupOperations.put(groudId, groupOperation);
        pendingXidMaps.put(groudId, groupModXid);
    }
}
Also used : OFGroupMod(org.projectfloodlight.openflow.protocol.OFGroupMod) Dpid(org.onosproject.openflow.controller.Dpid) OpenFlowSwitch(org.onosproject.openflow.controller.OpenFlowSwitch) AtomicLong(java.util.concurrent.atomic.AtomicLong) GroupOperation(org.onosproject.net.group.GroupOperation) GroupId(org.onosproject.core.GroupId)

Aggregations

GroupId (org.onosproject.core.GroupId)59 GroupBucket (org.onosproject.net.group.GroupBucket)30 GroupKey (org.onosproject.net.group.GroupKey)29 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)26 GroupBuckets (org.onosproject.net.group.GroupBuckets)26 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)25 DefaultGroupBucket (org.onosproject.net.group.DefaultGroupBucket)24 DefaultGroupKey (org.onosproject.net.group.DefaultGroupKey)21 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)19 GroupDescription (org.onosproject.net.group.GroupDescription)19 DefaultGroup (org.onosproject.net.group.DefaultGroup)18 Group (org.onosproject.net.group.Group)17 GroupEvent (org.onosproject.net.group.GroupEvent)12 ArrayList (java.util.ArrayList)11 PortNumber (org.onosproject.net.PortNumber)11 Instruction (org.onosproject.net.flow.instructions.Instruction)10 L2ModificationInstruction (org.onosproject.net.flow.instructions.L2ModificationInstruction)10 StoredGroupEntry (org.onosproject.net.group.StoredGroupEntry)10 OfdpaGroupHandlerUtility.l2MulticastGroupKey (org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.l2MulticastGroupKey)9 MacAddress (org.onlab.packet.MacAddress)8