Java 类org.projectfloodlight.openflow.protocol.action.OFActionSetQueue 实例源码

项目:SDN-Multicast    文件:MulticastTree.java   
protected void sendOFGroupModDelMemberMsg(IOFSwitch sw, OFPort destPort) {
    /* removes member port form the group*/
    OFBucket ofb = multicastGroup.removeMemberOFBucket(sw.getId(), destPort);
    /* prepares a modify object sends it to the switch */
    pushOFModifyGroup(sw);

    long queueId = -1;
    for (OFAction ofa:  ofb.getActions()){
        if (ofa.getType() == OFActionType.SET_QUEUE){
            OFActionSetQueue ofas = (OFActionSetQueue) ofa;
            queueId = ofas.getQueueId();
        }
    }
    /* removes queue using OVSDBContext on the switch */
    OVSDBContext ovsdbContext = mcObject.ovsdbChannelMap.get(sw.getId());
    ovsdbContext.deleteQueueOnPort(destPort, (int)queueId);
}
项目:SDN-Multicast    文件:MulticastTree.java   
protected void pushOFDeleteGroup(IOFSwitch sw) {

    /* Delete the queues attached to all the member ports*/
    long queueId = -1;
    OFPort ofp = null;
    ArrayList<OFBucket> ofBuckets = multicastGroup.getMemberOFBucketList(sw.getId());
    OVSDBContext ovsdbContext = mcObject.ovsdbChannelMap.get(sw.getId());
    for (OFBucket ofb : ofBuckets) {
        queueId = -1;
        ofp = null;
        for (OFAction ofa:  ofb.getActions()){
            if (ofa.getType() == OFActionType.SET_QUEUE){
                OFActionSetQueue ofas = (OFActionSetQueue) ofa;
                queueId = ofas.getQueueId();
                /* removes queue using OVSDBContext on the switch */

            }
            if (ofa.getType() == OFActionType.OUTPUT){
                OFActionOutput ofo = (OFActionOutput) ofa;
                ofp = ofo.getPort();
                /* removes queue using OVSDBContext on the switch */

            }
        }
        if (ofp != null && queueId != -1)
            ovsdbContext.deleteQueueOnPort(ofp, (int)queueId);
        else
            logger.error("pushOFDeleteGroup: unexpected actionset in group bucket");
    }

    /* Creates group flow with set queue option */
    OFFactory of13Factory = sw.getOFFactory();

    OFGroupDelete delGroup = of13Factory.buildGroupDelete()
            .setGroup(OFGroup.of(multicastGroup.ofGroupId))
            .setGroupType(OFGroupType.ALL)
            .build();
    sw.write(delGroup);
}
项目:SDN-Multicast    文件:MulticastTree.java   
private void addQoSOFBucketToGroup(IOFSwitch sw, OFPort destPort, long bandwidth) {

        /* creates queue using OVSDBContext on the switch */
        OVSDBContext ovsdbContext = mcObject.ovsdbChannelMap.get(sw.getId());

        /* FIXME: hardcoded priority '1' for all flows */
        int queueId = ovsdbContext.createQueueOnPort(destPort, Long.toString(bandwidth), "1");

        OFFactory of13Factory = sw.getOFFactory();

        /* creates actions for the bucket */
        ArrayList<OFAction> actionList = new ArrayList<OFAction>();
        OFActions actions = of13Factory.actions();
        OFActionSetQueue setQueue = actions.buildSetQueue().setQueueId(queueId).build();
        actionList.add(setQueue);
        OFActionOutput output = actions.buildOutput()
                .setMaxLen(0xFFffFFff)
                .setPort(destPort).build();
        actionList.add(output);

        /* creates a bucket */
        OFBucket bucket = of13Factory.buildBucket()
                .setActions(actionList)
                .setWatchGroup(OFGroup.ANY)
                .setWatchPort(OFPort.ANY)
                .build();
        /* store the bucket in multicastGroup object */
        multicastGroup.addMemberOFBucket(sw.getId(), 
                destPort.getShortPortNumber(), bucket);
    }
项目:athena    文件:FlowModBuilderVer13.java   
private List<OFAction> buildActions(List<Instruction> treatments) {
    if (treatment == null) {
        return Collections.emptyList();
    }

    boolean tableFound = false;
    List<OFAction> actions = new LinkedList<>();
    for (Instruction i : treatments) {
        switch (i.type()) {
            case NOACTION:
                return Collections.emptyList();
            case L0MODIFICATION:
                actions.add(buildL0Modification(i));
                break;
            case L1MODIFICATION:
                actions.add(buildL1Modification(i));
                break;
            case L2MODIFICATION:
                actions.add(buildL2Modification(i));
                break;
            case L3MODIFICATION:
                actions.add(buildL3Modification(i));
                break;
            case L4MODIFICATION:
                actions.add(buildL4Modification(i));
                break;
            case OUTPUT:
                OutputInstruction out = (OutputInstruction) i;
                OFActionOutput.Builder action = factory().actions().buildOutput()
                        .setPort(OFPort.of((int) out.port().toLong()));
                if (out.port().equals(PortNumber.CONTROLLER)) {
                    action.setMaxLen(OFPCML_NO_BUFFER);
                }
                actions.add(action.build());
                break;
            case GROUP:
                GroupInstruction group = (GroupInstruction) i;
                OFActionGroup.Builder groupBuilder = factory().actions().buildGroup()
                        .setGroup(OFGroup.of(group.groupId().id()));
                actions.add(groupBuilder.build());
                break;
            case QUEUE:
                SetQueueInstruction queue = (SetQueueInstruction) i;
                OFActionSetQueue.Builder queueBuilder = factory().actions().buildSetQueue()
                        .setQueueId(queue.queueId());
                actions.add(queueBuilder.build());
                break;
            case TABLE:
                //FIXME: should not occur here.
                tableFound = true;
                break;
            case EXTENSION:
                actions.add(buildExtensionAction(((Instructions.ExtensionInstructionWrapper) i)
                        .extensionInstruction()));
                break;
            default:
                log.warn("Instruction type {} not yet implemented.", i.type());
        }
    }
    if (tableFound && actions.isEmpty()) {
        // handles the case where there are no actions, but there is
        // a goto instruction for the next table
        return Collections.emptyList();
    }
    return actions;
}
项目:Engine    文件:FlowModBuilderVer13.java   
private List<OFAction> buildActions(List<Instruction> treatments) {
    if (treatment == null) {
        return Collections.emptyList();
    }

    boolean tableFound = false;
    List<OFAction> actions = new LinkedList<>();
    for (Instruction i : treatments) {
        switch (i.type()) {
            case NOACTION:
                return Collections.emptyList();
            case L0MODIFICATION:
                actions.add(buildL0Modification(i));
                break;
            case L1MODIFICATION:
                actions.add(buildL1Modification(i));
                break;
            case L2MODIFICATION:
                actions.add(buildL2Modification(i));
                break;
            case L3MODIFICATION:
                actions.add(buildL3Modification(i));
                break;
            case L4MODIFICATION:
                actions.add(buildL4Modification(i));
                break;
            case OUTPUT:
                OutputInstruction out = (OutputInstruction) i;
                OFActionOutput.Builder action = factory().actions().buildOutput()
                        .setPort(OFPort.of((int) out.port().toLong()));
                if (out.port().equals(PortNumber.CONTROLLER)) {
                    action.setMaxLen(OFPCML_NO_BUFFER);
                }
                actions.add(action.build());
                break;
            case GROUP:
                GroupInstruction group = (GroupInstruction) i;
                OFActionGroup.Builder groupBuilder = factory().actions().buildGroup()
                        .setGroup(OFGroup.of(group.groupId().id()));
                actions.add(groupBuilder.build());
                break;
            case QUEUE:
                SetQueueInstruction queue = (SetQueueInstruction) i;
                OFActionSetQueue.Builder queueBuilder = factory().actions().buildSetQueue()
                        .setQueueId(queue.queueId());
                actions.add(queueBuilder.build());
                break;
            case TABLE:
                //FIXME: should not occur here.
                tableFound = true;
                break;
            case EXTENSION:
                actions.add(buildExtensionAction(((Instructions.ExtensionInstructionWrapper) i)
                        .extensionInstruction()));
                break;
            default:
                log.warn("Instruction type {} not yet implemented.", i.type());
        }
    }
    if (tableFound && actions.isEmpty()) {
        // handles the case where there are no actions, but there is
        // a goto instruction for the next table
        return Collections.emptyList();
    }
    return actions;
}
项目:onos    文件:FlowModBuilderVer13.java   
private List<OFAction> buildActions(List<Instruction> treatments) {
    if (treatment == null) {
        return Collections.emptyList();
    }

    boolean tableFound = false;
    List<OFAction> actions = new LinkedList<>();
    for (Instruction i : treatments) {
        switch (i.type()) {
            case NOACTION:
                return Collections.emptyList();
            case L0MODIFICATION:
                actions.add(buildL0Modification(i));
                break;
            case L1MODIFICATION:
                actions.add(buildL1Modification(i));
                break;
            case L2MODIFICATION:
                actions.add(buildL2Modification(i));
                break;
            case L3MODIFICATION:
                actions.add(buildL3Modification(i));
                break;
            case L4MODIFICATION:
                actions.add(buildL4Modification(i));
                break;
            case OUTPUT:
                OutputInstruction out = (OutputInstruction) i;
                OFActionOutput.Builder action = factory().actions().buildOutput()
                        .setPort(OFPort.of((int) out.port().toLong()));
                if (out.port().equals(PortNumber.CONTROLLER)) {
                    action.setMaxLen(OFPCML_NO_BUFFER);
                }
                actions.add(action.build());
                break;
            case GROUP:
                GroupInstruction group = (GroupInstruction) i;
                OFActionGroup.Builder groupBuilder = factory().actions().buildGroup()
                        .setGroup(OFGroup.of(group.groupId().id()));
                actions.add(groupBuilder.build());
                break;
            case QUEUE:
                SetQueueInstruction queue = (SetQueueInstruction) i;
                OFActionSetQueue.Builder queueBuilder = factory().actions().buildSetQueue()
                        .setQueueId(queue.queueId());
                actions.add(queueBuilder.build());
                break;
            case TABLE:
                //FIXME: should not occur here.
                tableFound = true;
                break;
            case EXTENSION:
                actions.add(buildExtensionAction(((Instructions.ExtensionInstructionWrapper) i)
                        .extensionInstruction()));
                break;
            default:
                log.warn("Instruction type {} not yet implemented.", i.type());
        }
    }
    if (tableFound && actions.isEmpty()) {
        // handles the case where there are no actions, but there is
        // a goto instruction for the next table
        return Collections.emptyList();
    }
    return actions;
}
项目:onos    文件:FlowModBuilderVer15.java   
private List<OFAction> buildActions(List<Instruction> treatments, Boolean immediateActions) {
    if (treatment == null) {
        return Collections.emptyList();
    }

    boolean tableFound = false;
    List<OFAction> actions = new LinkedList<>();

    //Meter action handling
    if (null != treatment.meters() && immediateActions) {
        treatment.meters().forEach(meterInstruction -> {
            OFAction meterAction = buildMeterAction(meterInstruction);
            actions.add(meterAction);
        });
    }

    for (Instruction i : treatments) {
        switch (i.type()) {
            case NOACTION:
                return Collections.emptyList();
            case L0MODIFICATION:
                actions.add(buildL0Modification(i));
                break;
            case L1MODIFICATION:
                actions.add(buildL1Modification(i));
                break;
            case L2MODIFICATION:
                actions.add(buildL2Modification(i));
                break;
            case L3MODIFICATION:
                actions.add(buildL3Modification(i));
                break;
            case L4MODIFICATION:
                actions.add(buildL4Modification(i));
                break;
            case OUTPUT:
                Instructions.OutputInstruction out = (Instructions.OutputInstruction) i;
                OFActionOutput.Builder action = factory().actions().buildOutput()
                        .setPort(OFPort.of((int) out.port().toLong()));
                if (out.port().equals(PortNumber.CONTROLLER)) {
                    action.setMaxLen(OFPCML_NO_BUFFER);
                }
                actions.add(action.build());
                break;
            case GROUP:
                Instructions.GroupInstruction group = (Instructions.GroupInstruction) i;
                OFActionGroup.Builder groupBuilder = factory().actions().buildGroup()
                        .setGroup(OFGroup.of(group.groupId().id()));
                actions.add(groupBuilder.build());
                break;
            case QUEUE:
                Instructions.SetQueueInstruction queue = (Instructions.SetQueueInstruction) i;
                OFActionSetQueue.Builder queueBuilder = factory().actions().buildSetQueue()
                        .setQueueId(queue.queueId());
                actions.add(queueBuilder.build());
                break;
            case TABLE:
                //FIXME: should not occur here.
                tableFound = true;
                break;
            case EXTENSION:
                actions.add(buildExtensionAction(((Instructions.ExtensionInstructionWrapper) i)
                        .extensionInstruction()));
                break;
            default:
                log.warn("Instruction type {} not yet implemented.", i.type());
        }
    }

    if (tableFound && actions.isEmpty()) {
        // handles the case where there are no actions, but there is
        // a goto instruction for the next table
        return Collections.emptyList();
    }
    return actions;
}