• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OFMessageUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testForwardNoPath

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
@Test
public void testForwardNoPath() throws Exception {
	learnDevices(DestDeviceToLearn.NONE);

	// Set no destination attachment point or route
	// expect no Flow-mod but expect the packet to be flooded

	Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
	
	Set<OFPort> bcastPorts = new HashSet<OFPort>();
	bcastPorts.add(OFPort.of(10));

	// Reset mocks, trigger the packet in, and validate results
	reset(topology);
	expect(topology.getSwitchBroadcastPorts(DatapathId.of(1L))).andReturn(bcastPorts).once();
	expect(topology.isAttachmentPointPort(DatapathId.of(anyLong()),
			OFPort.of(anyShort())))
			.andReturn(true)
			.anyTimes();
	expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_FLOOD)).andReturn(true).anyTimes();
	expect(sw1.write(capture(wc1))).andReturn(true).once();
	replay(sw1, sw2, routingEngine, topology);
	forwarding.receive(sw1, this.packetIn, cntx);
	verify(sw1, sw2, routingEngine);

	assertTrue(wc1.hasCaptured());
	assertTrue(OFMessageUtils.equalsIgnoreXid(wc1.getValue(), packetOutFlooded));
	
	removeDeviceFromContext();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:31,代码来源:ForwardingTest.java


示例2: testForwardNoPathIPv6

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
@Test
public void testForwardNoPathIPv6() throws Exception {
	learnDevicesIPv6(DestDeviceToLearn.NONE);

	// Set no destination attachment point or route
	// expect no Flow-mod but expect the packet to be flooded

	Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
	
	Set<OFPort> bcastPorts = new HashSet<OFPort>();
	bcastPorts.add(OFPort.of(10));

	// Reset mocks, trigger the packet in, and validate results
	reset(topology);
	expect(topology.getSwitchBroadcastPorts(DatapathId.of(1L))).andReturn(bcastPorts).once();
	expect(topology.isAttachmentPointPort(DatapathId.of(anyLong()),
			OFPort.of(anyShort())))
			.andReturn(true)
			.anyTimes();
	expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_FLOOD))
	.andReturn(true).anyTimes();
	// Reset XID to expected (dependent on prior unit tests)
	expect(sw1.write(capture(wc1))).andReturn(true).once();
	replay(sw1, sw2, routingEngine, topology);
	forwarding.receive(sw1, this.packetInIPv6, cntx);
	verify(sw1, sw2, routingEngine);

	assertTrue(wc1.hasCaptured());
	assertTrue(OFMessageUtils.equalsIgnoreXid(wc1.getValue(), packetOutFloodedIPv6));
	
	removeDeviceFromContext();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:33,代码来源:ForwardingTest.java


示例3: testFloodNoBufferId

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
@Test
public void testFloodNoBufferId() throws Exception {
    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
    
    // build our expected flooded packetOut
	OFActionOutput ao = OFFactories.getFactory(OFVersion.OF_13).actions().buildOutput().setPort(OFPort.FLOOD).build();
	List<OFAction> al = new ArrayList<OFAction>();
	al.add(ao);
    OFPacketOut po = OFFactories.getFactory(OFVersion.OF_13).buildPacketOut()
        .setActions(al)
        .setBufferId(OFBufferId.NO_BUFFER)
        .setXid(1)
        .setInPort(OFPort.of(1))
        .setData(this.testPacketSerialized).build();
    
    Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
    
    expect(mockSwitch.write(capture(wc1))).andReturn(true).anyTimes();

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assertTrue(OFMessageUtils.equalsIgnoreXid(m, po));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:37,代码来源:HubTest.java


示例4: testFlood

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
@Test
public void testFlood() throws Exception {
    // build our expected flooded packetOut
    OFPacketOut po = factory.buildPacketOut()
    	.setInPort(OFPort.of(1))
        .setActions(Arrays.asList((OFAction)factory.actions().output(OFPort.FLOOD, 0xffFFffFF)))
        .setBufferId(OFBufferId.NO_BUFFER)
        .setData(this.testPacketSerialized)
     .build();
    
    Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
    
    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    expect(mockSwitch.getId()).andReturn(DatapathId.of("00:11:22:33:44:55:66:77")).anyTimes();
    expect(mockSwitch.getOFFactory()).andReturn(factory).anyTimes();
    expect(mockSwitch.write(EasyMock.capture(wc1))).andReturn(true).once(); // expect po

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(OFType.PACKET_IN).get(0);
    // Make sure it's the right listener
    listener.receive(mockSwitch, this.packetIn, parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    OFPort result = learningSwitch.getFromPortMap(mockSwitch, MacAddress.of("00:44:33:22:11:00"), VlanVid.ofVlan(42));
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    assertTrue(OFMessageUtils.equalsIgnoreXid(wc1.getValue(), po));

    // Verify the MAC table inside the switch
    assertEquals(OFPort.of(1), result);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:36,代码来源:LearningSwitchTest.java


示例5: verifyFlowMod

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
private void verifyFlowMod(OFFlowMod testFlowMod, OFFlowMod goodFlowMod) {
	verifyMatch(testFlowMod, goodFlowMod);
	verifyActions(testFlowMod, goodFlowMod);
	// dont' bother testing the cookie; just copy it over
	goodFlowMod = goodFlowMod.createBuilder().setCookie(testFlowMod.getCookie()).build();
	// .. so we can continue to use .equals()
	assertTrue(OFMessageUtils.equalsIgnoreXid(goodFlowMod, testFlowMod));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:9,代码来源:StaticFlowTests.java


示例6: testForwardNoPath

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
@Test
public void testForwardNoPath() throws Exception {
    learnDevices(DestDeviceToLearn.NONE);

    // Set no destination attachment point or route
    // expect no Flow-mod but expect the packet to be flooded
    
    Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);

    // Reset mocks, trigger the packet in, and validate results
    reset(topology);
    expect(topology.isIncomingBroadcastAllowed(DatapathId.of(1L), OFPort.of(1))).andReturn(true).anyTimes();
    expect(topology.isAttachmentPointPort(DatapathId.of(anyLong()),
                                          OFPort.of(anyShort())))
                                          .andReturn(true)
                                          .anyTimes();
    expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_FLOOD))
            .andReturn(true).anyTimes();
    // Reset XID to expected (dependent on prior unit tests)
    sw1.write(capture(wc1));
    expectLastCall().once();
    replay(sw1, sw2, routingEngine, topology);
    forwarding.receive(sw1, this.packetIn, cntx);
    verify(sw1, sw2, routingEngine);
    
    assertTrue(wc1.hasCaptured());
    assertTrue(OFMessageUtils.equalsIgnoreXid(wc1.getValue(), packetOutFlooded));
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:29,代码来源:ForwardingTest.java


示例7: testFloodNoBufferId

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
@Test
public void testFloodNoBufferId() throws Exception {
    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
    
    // build our expected flooded packetOut
	OFActionOutput ao = OFFactories.getFactory(OFVersion.OF_13).actions().buildOutput().setPort(OFPort.FLOOD).build();
	List<OFAction> al = new ArrayList<OFAction>();
	al.add(ao);
    OFPacketOut po = OFFactories.getFactory(OFVersion.OF_13).buildPacketOut()
        .setActions(al)
        .setBufferId(OFBufferId.NO_BUFFER)
        .setXid(1)
        .setInPort(OFPort.of(1))
        .setData(this.testPacketSerialized).build();
    
    Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
    
    mockSwitch.write(capture(wc1));

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assertTrue(OFMessageUtils.equalsIgnoreXid(m, po));
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:37,代码来源:HubTest.java


示例8: testFlood

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
@Test
public void testFlood() throws Exception {
    // build our expected flooded packetOut
    OFPacketOut po = factory.buildPacketOut()
    	.setInPort(OFPort.of(1))
        .setActions(Arrays.asList((OFAction)factory.actions().output(OFPort.FLOOD, 0xffFFffFF)))
        .setBufferId(OFBufferId.NO_BUFFER)
        .setData(this.testPacketSerialized)
     .build();
    
    Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
    
    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    expect(mockSwitch.getId()).andReturn(DatapathId.of("00:11:22:33:44:55:66:77")).anyTimes();
    expect(mockSwitch.getOFFactory()).andReturn(factory).anyTimes();
    mockSwitch.write(EasyMock.capture(wc1)); // expect po
    EasyMock.expectLastCall().once();

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(OFType.PACKET_IN).get(0);
    // Make sure it's the right listener
    listener.receive(mockSwitch, this.packetIn, parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    OFPort result = learningSwitch.getFromPortMap(mockSwitch, MacAddress.of("00:44:33:22:11:00"), VlanVid.ofVlan(42));
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    assertTrue(OFMessageUtils.equalsIgnoreXid(wc1.getValue(), po));

    // Verify the MAC table inside the switch
    assertEquals(OFPort.of(1), result);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:37,代码来源:LearningSwitchTest.java


示例9: testForwardNoPath

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
@Test
public void testForwardNoPath() throws Exception {
	learnDevices(DestDeviceToLearn.NONE);

	// Set no destination attachment point or route
	// expect no Flow-mod but expect the packet to be flooded

	Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
	
	Set<OFPort> bcastPorts = new HashSet<OFPort>();
	bcastPorts.add(OFPort.of(10));

	// Reset mocks, trigger the packet in, and validate results
	reset(topology);
	expect(topology.getSwitchBroadcastPorts(DatapathId.of(1L))).andReturn(bcastPorts).once();
	expect(topology.isAttachmentPointPort(DatapathId.of(anyLong()),
			OFPort.of(anyShort())))
			.andReturn(true)
			.anyTimes();
	expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_FLOOD)).andReturn(true).anyTimes();
	sw1.write(capture(wc1));
	expectLastCall().once();
	replay(sw1, sw2, routingEngine, topology);
	forwarding.receive(sw1, this.packetIn, cntx);
	verify(sw1, sw2, routingEngine);

	assertTrue(wc1.hasCaptured());
	assertTrue(OFMessageUtils.equalsIgnoreXid(wc1.getValue(), packetOutFlooded));
	
	removeDeviceFromContext();
}
 
开发者ID:rhoybeen,项目名称:floodlightLB,代码行数:32,代码来源:ForwardingTest.java


示例10: testForwardNoPathIPv6

import net.floodlightcontroller.util.OFMessageUtils; //导入依赖的package包/类
@Test
public void testForwardNoPathIPv6() throws Exception {
	learnDevicesIPv6(DestDeviceToLearn.NONE);

	// Set no destination attachment point or route
	// expect no Flow-mod but expect the packet to be flooded

	Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
	
	Set<OFPort> bcastPorts = new HashSet<OFPort>();
	bcastPorts.add(OFPort.of(10));

	// Reset mocks, trigger the packet in, and validate results
	reset(topology);
	expect(topology.getSwitchBroadcastPorts(DatapathId.of(1L))).andReturn(bcastPorts).once();
	expect(topology.isAttachmentPointPort(DatapathId.of(anyLong()),
			OFPort.of(anyShort())))
			.andReturn(true)
			.anyTimes();
	expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_FLOOD))
	.andReturn(true).anyTimes();
	// Reset XID to expected (dependent on prior unit tests)
	sw1.write(capture(wc1));
	expectLastCall().once();
	replay(sw1, sw2, routingEngine, topology);
	forwarding.receive(sw1, this.packetInIPv6, cntx);
	verify(sw1, sw2, routingEngine);

	assertTrue(wc1.hasCaptured());
	assertTrue(OFMessageUtils.equalsIgnoreXid(wc1.getValue(), packetOutFloodedIPv6));
	
	removeDeviceFromContext();
}
 
开发者ID:rhoybeen,项目名称:floodlightLB,代码行数:34,代码来源:ForwardingTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MinguoChronology类代码示例发布时间:2022-05-22
下一篇:
Java Entity类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap