当前位置: 首页>>代码示例>>Java>>正文


Java OFOxm.getMatchField方法代码示例

本文整理汇总了Java中org.projectfloodlight.openflow.protocol.oxm.OFOxm.getMatchField方法的典型用法代码示例。如果您正苦于以下问题:Java OFOxm.getMatchField方法的具体用法?Java OFOxm.getMatchField怎么用?Java OFOxm.getMatchField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.projectfloodlight.openflow.protocol.oxm.OFOxm的用法示例。


在下文中一共展示了OFOxm.getMatchField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mapAction

import org.projectfloodlight.openflow.protocol.oxm.OFOxm; //导入方法依赖的package包/类
@Override
public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException {
    if (action.getType().equals(OFActionType.SET_FIELD)) {
        OFActionSetField setFieldAction = (OFActionSetField) action;
        OFOxm<?> oxm = setFieldAction.getField();
        switch (oxm.getMatchField().id) {
            case VLAN_VID:
                OFOxmVlanVid vlanVid = (OFOxmVlanVid) oxm;
                return new OfdpaSetVlanVid(VlanId.vlanId(vlanVid.getValue().getRawVid()));
            default:
                throw new UnsupportedOperationException(
                        "Driver does not support extension type " + oxm.getMatchField().id);
        }
    }
    throw new UnsupportedOperationException(
            "Unexpected OFAction: " + action.toString());
}
 
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:OfdpaExtensionTreatmentInterpreter.java

示例2: mapAction

import org.projectfloodlight.openflow.protocol.oxm.OFOxm; //导入方法依赖的package包/类
@Override
public ExtensionTreatment mapAction(OFAction action) throws UnsupportedOperationException {
    if (action.getType().equals(OFActionType.SET_FIELD)) {
        OFActionSetField setFieldAction = (OFActionSetField) action;
        OFOxm<?> oxm = setFieldAction.getField();
        switch (oxm.getMatchField().id) {
            case OFDPA_MPLS_TYPE:
                OFOxmOfdpaMplsType mplsType = (OFOxmOfdpaMplsType) oxm;
                return new Ofdpa3SetMplsType(mplsType.getValue().getRaw());
            case OFDPA_OVID:
                OFOxmOfdpaOvid ovid = ((OFOxmOfdpaOvid) oxm);
                short mask = (short) 0x0FFF;
                short oVid = (short) (mask & ovid.getValue().getRaw());
                VlanId vlanId = VlanId.vlanId(oVid);
                return new Ofdpa3SetOvid(vlanId);
            case OFDPA_MPLS_L2_PORT:
                OFOxmOfdpaMplsL2Port mplsl2Port = ((OFOxmOfdpaMplsL2Port) oxm);
                Integer mplsL2Port = mplsl2Port.getValue().getRaw();
                if ((mplsL2Port >= 0 && mplsL2Port <= 0x0000FFFF) ||
                        (mplsL2Port >= 0x00020000 && mplsL2Port <= 0x0002FFFF)) {
                    return new Ofdpa3SetMplsL2Port(mplsL2Port);
                }
                break;
            case OFDPA_QOS_INDEX:
                OFOxmOfdpaQosIndex qosindex = ((OFOxmOfdpaQosIndex) oxm);
                Integer qosIndex = (int) qosindex.getValue().getRaw();
                if (qosIndex >= 0 && qosIndex <= 255) {
                    return new Ofdpa3SetQosIndex(qosIndex);
                }
                break;
            default:
                throw new UnsupportedOperationException(
                        "Driver does not support extension type " + oxm.getMatchField().id);
        }
    } else if (action.getType().equals(OFActionType.EXPERIMENTER)) {
        OFActionExperimenter experimenter = (OFActionExperimenter) action;
        if (Long.valueOf(experimenter.getExperimenter()).intValue() == TYPE_OFDPA) {
            OFActionOfdpa ofdpa = (OFActionOfdpa) experimenter;
            switch (ofdpa.getExpType()) {
                case SUB_TYPE_PUSH_L2_HEADER:
                    return new Ofdpa3PushL2Header();
                case SUB_TYPE_POP_L2_HEADER:
                    return new Ofdpa3PopL2Header();
                case SUB_TYPE_PUSH_CW:
                    return new Ofdpa3PushCw();
                case SUB_TYPE_POP_CW:
                    return new Ofdpa3PopCw();
                default:
                    throw new UnsupportedOperationException(
                            "Unexpected OFAction: " + action.toString());
            }
        }
        throw new UnsupportedOperationException(
                "Unexpected OFAction: " + action.toString());
    }
    throw new UnsupportedOperationException(
            "Unexpected OFAction: " + action.toString());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:59,代码来源:Ofdpa3ExtensionTreatmentInterpreter.java


注:本文中的org.projectfloodlight.openflow.protocol.oxm.OFOxm.getMatchField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。