testCreatePool();
testCreateMember();
IOFSwitch sw1;
IPacket arpRequest1, arpReply1, icmpPacket1, icmpPacket2;
byte[] arpRequest1Serialized;
byte[] arpReply1Serialized;
byte[] icmpPacket1Serialized, icmpPacket2Serialized;
OFPacketIn arpRequestPacketIn1;
OFPacketIn icmpPacketIn1, icmpPacketIn2;
OFPacketOut arpReplyPacketOut1;
Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
Capture<FloodlightContext> bc1 =
new Capture<FloodlightContext>(CaptureType.ALL);
int fastWildcards =
OFMatch.OFPFW_IN_PORT |
OFMatch.OFPFW_NW_PROTO |
OFMatch.OFPFW_TP_SRC |
OFMatch.OFPFW_TP_DST |
OFMatch.OFPFW_NW_SRC_ALL |
OFMatch.OFPFW_NW_DST_ALL |
OFMatch.OFPFW_NW_TOS;
sw1 = EasyMock.createNiceMock(IOFSwitch.class);
expect(sw1.getId()).andReturn(1L).anyTimes();
expect(sw1.getStringId()).andReturn("00:00:00:00:00:01").anyTimes();
expect(sw1.getAttribute(IOFSwitch.PROP_FASTWILDCARDS)).andReturn(fastWildcards).anyTimes();
expect(sw1.hasAttribute(IOFSwitch.PROP_SUPPORTS_OFPP_TABLE)).andReturn(true).anyTimes();
sw1.writeThrottled(capture(wc1), capture(bc1));
expectLastCall().anyTimes();
sw1.flush();
expectLastCall().anyTimes();
replay(sw1);
sfp.switchAdded(1L);
verify(sw1);
/* Test plan:
* - two clients and two servers on sw1 port 1, 2, 3, 4
* - mock arp request received towards vip1 from (1L, 1)
* - proxy arp got pushed out to (1L, 1)- check sw1 getting the packetout
* - mock icmp request received towards vip1 from (1L, 1)
* - device manager list of devices queried to identify source and dest devices
* - routing engine queried to get inbound and outbound routes
* - check getRoute calls and responses
* - sfp called to install flows
* - check sfp calls
*/
// Build topology
reset(topology);
expect(topology.isIncomingBroadcastAllowed(anyLong(), anyShort())).andReturn(true).anyTimes();
expect(topology.getL2DomainId(1L)).andReturn(1L).anyTimes();
expect(topology.isAttachmentPointPort(1L, (short)1)).andReturn(true).anyTimes();
expect(topology.isAttachmentPointPort(1L, (short)2)).andReturn(true).anyTimes();
expect(topology.isAttachmentPointPort(1L, (short)3)).andReturn(true).anyTimes();
expect(topology.isAttachmentPointPort(1L, (short)4)).andReturn(true).anyTimes();
replay(topology);
// Build arp packets
arpRequest1 = new Ethernet()
.setSourceMACAddress("00:00:00:00:00:01")
.setDestinationMACAddress("ff:ff:ff:ff:ff:ff")
.setEtherType(Ethernet.TYPE_ARP)
.setVlanID((short) 0)
.setPriorityCode((byte) 0)
.setPayload(
new ARP()
.setHardwareType(ARP.HW_TYPE_ETHERNET)
.setProtocolType(ARP.PROTO_TYPE_IP)
.setHardwareAddressLength((byte) 6)
.setProtocolAddressLength((byte) 4)
.setOpCode(ARP.OP_REQUEST)
.setSenderHardwareAddress(HexString.fromHexString("00:00:00:00:00:01"))
.setSenderProtocolAddress(IPv4.toIPv4AddressBytes("10.0.0.1"))
.setTargetHardwareAddress(HexString.fromHexString("00:00:00:00:00:00"))
.setTargetProtocolAddress(IPv4.toIPv4AddressBytes("10.0.0.100")));
arpRequest1Serialized = arpRequest1.serialize();
arpRequestPacketIn1 =
((OFPacketIn) getMockFloodlightProvider().getOFMessageFactory().
getMessage(OFType.PACKET_IN))
.setBufferId(-1)