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


Java OFVendorStatistics类代码示例

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


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

示例1: testOFStatisticsRequestVendor

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
public void testOFStatisticsRequestVendor() throws Exception {
    byte[] packet = new byte[] { 0x01, 0x10, 0x00, 0x50, 0x00, 0x00, 0x00,
            0x63, (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x4c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x01, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x20,
            (byte) 0xe0, 0x00, 0x11, 0x00, 0x0c, 0x29, (byte) 0xc5,
            (byte) 0x95, 0x57, 0x02, 0x25, 0x5c, (byte) 0xca, 0x00, 0x02,
            (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x50, 0x04,
            0x00, 0x00, 0x00, 0x00, (byte) 0xff, 0x00, 0x00, 0x00,
            (byte) 0xff, (byte) 0xff, 0x4e, 0x20 };

    OFMessageFactory factory = BasicFactory.getInstance();
    ChannelBuffer packetBuf = ChannelBuffers.wrappedBuffer(packet);
    List<OFMessage> msg = factory.parseMessage(packetBuf);
    TestCase.assertNotNull(msg);
    TestCase.assertEquals(msg.size(), 1);
    TestCase.assertTrue(msg.get(0) instanceof OFStatisticsRequest);
    OFStatisticsRequest sr = (OFStatisticsRequest) msg.get(0);
    TestCase.assertEquals(OFStatisticsType.VENDOR, sr.getStatisticType());
    TestCase.assertEquals(1, sr.getStatistics().size());
    TestCase.assertTrue(sr.getStatistics().get(0) instanceof OFVendorStatistics);
    TestCase.assertEquals(68, ((OFVendorStatistics)sr.getStatistics().get(0)).getLength());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:25,代码来源:OFStatisticsRequestTest.java

示例2: testOFStatisticsRequestVendor

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
public void testOFStatisticsRequestVendor() throws Exception {
    byte[] packet = new byte[] { 0x01, 0x10, 0x00, 0x50, 0x00, 0x00, 0x00,
            0x63, (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x4c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x01, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x20,
            (byte) 0xe0, 0x00, 0x11, 0x00, 0x0c, 0x29, (byte) 0xc5,
            (byte) 0x95, 0x57, 0x02, 0x25, 0x5c, (byte) 0xca, 0x00, 0x02,
            (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x50, 0x04,
            0x00, 0x00, 0x00, 0x00, (byte) 0xff, 0x00, 0x00, 0x00,
            (byte) 0xff, (byte) 0xff, 0x4e, 0x20 };

    OFMessageFactory factory = new BasicFactory();
    ChannelBuffer packetBuf = ChannelBuffers.wrappedBuffer(packet);
    List<OFMessage> msg = factory.parseMessage(packetBuf);
    TestCase.assertNotNull(msg);
    TestCase.assertEquals(msg.size(), 1);
    TestCase.assertTrue(msg.get(0) instanceof OFStatisticsRequest);
    OFStatisticsRequest sr = (OFStatisticsRequest) msg.get(0);
    TestCase.assertEquals(OFStatisticsType.VENDOR, sr.getStatisticType());
    TestCase.assertEquals(1, sr.getStatistics().size());
    TestCase.assertTrue(sr.getStatistics().get(0) instanceof OFVendorStatistics);
    TestCase.assertEquals(68, ((OFVendorStatistics)sr.getStatistics().get(0)).getLength());
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:25,代码来源:OFStatisticsRequestTest.java

示例3: testOFStatisticsRequestVendor

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
public void testOFStatisticsRequestVendor() throws Exception {
    byte[] packet = new byte[] { 0x01, 0x10, 0x00, 0x50, 0x00, 0x00, 0x00,
            0x63, (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x4c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x01, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x20,
            (byte) 0xe0, 0x00, 0x11, 0x00, 0x0c, 0x29, (byte) 0xc5,
            (byte) 0x95, 0x57, 0x02, 0x25, 0x5c, (byte) 0xca, 0x00, 0x02,
            (byte) 0xff, (byte) 0xff, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x50, 0x04,
            0x00, 0x00, 0x00, 0x00, (byte) 0xff, 0x00, 0x00, 0x00,
            (byte) 0xff, (byte) 0xff, 0x4e, 0x20 };

    OFMessageFactory factory = new BasicFactory();
    ByteBuffer packetBuf = ByteBuffer.wrap(packet);
    List<OFMessage> msgs = factory.parseMessages(packetBuf, packet.length);
    TestCase.assertEquals(1, msgs.size());
    TestCase.assertTrue(msgs.get(0) instanceof OFStatisticsRequest);
    OFStatisticsRequest sr = (OFStatisticsRequest) msgs.get(0);
    TestCase.assertEquals(OFStatisticsType.VENDOR, sr.getStatisticType());
    TestCase.assertEquals(1, sr.getStatistics().size());
    TestCase.assertTrue(sr.getStatistics().get(0) instanceof OFVendorStatistics);
    TestCase.assertEquals(68, ((OFVendorStatistics)sr.getStatistics().get(0)).getLength());
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:24,代码来源:OFStatisticsRequestTest.java

示例4: vendorReplyBuilder

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
/**
 * VendorReplyBuilder
 *
 * @return the OFVendor MSG
 */
private OFVendorStatistics vendorReplyBuilder() {
    OFVendorStatistics vendorStat = new OFVendorStatistics();
    vendorStat.setLength(4);
    ByteBuffer buf = ByteBuffer.allocate(4);
    buf.putInt(42);
    buf.flip();
    vendorStat.readFrom(buf);

    return vendorStat;
}
 
开发者ID:lsinfo3,项目名称:ofcprobe,代码行数:16,代码来源:OFStatsHandler.java

示例5: notifyFlowUpdate

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
private void notifyFlowUpdate(Long switchId, List<OFStatistics> values) {
    if (values.get(0) instanceof OFVendorStatistics) {
        values = this.v6StatsListToOFStatsList(values);
    }

    for (IOFStatisticsListener l : this.statisticsListeners) {
        l.flowStatisticsRefreshed(switchId, values);
    }

}
 
开发者ID:lbchen,项目名称:ODL,代码行数:11,代码来源:OFStatisticsManager.java

示例6: getOFFlowStatistics

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
@Override
public List<OFStatistics> getOFFlowStatistics(Long switchId) {
    List<OFStatistics> list = flowStatistics.get(switchId);

    /*
     * Check on emptiness as interference between add and get is still
     * possible on the inner list (the concurrentMap entry's value)
     */
    return (list == null || list.isEmpty()) ? this.dummyList
            : (list.get(0) instanceof OFVendorStatistics) ? this
                    .v6StatsListToOFStatsList(list) : list;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:13,代码来源:OFStatisticsManager.java

示例7: v6StatsListToOFStatsList

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
private List<OFStatistics> v6StatsListToOFStatsList(
        List<OFStatistics> statistics) {
    List<OFStatistics> v6statistics = new ArrayList<OFStatistics>();
    if (statistics != null && !statistics.isEmpty()) {
        for (OFStatistics stats : statistics) {
            if (stats instanceof OFVendorStatistics) {
                List<OFStatistics> r = getV6ReplyStatistics((OFVendorStatistics) stats);
                if (r != null) {
                    v6statistics.addAll(r);
                }
            }
        }
    }
    return v6statistics;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:16,代码来源:OFStatisticsManager.java

示例8: parseStatistics

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
/**
 * @param t
 *            OFMessage type: should be one of stats_request or stats_reply
 * @param st
 *            statistics type of this message, e.g., DESC, TABLE
 * @param data
 *            buffer to read from
 * @param length
 *            length of statistics
 * @param limit
 *            number of statistics to grab; 0 == all
 * 
 * @return list of statistics
 */

@Override
public List<OFStatistics> parseStatistics(OFType t, OFStatisticsType st,
        ChannelBuffer data, int length, int limit) {
    List<OFStatistics> results = new ArrayList<OFStatistics>();
    OFStatistics statistics = getStatistics(t, st);

    int start = data.readerIndex();
    int count = 0;

    while (limit == 0 || results.size() <= limit) {
        // TODO Create a separate MUX/DEMUX path for vendor stats
        if (statistics instanceof OFVendorStatistics)
            ((OFVendorStatistics)statistics).setLength(length);

        /**
         * can't use data.remaining() here, b/c there could be other data
         * buffered past this message
         */
        if ((length - count) >= statistics.getLength()) {
            if (statistics instanceof OFActionFactoryAware)
                ((OFActionFactoryAware)statistics).setActionFactory(this);
            statistics.readFrom(data);
            results.add(statistics);
            count += statistics.getLength();
            statistics = getStatistics(t, st);
        } else {
            if (count < length) {
                /**
                 * Nasty case: partial/incomplete statistic found even
                 * though we have a full message. Found when NOX sent
                 * agg_stats request with wrong agg statistics length (52
                 * instead of 56)
                 * 
                 * just throw the rest away, or we will break framing
                 */
                data.readerIndex(start + length);
            }
            return results;
        }
    }
    return results; // empty; no statistics at all
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:58,代码来源:BasicFactory.java

示例9: parseStatistics

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
/**
 * @param t
 *            OFMessage type: should be one of stats_request or stats_reply
 * @param st
 *            statistics type of this message, e.g., DESC, TABLE
 * @param data
 *            buffer to read from
 * @param length
 *            length of statistics
 * @param limit
 *            number of statistics to grab; 0 == all
 *
 * @return list of statistics
 */

@Override
public List<OFStatistics> parseStatistics(final OFType t,
        final OFStatisticsType st, final ChannelBuffer data,
        final int length, final int limit) {
    final List<OFStatistics> results = new ArrayList<OFStatistics>();
    OFStatistics statistics = this.getStatistics(t, st);

    final int start = data.readerIndex();
    int count = 0;

    while (limit == 0 || results.size() <= limit) {
        // TODO Create a separate MUX/DEMUX path for vendor stats
        if (statistics instanceof OFVendorStatistics) {
            ((OFVendorStatistics) statistics).setLength(length);
        }

        /**
         * can't use data.remaining() here, b/c there could be other data
         * buffered past this message
         */
        if (length - count >= statistics.getLength()) {
            if (statistics instanceof OFActionFactoryAware) {
                ((OFActionFactoryAware) statistics).setActionFactory(this);
            }
            statistics.readFrom(data);
            results.add(statistics);
            count += statistics.getLength();
            statistics = this.getStatistics(t, st);
        } else {
            if (count < length) {
                /**
                 * Nasty case: partial/incomplete statistic found even
                 * though we have a full message. Found when NOX sent
                 * agg_stats request with wrong agg statistics length (52
                 * instead of 56)
                 *
                 * just throw the rest away, or we will break framing
                 */
                data.readerIndex(start + length);
            }
            return results;
        }
    }
    return results; // empty; no statistics at all
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:61,代码来源:BasicFactory.java

示例10: parseStatistics

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
/**
 * @param t
 *            OFMessage type: should be one of stats_request or stats_reply
 * @param st
 *            statistics type of this message, e.g., DESC, TABLE
 * @param data
 *            buffer to read from
 * @param length
 *            length of statistics
 * @param limit
 *            number of statistics to grab; 0 == all
 *
 * @return list of statistics
 */

@Override
public List<OFStatistics> parseStatistics(OFType t, OFStatisticsType st,
        ChannelBuffer data, int length, int limit) {
    List<OFStatistics> results = new ArrayList<OFStatistics>();
    OFStatistics statistics = getStatistics(t, st);

    int start = data.readerIndex();
    int count = 0;

    while (limit == 0 || results.size() <= limit) {
        // TODO Create a separate MUX/DEMUX path for vendor stats
        if (statistics instanceof OFVendorStatistics)
            ((OFVendorStatistics)statistics).setLength(length);

        /**
         * can't use data.remaining() here, b/c there could be other data
         * buffered past this message
         */
        if ((length - count) >= statistics.getLength()) {
            if (statistics instanceof OFActionFactoryAware)
                ((OFActionFactoryAware)statistics).setActionFactory(this);
            statistics.readFrom(data);
            results.add(statistics);
            count += statistics.getLength();
            statistics = getStatistics(t, st);
        } else {
            if (count < length) {
                /**
                 * Nasty case: partial/incomplete statistic found even
                 * though we have a full message. Found when NOX sent
                 * agg_stats request with wrong agg statistics length (52
                 * instead of 56)
                 *
                 * just throw the rest away, or we will break framing
                 */
                data.readerIndex(start + length);
            }
            return results;
        }
    }
    return results; // empty; no statistics at all
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:58,代码来源:BasicFactory.java

示例11: getV6ReplyStatistics

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
private static List<OFStatistics> getV6ReplyStatistics(
        OFVendorStatistics stat) {
    int length = stat.getLength();
    List<OFStatistics> results = new ArrayList<OFStatistics>();
    if (length < 12)
        return null; // Nicira Hdr is 12 bytes. We need atleast that much
    ByteBuffer data = ByteBuffer.allocate(length);
    stat.writeTo(data);
    data.rewind();
    if (log.isTraceEnabled()) {
        log.trace("getV6ReplyStatistics: Buffer BYTES ARE {}",
                HexString.toHexString(data.array()));
    }

    int vendor = data.getInt(); // first 4 bytes is vendor id.
    if (vendor != V6StatsRequest.NICIRA_VENDOR_ID) {
        log.warn("Unexpected vendor id: 0x{}", Integer.toHexString(vendor));
        return null;
    } else {
        // go ahead by 8 bytes which is 8 bytes of 0
        data.getLong(); // should be all 0's
        length -= 12; // 4 bytes Nicira Hdr + 8 bytes from above line have
                      // been consumed
    }

    V6StatsReply v6statsreply;
    int min_len;
    while (length > 0) {
        v6statsreply = new V6StatsReply();
        min_len = v6statsreply.getLength();
        if (length < v6statsreply.getLength())
            break;
        v6statsreply.setActionFactory(stat.getActionFactory());
        v6statsreply.readFrom(data);
        if (v6statsreply.getLength() < min_len)
            break;
        v6statsreply.setVendorId(vendor);
        log.trace("V6StatsReply: {}", v6statsreply);
        length -= v6statsreply.getLength();
        results.add(v6statsreply);
    }
    return results;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:44,代码来源:OFStatisticsManager.java

示例12: parseStatistics

import org.openflow.protocol.statistics.OFVendorStatistics; //导入依赖的package包/类
/**
 * @param t
 *            OFMessage type: should be one of stats_request or stats_reply
 * @param st
 *            statistics type of this message, e.g., DESC, TABLE
 * @param data
 *            buffer to read from
 * @param length
 *            length of statistics
 * @param limit
 *            number of statistics to grab; 0 == all
 * 
 * @return list of statistics
 */

@Override
public List<OFStatistics> parseStatistics(OFType t, OFStatisticsType st,
        ByteBuffer data, int length, int limit) {
    List<OFStatistics> results = new ArrayList<OFStatistics>();
    OFStatistics statistics = getStatistics(t, st);

    int start = data.position();
    int count = 0;

    while (limit == 0 || results.size() <= limit) {
        // TODO Create a separate MUX/DEMUX path for vendor stats
        if (statistics instanceof OFVendorStatistics)
            ((OFVendorStatistics)statistics).setLength(length);

        /**
         * can't use data.remaining() here, b/c there could be other data
         * buffered past this message
         */
        if ((length - count) >= statistics.getLength()) {
            if (statistics instanceof OFActionFactoryAware)
                ((OFActionFactoryAware)statistics).setActionFactory(this);
            statistics.readFrom(data);
            results.add(statistics);
            count += statistics.getLength();
            statistics = getStatistics(t, st);
        } else {
            if (count < length) {
                /**
                 * Nasty case: partial/incomplete statistic found even
                 * though we have a full message. Found when NOX sent
                 * agg_stats request with wrong agg statistics length (52
                 * instead of 56)
                 * 
                 * just throw the rest away, or we will break framing
                 */
                data.position(start + length);
            }
            return results;
        }
    }
    return results; // empty; no statistics at all
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:58,代码来源:BasicFactory.java


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