def test_received_eth_packet(self):
        host1, host2 = self.net.get("h1", "h2")
        self.analyze_packets(["h1", "h2"], lambda: self.net.ping(
            (host1, host2)))

        # Analyze packets on h1
        packet = Packet()
        packet.eth_src = "cc:cc:cc:cc:cc:01"
        packet.eth_dst = "cc:cc:cc:cc:cc:02"
        self.assertReceivedPacket(packet, "Received eth packet", "h1")
        packet1 = Packet()
        packet1.eth_src = "aa:aa:aa:aa:aa:aa"
        packet1.eth_dst = "cc:cc:cc:cc:cc:02"
        self.assertNotReceivedPacket(packet1,
                                     "Not received packet from switch.", "h1")

        # Analyze packets on h2
        packet3 = Packet()
        packet3.eth_src = "cc:cc:cc:cc:cc:01"
        packet3.eth_dst = "cc:cc:cc:cc:cc:02"
        self.assertReceivedPacket(packet3, "Received eth packet", "h2")
        packet4 = Packet()
        packet4.eth_src = "aa:aa:aa:aa:aa:aa"
        packet4.eth_dst = "cc:cc:cc:cc:cc:02"
        self.assertNotReceivedPacket(packet4,
                                     "Not received packet from switch.", "h2")
 def test_received_eth_packet(self):
     self.analyze_packets("h1", lambda: self.net.pingAll())
     packet = Packet()
     packet.eth_src = "cc:cc:cc:cc:cc:01"
     packet.eth_dst = "cc:cc:cc:cc:cc:02"
     self.assertReceivedPacket(packet, "Received eth packet")
     packet1 = Packet()
     packet1.eth_src = "aa:aa:aa:aa:aa:aa"
     packet1.eth_dst = "cc:cc:cc:cc:cc:02"
     self.assertNotReceivedPacket(packet1, "Not received packet from switch.")
Example #3
0
 def test_received_eth_packet(self):
     self.analyze_packets("h1", lambda: self.net.pingAll())
     packet = Packet()
     packet.eth_src = "cc:cc:cc:cc:cc:01"
     packet.eth_dst = "cc:cc:cc:cc:cc:02"
     self.assertReceivedPacket(packet, "Received eth packet")
     packet1 = Packet()
     packet1.eth_src = "aa:aa:aa:aa:aa:aa"
     packet1.eth_dst = "cc:cc:cc:cc:cc:02"
     self.assertNotReceivedPacket(packet1,
                                  "Not received packet from switch.")
    def test_received_eth_packet(self):
        host1, host2 = self.net.get("h1", "h2")
        self.analyze_packets(["h1","h2"], lambda: self.net.ping((host1, host2)))

        # Analyze packets on h1
        packet = Packet()
        packet.eth_src = "cc:cc:cc:cc:cc:01"
        packet.eth_dst = "cc:cc:cc:cc:cc:02"
        self.assertReceivedPacket(packet, "Received eth packet", "h1")
        packet1 = Packet()
        packet1.eth_src = "aa:aa:aa:aa:aa:aa"
        packet1.eth_dst = "cc:cc:cc:cc:cc:02"
        self.assertNotReceivedPacket(packet1, "Not received packet from switch.", "h1")

        # Analyze packets on h2
        packet3 = Packet()
        packet3.eth_src = "cc:cc:cc:cc:cc:01"
        packet3.eth_dst = "cc:cc:cc:cc:cc:02"
        self.assertReceivedPacket(packet3, "Received eth packet", "h2")
        packet4 = Packet()
        packet4.eth_src = "aa:aa:aa:aa:aa:aa"
        packet4.eth_dst = "cc:cc:cc:cc:cc:02"
        self.assertNotReceivedPacket(packet4, "Not received packet from switch.", "h2")