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


Java OFActionVendor类代码示例

本文整理汇总了Java中org.openflow.protocol.action.OFActionVendor的典型用法代码示例。如果您正苦于以下问题:Java OFActionVendor类的具体用法?Java OFActionVendor怎么用?Java OFActionVendor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: readFrom

import org.openflow.protocol.action.OFActionVendor; //导入依赖的package包/类
@Override
public OFActionVendor readFrom(ChannelBuffer data) {
    data.markReaderIndex();
    OFActionBigSwitchVendor demux = new OFActionBigSwitchVendorDemux();
    demux.readFrom(data);
    data.resetReaderIndex();

    switch(demux.getSubtype()) {
        case OFActionMirror.BSN_ACTION_MIRROR:
            OFActionMirror mirrorAction = new OFActionMirror((short) 0);
            mirrorAction.readFrom(data);
            return mirrorAction;
        case OFActionTunnelDstIP.SET_TUNNEL_DST_SUBTYPE:
            OFActionTunnelDstIP tunnelAction = new OFActionTunnelDstIP();
            tunnelAction.readFrom(data);
            return tunnelAction;
        default:
            logger.error("Unknown BSN vendor action subtype: "+demux.getSubtype());
            return null;
    }
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:22,代码来源:OFBigSwitchVendorActionFactory.java

示例2: readFrom

import org.openflow.protocol.action.OFActionVendor; //导入依赖的package包/类
@Override
public OFActionVendor readFrom(ChannelBuffer data) {
    data.markReaderIndex();
    OFActionNiciraVendorDemux demux = new OFActionNiciraVendorDemux();
    demux.readFrom(data);
    data.resetReaderIndex();

    switch(demux.getSubtype()) {
        case OFActionNiciraTtlDecrement.TTL_DECREMENT_SUBTYPE:
            OFActionNiciraTtlDecrement ttlAction = new OFActionNiciraTtlDecrement();
            ttlAction.readFrom(data);
            return ttlAction;
        default:
            logger.error("Unknown Nicira vendor action subtype: "+demux.getSubtype());
            return null;
    }
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:18,代码来源:OFNiciraVendorActionFactory.java

示例3: testAction

import org.openflow.protocol.action.OFActionVendor; //导入依赖的package包/类
@Test
public void testAction() {
    ChannelBuffer buf = ChannelBuffers.buffer(32);
    
    OFActionNiciraTtlDecrement act = new OFActionNiciraTtlDecrement();
    
    assertEquals(true, act instanceof OFActionNiciraVendor);
    assertEquals(true, act instanceof OFActionVendor);
    assertEquals(true, act instanceof OFAction);
    
    act.writeTo(buf);
    
    ChannelBuffer buf2 = buf.copy();
    
    assertEquals(16, buf.readableBytes());
    byte fromBuffer[] = new byte[16]; 
    buf.readBytes(fromBuffer);
    assertArrayEquals(expectedWireFormat, fromBuffer);
    
    // Test parsing. TODO: we don't really have the proper parsing
    // infrastructure....
    OFActionNiciraVendor act2 = new OFActionNiciraTtlDecrement();
    act2.readFrom(buf2);
    assertEquals(act, act2);
    assertNotSame(act, act2);
    
    assertEquals(OFActionType.VENDOR, act2.getType());
    assertEquals(16, act2.getLength());
    assertEquals(OFActionNiciraVendor.NICIRA_VENDOR_ID, act2.getVendor());
    assertEquals((short)18, act2.getSubtype());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:32,代码来源:OFActionNiciraTtlDecrementTest.java

示例4: parseActionOne

import org.openflow.protocol.action.OFActionVendor; //导入依赖的package包/类
private OFAction parseActionOne(final OFActionType type,
        final ChannelBuffer data) {
    OFAction ofa;
    data.markReaderIndex();
    ofa = this.getAction(type);
    ofa.readFrom(data);

    if (type == OFActionType.VENDOR) {
        final OFActionVendor vendorAction = (OFActionVendor) ofa;

        final OFVendorActionFactory vendorActionFactory = this.vendorActionRegistry
                .get(vendorAction.getVendor());

        if (vendorActionFactory != null) {
            // if we have a specific vendorActionFactory for this vendor id,
            // delegate to it for vendor-specific reparsing of the message
            data.resetReaderIndex();
            final OFActionVendor newAction = vendorActionFactory
                    .readFrom(data);
            if (newAction != null) {
                ofa = newAction;
            }
        }
    }

    if (OFAction.class.equals(ofa.getClass())) {
        // advance the position for un-implemented messages
        data.readerIndex(data.readerIndex() + ofa.getLengthU()
                - OFAction.MINIMUM_LENGTH);
    }
    return ofa;
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:33,代码来源:BasicFactory.java

示例5: parseActionOne

import org.openflow.protocol.action.OFActionVendor; //导入依赖的package包/类
private OFAction parseActionOne(OFActionType type, ChannelBuffer data) {
    OFAction ofa;
    data.markReaderIndex();
    ofa = getAction(type);
    ofa.readFrom(data);

    if(type == OFActionType.VENDOR) {
        OFActionVendor vendorAction = (OFActionVendor) ofa;

        OFVendorActionFactory vendorActionFactory = vendorActionRegistry.get(vendorAction.getVendor());

        if(vendorActionFactory != null) {
            // if we have a specific vendorActionFactory for this vendor id,
            // delegate to it for vendor-specific reparsing of the message
            data.resetReaderIndex();
            OFActionVendor newAction = vendorActionFactory.readFrom(data);
            if(newAction != null)
                ofa = newAction;
        }
    }

    if (OFAction.class.equals(ofa.getClass())) {
        // advance the position for un-implemented messages
        data.readerIndex(data.readerIndex()+(ofa.getLengthU() -
                OFAction.MINIMUM_LENGTH));
    }
    return ofa;
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:29,代码来源:BasicFactory.java

示例6: rereadAndCheck

import org.openflow.protocol.action.OFActionVendor; //导入依赖的package包/类
protected void rereadAndCheck(OFVendorActionFactory factory, OFActionVendor action) {
    ChannelBuffer buf= ChannelBuffers.buffer(action.getLengthU());
    action.writeTo(buf);
    OFActionVendor readAction = factory.readFrom(buf);
    assertBeansEqual(action, readAction);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:7,代码来源:OFVendorActionFactoriesTest.java

示例7: readFrom

import org.openflow.protocol.action.OFActionVendor; //导入依赖的package包/类
/** parse the data from the wire, create and return a vendor-specific action.
 *
 * @param data contains a serialized vendor action at the current readerPosition.
 *    The full message is guaranteed to be available in the buffer.
 *
 * @return upon success returns a newly allocated vendor-specific
 *   action instance, and advances the readerPosition in data for the
 *   entire length. Upon failure, returns null and leaves the readerPosition
 *   in data unmodified.
 */
OFActionVendor readFrom(ChannelBuffer data);
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:12,代码来源:OFVendorActionFactory.java

示例8: readFrom

import org.openflow.protocol.action.OFActionVendor; //导入依赖的package包/类
/**
 * parse the data from the wire, create and return a vendor-specific action.
 *
 * @param data
 *            contains a serialized vendor action at the current
 *            readerPosition. The full message is guaranteed to be available
 *            in the buffer.
 *
 * @return upon success returns a newly allocated vendor-specific action
 *         instance, and advances the readerPosition in data for the entire
 *         length. Upon failure, returns null and leaves the readerPosition
 *         in data unmodified.
 */
OFActionVendor readFrom(ChannelBuffer data);
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:15,代码来源:OFVendorActionFactory.java


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