Java 类org.projectfloodlight.openflow.types.VlanPcp 实例源码

项目:fresco_floodlight    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:iTAP-controller    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:SDN-Multicast    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:arscheduler    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:floodlight1.2-delay    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:floodlight-hardware    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 *
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode);
    if (n.matches()) {
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:ACAMPController    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:fast-failover-demo    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:floodlightLB    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:DSC    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:floodlight    文件:ActionUtils.java   
/**
 * Parse set_vlan_pcp actions.
 * The key and delimiter for the action should be omitted, and only the
 * data should be presented to this decoder. Data with a leading 0x is permitted.
 * 
 * @param actionToDecode; The action as a string to decode
 * @param version; The OF version to create the action for
 * @param log
 * @return
 */
private static OFActionSetVlanPcp decode_set_vlan_priority(String actionToDecode, OFVersion version, Logger log) {
    Matcher n = Pattern.compile("((?:0x)?\\d+)").matcher(actionToDecode); 
    if (n.matches()) {            
        if (n.group(1) != null) {
            try {
                VlanPcp prior = VlanPcp.of(get_byte(n.group(1)));
                OFActionSetVlanPcp.Builder ab = OFFactories.getFactory(version).actions().buildSetVlanPcp();
                ab.setVlanPcp(prior);
                log.debug("action {}", ab.build());
                return ab.build();
            }
            catch (NumberFormatException e) {
                log.debug("Invalid VLAN priority in: {} (error ignored)", actionToDecode);
                return null;
            }
        }
    }
    else {
        log.debug("Invalid action: '{}'", actionToDecode);
        return null;
    }
    return null;
}
项目:athena    文件:GroupModBuilder.java   
private OFAction buildL2Modification(Instruction i) {
    L2ModificationInstruction l2m = (L2ModificationInstruction) i;
    L2ModificationInstruction.ModEtherInstruction eth;
    OFOxm<?> oxm = null;
    switch (l2m.subtype()) {
        case ETH_DST:
            eth = (L2ModificationInstruction.ModEtherInstruction) l2m;
            oxm = factory.oxms().ethDst(MacAddress.of(eth.mac().toLong()));
            break;
        case ETH_SRC:
            eth = (L2ModificationInstruction.ModEtherInstruction) l2m;
            oxm = factory.oxms().ethSrc(MacAddress.of(eth.mac().toLong()));
            break;
        case VLAN_ID:
            L2ModificationInstruction.ModVlanIdInstruction vlanId =
                    (L2ModificationInstruction.ModVlanIdInstruction) l2m;
            oxm = factory.oxms().vlanVid(OFVlanVidMatch.ofVlan(vlanId.vlanId().toShort()));
            break;
        case VLAN_PCP:
            L2ModificationInstruction.ModVlanPcpInstruction vlanPcp =
                    (L2ModificationInstruction.ModVlanPcpInstruction) l2m;
            oxm = factory.oxms().vlanPcp(VlanPcp.of(vlanPcp.vlanPcp()));
            break;
        case VLAN_POP:
            return factory.actions().popVlan();
        case VLAN_PUSH:
            L2ModificationInstruction.PushHeaderInstructions pushVlanInstruction
                    = (L2ModificationInstruction.PushHeaderInstructions) l2m;
            return factory.actions().pushVlan(
                    EthType.of(pushVlanInstruction.ethernetType().toShort()));
        case MPLS_PUSH:
            L2ModificationInstruction.PushHeaderInstructions pushHeaderInstructions =
                    (L2ModificationInstruction.PushHeaderInstructions) l2m;
            return factory.actions().pushMpls(EthType.of(pushHeaderInstructions
                                                         .ethernetType().toShort()));
        case MPLS_POP:
            L2ModificationInstruction.PushHeaderInstructions popHeaderInstructions =
                    (L2ModificationInstruction.PushHeaderInstructions) l2m;
            return factory.actions().popMpls(EthType.of(popHeaderInstructions
                                                        .ethernetType().toShort()));
        case MPLS_LABEL:
            L2ModificationInstruction.ModMplsLabelInstruction mplsLabel =
                    (L2ModificationInstruction.ModMplsLabelInstruction) l2m;
            oxm = factory.oxms().mplsLabel(U32.of(mplsLabel.label().toInt()));
            break;
        case MPLS_BOS:
            L2ModificationInstruction.ModMplsBosInstruction mplsBos =
                    (L2ModificationInstruction.ModMplsBosInstruction) l2m;
            oxm = factory.oxms()
                    .mplsBos(mplsBos.mplsBos() ? OFBooleanValue.TRUE
                                               : OFBooleanValue.FALSE);
            break;
        case DEC_MPLS_TTL:
            return factory.actions().decMplsTtl();
        case TUNNEL_ID:
            L2ModificationInstruction.ModTunnelIdInstruction tunnelId =
                    (L2ModificationInstruction.ModTunnelIdInstruction) l2m;
            oxm = factory.oxms().tunnelId(U64.of(tunnelId.tunnelId()));
            break;
        default:
            log.warn("Unimplemented action type {}.", l2m.subtype());
            break;
    }

    if (oxm != null) {
        return factory.actions().buildSetField().setField(oxm).build();
    }
    return null;
}
项目:ravikumaran201504    文件:GroupModBuilder.java   
private OFAction buildL2Modification(Instruction i) {
    L2ModificationInstruction l2m = (L2ModificationInstruction) i;
    L2ModificationInstruction.ModEtherInstruction eth;
    OFOxm<?> oxm = null;
    switch (l2m.subtype()) {
        case ETH_DST:
            eth = (L2ModificationInstruction.ModEtherInstruction) l2m;
            oxm = factory.oxms().ethDst(MacAddress.of(eth.mac().toLong()));
            break;
        case ETH_SRC:
            eth = (L2ModificationInstruction.ModEtherInstruction) l2m;
            oxm = factory.oxms().ethSrc(MacAddress.of(eth.mac().toLong()));
            break;
        case VLAN_ID:
            L2ModificationInstruction.ModVlanIdInstruction vlanId =
                    (L2ModificationInstruction.ModVlanIdInstruction) l2m;
            oxm = factory.oxms().vlanVid(OFVlanVidMatch.ofVlan(vlanId.vlanId().toShort()));
            break;
        case VLAN_PCP:
            L2ModificationInstruction.ModVlanPcpInstruction vlanPcp =
                    (L2ModificationInstruction.ModVlanPcpInstruction) l2m;
            oxm = factory.oxms().vlanPcp(VlanPcp.of(vlanPcp.vlanPcp()));
            break;
        case VLAN_POP:
            return factory.actions().popVlan();
        case VLAN_PUSH:
            L2ModificationInstruction.PushHeaderInstructions pushVlanInstruction
                    = (L2ModificationInstruction.PushHeaderInstructions) l2m;
            return factory.actions().pushVlan(
                    EthType.of(pushVlanInstruction.ethernetType()));
        case MPLS_PUSH:
            L2ModificationInstruction.PushHeaderInstructions pushHeaderInstructions =
                    (L2ModificationInstruction.PushHeaderInstructions) l2m;
            return factory.actions().pushMpls(EthType.of(pushHeaderInstructions
                                                         .ethernetType()));
        case MPLS_POP:
            L2ModificationInstruction.PushHeaderInstructions popHeaderInstructions =
                    (L2ModificationInstruction.PushHeaderInstructions) l2m;
            return factory.actions().popMpls(EthType.of(popHeaderInstructions
                                                        .ethernetType()));
        case MPLS_LABEL:
            L2ModificationInstruction.ModMplsLabelInstruction mplsLabel =
                    (L2ModificationInstruction.ModMplsLabelInstruction) l2m;
            oxm = factory.oxms().mplsLabel(U32.of(mplsLabel.label()
                    .longValue()));
            break;
        case DEC_MPLS_TTL:
            return factory.actions().decMplsTtl();
        default:
            log.warn("Unimplemented action type {}.", l2m.subtype());
            break;
    }

    if (oxm != null) {
        return factory.actions().buildSetField().setField(oxm).build();
    }
    return null;
}
项目:onos    文件:GroupModBuilder.java   
private OFAction buildL2Modification(Instruction i) {
    L2ModificationInstruction l2m = (L2ModificationInstruction) i;
    L2ModificationInstruction.ModEtherInstruction eth;
    OFOxm<?> oxm = null;
    switch (l2m.subtype()) {
        case ETH_DST:
            eth = (L2ModificationInstruction.ModEtherInstruction) l2m;
            oxm = factory.oxms().ethDst(MacAddress.of(eth.mac().toLong()));
            break;
        case ETH_SRC:
            eth = (L2ModificationInstruction.ModEtherInstruction) l2m;
            oxm = factory.oxms().ethSrc(MacAddress.of(eth.mac().toLong()));
            break;
        case VLAN_ID:
            L2ModificationInstruction.ModVlanIdInstruction vlanId =
                    (L2ModificationInstruction.ModVlanIdInstruction) l2m;
            oxm = factory.oxms().vlanVid(OFVlanVidMatch.ofVlan(vlanId.vlanId().toShort()));
            break;
        case VLAN_PCP:
            L2ModificationInstruction.ModVlanPcpInstruction vlanPcp =
                    (L2ModificationInstruction.ModVlanPcpInstruction) l2m;
            oxm = factory.oxms().vlanPcp(VlanPcp.of(vlanPcp.vlanPcp()));
            break;
        case VLAN_POP:
            return factory.actions().popVlan();
        case VLAN_PUSH:
            L2ModificationInstruction.ModVlanHeaderInstruction pushVlanInstruction
                    = (L2ModificationInstruction.ModVlanHeaderInstruction) l2m;
            return factory.actions().pushVlan(
                    EthType.of(pushVlanInstruction.ethernetType().toShort()));
        case MPLS_PUSH:
            L2ModificationInstruction.ModMplsHeaderInstruction pushHeaderInstructions =
                    (L2ModificationInstruction.ModMplsHeaderInstruction) l2m;
            return factory.actions().pushMpls(EthType.of(pushHeaderInstructions
                                                         .ethernetType().toShort()));
        case MPLS_POP:
            L2ModificationInstruction.ModMplsHeaderInstruction popHeaderInstructions =
                    (L2ModificationInstruction.ModMplsHeaderInstruction) l2m;
            return factory.actions().popMpls(EthType.of(popHeaderInstructions
                                                        .ethernetType().toShort()));
        case MPLS_LABEL:
            L2ModificationInstruction.ModMplsLabelInstruction mplsLabel =
                    (L2ModificationInstruction.ModMplsLabelInstruction) l2m;
            oxm = factory.oxms().mplsLabel(U32.of(mplsLabel.label().toInt()));
            break;
        case MPLS_BOS:
            L2ModificationInstruction.ModMplsBosInstruction mplsBos =
                    (L2ModificationInstruction.ModMplsBosInstruction) l2m;
            oxm = factory.oxms()
                    .mplsBos(mplsBos.mplsBos() ? OFBooleanValue.TRUE
                                               : OFBooleanValue.FALSE);
            break;
        case DEC_MPLS_TTL:
            return factory.actions().decMplsTtl();
        case TUNNEL_ID:
            L2ModificationInstruction.ModTunnelIdInstruction tunnelId =
                    (L2ModificationInstruction.ModTunnelIdInstruction) l2m;
            oxm = factory.oxms().tunnelId(U64.of(tunnelId.tunnelId()));
            break;
        default:
            log.warn("Unimplemented action type {}.", l2m.subtype());
            break;
    }

    if (oxm != null) {
        return factory.actions().buildSetField().setField(oxm).build();
    }
    return null;
}