class IP4FwdTestCase(VppTestCase):
""" IPv4 simple forwarding test case """
-2. Add a setUpClass function containing the setup needed for our test to run::
+3. Add a setUpClass function containing the setup needed for our test to run::
@classmethod
def setUpClass(self):
i.config_ip4() # configure IPv4 address on the interface
i.resolve_arp() # resolve ARP, so that we know VPP MAC
-3. Create a helper method to create the packets to send::
+4. Create a helper method to create the packets to send::
def create_stream(self, src_if, dst_if, count):
packets = []
# return the created packet list
return packets
-4. Create a helper method to verify the capture::
+5. Create a helper method to verify the capture::
def verify_capture(self, src_if, dst_if, capture):
packet_info = None
ip = packet[IP]
udp = packet[UDP]
# convert the payload to packet info object
- payload_info = self.payload_to_info(str(packet[Raw]))
+ payload_info = self.payload_to_info(packet[Raw])
# make sure the indexes match
self.assert_equal(payload_info.src, src_if.sw_if_index,
"source sw_if_index")
"Interface %s: Packet expected from interface "
"%s didn't arrive" % (dst_if.name, src_if.name))
-5. Add the test code to test_basic function::
+6. Add the test code to test_basic function::
def test_basic(self):
count = 10
# verify capture
self.verify_capture(self.pg0, self.pg1, capture)
-6. Run the test by issuing 'make test'.
+7. Run the test by issuing 'make test' or, to run only this specific
+ test, issue 'make test TEST=test_ip4_fwd'.