| 31 | |
| 32 | |
| 33 | class BessArpTest(BessModuleTestCase): |
| 34 | |
| 35 | def test_arp(self): |
| 36 | arp = ArpResponder() |
| 37 | |
| 38 | eth_header = scapy.Ether( |
| 39 | src='02:1e:67:9f:4d:ae', dst='ff:ff:ff:ff:ff:ff') |
| 40 | arp_header = scapy.ARP(op=1, pdst='1.2.3.4') |
| 41 | arp_req = eth_header / arp_header |
| 42 | |
| 43 | arp.add(ip='1.2.3.4', mac_addr='A0:22:33:44:55:66') |
| 44 | |
| 45 | arp_reply = arp_req.copy() |
| 46 | arp_reply[scapy.Ether].src = 'A0:22:33:44:55:66' |
| 47 | arp_reply[scapy.Ether].dst = '02:1e:67:9f:4d:ae' |
| 48 | arp_reply[scapy.ARP].op = 2 |
| 49 | |
| 50 | arp_reply[scapy.ARP].hwdst = arp_req[scapy.ARP].hwsrc |
| 51 | arp_reply[scapy.ARP].hwsrc = 'A0:22:33:44:55:66' |
| 52 | |
| 53 | arp_reply[scapy.ARP].pdst = arp_req[scapy.ARP].psrc |
| 54 | arp_reply[scapy.ARP].psrc = '1.2.3.4' |
| 55 | |
| 56 | pkt_outs = self.run_module(arp, 0, [arp_req], [0]) |
| 57 | self.assertEquals(len(pkt_outs[0]), 1) |
| 58 | self.assertSamePackets(pkt_outs[0][0], arp_reply) |
| 59 | |
| 60 | suite = unittest.TestLoader().loadTestsFromTestCase(BessArpTest) |
| 61 | results = unittest.TextTestRunner(verbosity=2).run(suite) |
nothing calls this directly
no outgoing calls
no test coverage detected