@Test
public void testOnIpv4PacketReceived() {

	Ipv4PacketReceived packetReceived = mock(Ipv4PacketReceived.class);
	List<PacketChain> packetChains = new ArrayList<PacketChain>();
	PacketChain packetChain1 = mock(PacketChain.class);
	PacketChain packetChain2 = mock(PacketChain.class);
	PacketChain packetChain3 = mock(PacketChain.class);
	packetChains.add(packetChain1);
	packetChains.add(packetChain2);
	packetChains.add(packetChain3);
	RawPacket rawPacket = mock(RawPacket.class);
	EthernetPacket ethernetPacket = mock(EthernetPacket.class);
	Ipv4Packet ipv4Packet = mock(Ipv4Packet.class);
	Ipv4Address ipv4Address = Ipv4Address.getDefaultInstance("192.168.10.1");
	List<Header8021q> headers = mock(ArrayList.class);
	Header8021q header = mock(Header8021q.class);
	headers.add(0, header);
	VlanId vlanId = VlanId.getDefaultInstance("2001");
	MacAddress srcMac = MacAddress.getDefaultInstance("aa:bb:cc:dd:ee:ff");
	InstanceIdentifier<NodeConnector> ncRefInstance = mock(InstanceIdentifier.class);
	NodeConnectorRef ncRef = new NodeConnectorRef(ncRefInstance);
	when(packetReceived.getPacketChain()).thenReturn(packetChains);
	when(packetChain1.getPacket()).thenReturn(rawPacket);
	when(packetChain2.getPacket()).thenReturn(ethernetPacket);
	when(packetChain3.getPacket()).thenReturn(ipv4Packet);
	when(ipv4Packet.getSourceIpv4()).thenReturn(ipv4Address);
	when(ethernetPacket.getEthertype()).thenReturn(KnownEtherType.VlanTagged);
	when(ethernetPacket.getHeader8021q()).thenReturn(headers);
	when(headers.get(anyInt())).thenReturn(header);
	when(header.getVlan()).thenReturn(vlanId);
	when(ethernetPacket.getSourceMac()).thenReturn(srcMac);
	when(rawPacket.getIngress()).thenReturn(ncRef);
	addressObserver.onIpv4PacketReceived(packetReceived);
	verify(hostMonitor, times(1)).packetReceived(any(ConnectorAddress.class), any(InstanceIdentifier.class));
}