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


Java FloodlightTestModuleLoader.getModuleByName方法代码示例

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


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

示例1: setUp

import net.floodlightcontroller.core.module.FloodlightTestModuleLoader; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    FloodlightTestModuleLoader fml = new FloodlightTestModuleLoader();
    Collection<Class<? extends IFloodlightModule>> mods
    	= new ArrayList<Class<? extends IFloodlightModule>>();
    mods.add(LearningSwitch.class);

    fml.setupModules(mods, null);
    learningSwitch = (LearningSwitch) fml.getModuleByName(LearningSwitch.class);
    mockFloodlightProvider =
            (MockFloodlightProvider) fml.getModuleByName(MockFloodlightProvider.class);

    // Build our test packet
    this.testPacket = new Ethernet()
        .setDestinationMACAddress("00:11:22:33:44:55")
        .setSourceMACAddress("00:44:33:22:11:00")
        .setVlanID((short) 42)
        .setEtherType(Ethernet.TYPE_IPv4)
        .setPayload(
            new IPv4()
            .setTtl((byte) 128)
            .setSourceAddress("192.168.1.1")
            .setDestinationAddress("192.168.1.2")
            .setPayload(new UDP()
                        .setSourcePort((short) 5000)
                        .setDestinationPort((short) 5001)
                        .setPayload(new Data(new byte[] {0x01}))));
    this.testPacketSerialized = testPacket.serialize();
    // Build a broadcast packet
    this.broadcastPacket = new Ethernet()
        .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
        .setSourceMACAddress("00:44:33:22:11:00")
        .setVlanID((short) 42)
        .setEtherType(Ethernet.TYPE_IPv4)
        .setPayload(
            new IPv4()
            .setTtl((byte) 128)
            .setSourceAddress("192.168.1.1")
            .setDestinationAddress("192.168.255.255")
            .setPayload(new UDP()
                    .setSourcePort((short) 5000)
                    .setDestinationPort((short) 5001)
                    .setPayload(new Data(new byte[] {0x01}))));

    this.broadcastPacketSerialized = broadcastPacket.serialize();
    this.testPacketReply = new Ethernet()
        .setDestinationMACAddress("00:44:33:22:11:00")
        .setSourceMACAddress("00:11:22:33:44:55")
        .setVlanID((short) 42)
        .setEtherType(Ethernet.TYPE_IPv4)
        .setPayload(
                new IPv4()
                .setTtl((byte) 128)
                .setSourceAddress("192.168.1.2")
                .setDestinationAddress("192.168.1.1")
                .setPayload(new UDP()
                .setSourcePort((short) 5001)
                .setDestinationPort((short) 5000)
                .setPayload(new Data(new byte[] {0x02}))));
    this.testPacketReplySerialized = testPacketReply.serialize();

    // Build the PacketIn
    this.packetIn = ((OFPacketIn) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_IN))
        .setBufferId(OFPacketOut.BUFFER_ID_NONE)
        .setInPort((short) 1)
        .setPacketData(this.testPacketSerialized)
        .setReason(OFPacketInReason.NO_MATCH)
        .setTotalLength((short) this.testPacketSerialized.length);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:72,代码来源:LearningSwitchTest.java

示例2: setUp

import net.floodlightcontroller.core.module.FloodlightTestModuleLoader; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    super.setUp();
    FloodlightTestModuleLoader fml = new FloodlightTestModuleLoader();
    Collection<Class<? extends IFloodlightModule>> mods 
    	= new ArrayList<Class<? extends IFloodlightModule>>();
    mods.add(LearningSwitch.class);
    fml.setupModules(mods, null);
    learningSwitch = (LearningSwitch) fml.getModuleByName(LearningSwitch.class);
    mockFloodlightProvider = 
    		(MockFloodlightProvider) fml.getModuleByName(MockFloodlightProvider.class);
   
    // Build our test packet
    this.testPacket = new Ethernet()
        .setDestinationMACAddress("00:11:22:33:44:55")
        .setSourceMACAddress("00:44:33:22:11:00")
        .setVlanID((short) 42)
        .setEtherType(Ethernet.TYPE_IPv4)
        .setPayload(
            new IPv4()
            .setTtl((byte) 128)
            .setSourceAddress("192.168.1.1")
            .setDestinationAddress("192.168.1.2")
            .setPayload(new UDP()
                        .setSourcePort((short) 5000)
                        .setDestinationPort((short) 5001)
                        .setPayload(new Data(new byte[] {0x01}))));
    this.testPacketSerialized = testPacket.serialize();
    // Build a broadcast packet
    this.broadcastPacket = new Ethernet()
        .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
        .setSourceMACAddress("00:44:33:22:11:00")
        .setVlanID((short) 42)
        .setEtherType(Ethernet.TYPE_IPv4)
        .setPayload(
            new IPv4()
            .setTtl((byte) 128)
            .setSourceAddress("192.168.1.1")
            .setDestinationAddress("192.168.255.255")
            .setPayload(new UDP()
                    .setSourcePort((short) 5000)
                    .setDestinationPort((short) 5001)
                    .setPayload(new Data(new byte[] {0x01}))));

    this.broadcastPacketSerialized = broadcastPacket.serialize();
    this.testPacketReply = new Ethernet()
        .setDestinationMACAddress("00:44:33:22:11:00")
        .setSourceMACAddress("00:11:22:33:44:55")
        .setVlanID((short) 42)
        .setEtherType(Ethernet.TYPE_IPv4)
        .setPayload(
                new IPv4()
                .setTtl((byte) 128)
                .setSourceAddress("192.168.1.2")
                .setDestinationAddress("192.168.1.1")
                .setPayload(new UDP()
                .setSourcePort((short) 5001)
                .setDestinationPort((short) 5000)
                .setPayload(new Data(new byte[] {0x02}))));
    this.testPacketReplySerialized = testPacketReply.serialize();

    // Build the PacketIn
    this.packetIn = ((OFPacketIn) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_IN))
        .setBufferId(-1)
        .setInPort((short) 1)
        .setPacketData(this.testPacketSerialized)
        .setReason(OFPacketInReason.NO_MATCH)
        .setTotalLength((short) this.testPacketSerialized.length);
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:70,代码来源:LearningSwitchTest.java

示例3: setUp

import net.floodlightcontroller.core.module.FloodlightTestModuleLoader; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    super.setUp();
    FloodlightTestModuleLoader fml = new FloodlightTestModuleLoader();
    Collection<Class<? extends IFloodlightModule>> mods 
    	= new ArrayList<Class<? extends IFloodlightModule>>();
    mods.add(LearningSwitch.class);
    fml.setupModules(mods, null);
    learningSwitch = (LearningSwitch) fml.getModuleByName(LearningSwitch.class);
    mockFloodlightProvider = 
            (MockFloodlightProvider) fml.getModuleByName(MockFloodlightProvider.class);
   
    // Build our test packet
    this.testPacket = new Ethernet()
        .setDestinationMACAddress("00:11:22:33:44:55")
        .setSourceMACAddress("00:44:33:22:11:00")
        .setVlanID((short) 42)
        .setEtherType(Ethernet.TYPE_IPv4)
        .setPayload(
            new IPv4()
            .setTtl((byte) 128)
            .setSourceAddress("192.168.1.1")
            .setDestinationAddress("192.168.1.2")
            .setPayload(new UDP()
                        .setSourcePort((short) 5000)
                        .setDestinationPort((short) 5001)
                        .setPayload(new Data(new byte[] {0x01}))));
    this.testPacketSerialized = testPacket.serialize();
    // Build a broadcast packet
    this.broadcastPacket = new Ethernet()
        .setDestinationMACAddress("FF:FF:FF:FF:FF:FF")
        .setSourceMACAddress("00:44:33:22:11:00")
        .setVlanID((short) 42)
        .setEtherType(Ethernet.TYPE_IPv4)
        .setPayload(
            new IPv4()
            .setTtl((byte) 128)
            .setSourceAddress("192.168.1.1")
            .setDestinationAddress("192.168.255.255")
            .setPayload(new UDP()
                    .setSourcePort((short) 5000)
                    .setDestinationPort((short) 5001)
                    .setPayload(new Data(new byte[] {0x01}))));

    this.broadcastPacketSerialized = broadcastPacket.serialize();
    this.testPacketReply = new Ethernet()
        .setDestinationMACAddress("00:44:33:22:11:00")
        .setSourceMACAddress("00:11:22:33:44:55")
        .setVlanID((short) 42)
        .setEtherType(Ethernet.TYPE_IPv4)
        .setPayload(
                new IPv4()
                .setTtl((byte) 128)
                .setSourceAddress("192.168.1.2")
                .setDestinationAddress("192.168.1.1")
                .setPayload(new UDP()
                .setSourcePort((short) 5001)
                .setDestinationPort((short) 5000)
                .setPayload(new Data(new byte[] {0x02}))));
    this.testPacketReplySerialized = testPacketReply.serialize();

    // Build the PacketIn
    this.packetIn = ((OFPacketIn) mockFloodlightProvider.getOFMessageFactory().getMessage(OFType.PACKET_IN))
        .setBufferId(OFPacketOut.BUFFER_ID_NONE)
        .setInPort((short) 1)
        .setPacketData(this.testPacketSerialized)
        .setReason(OFPacketInReason.NO_MATCH)
        .setTotalLength((short) this.testPacketSerialized.length);
}
 
开发者ID:dana-i2cat,项目名称:floodlight-nfv,代码行数:70,代码来源:LearningSwitchTest.java


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