當前位置: 首頁>>代碼示例>>Java>>正文


Java OFQueuePropertyMinRate類代碼示例

本文整理匯總了Java中org.openflow.protocol.queue.OFQueuePropertyMinRate的典型用法代碼示例。如果您正苦於以下問題:Java OFQueuePropertyMinRate類的具體用法?Java OFQueuePropertyMinRate怎麽用?Java OFQueuePropertyMinRate使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OFQueuePropertyMinRate類屬於org.openflow.protocol.queue包,在下文中一共展示了OFQueuePropertyMinRate類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testReply

import org.openflow.protocol.queue.OFQueuePropertyMinRate; //導入依賴的package包/類
public void testReply() throws Exception {
    OFQueueConfigReply reply = new OFQueueConfigReply();
    reply.setPort((short) 5);

    OFPacketQueue queue = new OFPacketQueue();
    queue.setQueueId(1);
    List<OFQueueProperty> properties = new ArrayList<OFQueueProperty>();
    properties.add(new OFQueuePropertyMinRate().setRate((short) 1));
    queue.setProperties(properties);
    queue.setLength((short) (OFPacketQueue.MINIMUM_LENGTH + OFQueuePropertyMinRate.MINIMUM_LENGTH));

    List<OFPacketQueue> queues = new ArrayList<OFPacketQueue>();
    queues.add(queue);
    reply.setQueues(queues);
    reply.setLengthU(OFQueueConfigReply.MINIMUM_LENGTH + queue.getLength());

    ByteBuffer bb = ByteBuffer.allocate(1024);
    bb.clear();
    reply.writeTo(bb);
    bb.flip();

    OFQueueConfigReply reply2 = new OFQueueConfigReply();
    reply2.setQueuePropertyFactory(new BasicFactory());
    reply2.readFrom(bb);
    TestCase.assertEquals(reply, reply2);
    TestCase.assertEquals(1, reply2.getQueues().size());
    TestCase.assertEquals(1, reply2.getQueues().get(0).getProperties().size());
    TestCase.assertTrue(reply2.getQueues().get(0).getProperties().get(0) instanceof OFQueuePropertyMinRate);
    TestCase.assertEquals(OFQueuePropertyType.MIN_RATE, reply2.getQueues().get(0).getProperties().get(0).getType());

    reply.getQueues().add(queue.clone());
    reply.setLengthU(reply.getLengthU() + queue.getLength());
    bb.clear();
    reply.writeTo(bb);
    bb.flip();
    reply2 = new OFQueueConfigReply();
    reply2.setQueuePropertyFactory(new BasicFactory());
    reply2.readFrom(bb);
    TestCase.assertEquals(reply, reply2);
    TestCase.assertEquals(2, reply2.getQueues().size());

    queue.getProperties().add(new OFQueuePropertyMinRate().setRate((short) 2));
    queue.setLength((short) (queue.getLength() + OFQueuePropertyMinRate.MINIMUM_LENGTH));
    reply.setLengthU(reply.getLengthU() + OFQueuePropertyMinRate.MINIMUM_LENGTH);
    bb.clear();
    reply.writeTo(bb);
    bb.flip();
    reply2 = new OFQueueConfigReply();
    reply2.setQueuePropertyFactory(new BasicFactory());
    reply2.readFrom(bb);
    TestCase.assertEquals(reply, reply2);
    TestCase.assertEquals(2, reply2.getQueues().size());
    TestCase.assertEquals(2, reply2.getQueues().get(0).getProperties().size());
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:55,代碼來源:OFQueueConfigTest.java


注:本文中的org.openflow.protocol.queue.OFQueuePropertyMinRate類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。