All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.projectfloodlight.openflow.util.ActionUtils Maven / Gradle / Ivy

Go to download

OpenFlowJ API supporting OpenFlow versions 1.0 through 1.5.1, generated by LoxiGen

The newest version!
package org.projectfloodlight.openflow.util;

import java.util.List;

import org.projectfloodlight.openflow.protocol.OFFlowMod;
import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry;
import org.projectfloodlight.openflow.protocol.OFInstructionType;
import org.projectfloodlight.openflow.protocol.OFVersion;
import org.projectfloodlight.openflow.protocol.action.OFAction;
import org.projectfloodlight.openflow.protocol.instruction.OFInstruction;
import org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions;

import com.google.common.collect.ImmutableList;

public class ActionUtils {
    private ActionUtils() {}

    public static List getActions(OFFlowStatsEntry e) {
        if(e.getVersion() == OFVersion.OF_10) {
            return e.getActions();
        } else {
            for(OFInstruction i: e.getInstructions()) {
                if(i.getType() == OFInstructionType.APPLY_ACTIONS) {
                    return ((OFInstructionApplyActions) i).getActions();
                }
            }
            return ImmutableList.of();
        }
    }

    public static List getActions(OFFlowMod e) {
        if(e.getVersion() == OFVersion.OF_10) {
            return e.getActions();
        } else {
            for(OFInstruction i: e.getInstructions()) {
                if(i.getType() == OFInstructionType.APPLY_ACTIONS) {
                    return ((OFInstructionApplyActions) i).getActions();
                }
            }
            return ImmutableList.of();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy