Java 类net.floodlightcontroller.core.module.FloodlightTestModuleLoader 实例源码
项目:QoS-floodlight
文件:LearningSwitchTest.java
@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);
}
项目:Multipath-Hedera-system-in-Floodlight-controller
文件:LearningSwitchTest.java
@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);
}
项目:floodlight_with_topoguard
文件:LearningSwitchTest.java
@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);
}
项目:FloodligtModule
文件:LearningSwitchTest.java
@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);
}
项目:smartenit
文件:LearningSwitchTest.java
@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);
}
项目:multicastSDN
文件:LearningSwitchTest.java
@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);
}
项目:floodlight-qosmanager
文件:LearningSwitchTest.java
@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);
}
项目:floodlight-nfv
文件:LearningSwitchTest.java
@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);
}
项目:HederaInFloodlight
文件:LearningSwitchTest.java
@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);
}
项目:floodlight-oss
文件:LearningSwitchTest.java
@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);
}
项目:my-floodlight
文件:LearningSwitchTest.java
@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);
}
项目:FL_HAND
文件:LearningSwitchTest.java
@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);
}
项目:sdn-project
文件:LearningSwitchTest.java
@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);
}