summaryrefslogtreecommitdiffstats
path: root/test/test_svs.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-05-14 13:25:49 -0400
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2019-05-16 20:32:41 -0400
commit4271c971919bb8defa3ca54f4a362676cd57bfb2 (patch)
tree12fbe708b49f04dc5c088a2deefba0c451d95b64 /test/test_svs.py
parentba65ca496af5766932a762bb99a758dbfcb580ec (diff)
tests: refactor. Replace literal constant w/ named constant.
* change literal packet count vlaues from 65 to a named constant of 67. (This value was recommended to exercise single, dual, and quad loops) Change-Id: Ieb1738dddacb8b6ea7fa25883032ac01a98399e1 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/test_svs.py')
-rw-r--r--test/test_svs.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/test/test_svs.py b/test/test_svs.py
index b4e6722baa8..9a9ac57016b 100644
--- a/test/test_svs.py
+++ b/test/test_svs.py
@@ -12,6 +12,8 @@ from scapy.layers.inet6 import IPv6
from vpp_papi import VppEnum
+NUM_PKTS = 67
+
class TestSVS(VppTestCase):
""" SVS Test Case """
@@ -127,12 +129,12 @@ class TestSVS(VppTestCase):
#
# now all the packets should be delivered out the respective interface
#
- self.send_and_expect(self.pg0, pkts_0[0] * 65, self.pg1)
- self.send_and_expect(self.pg0, pkts_0[1] * 65, self.pg2)
- self.send_and_expect(self.pg0, pkts_0[2] * 65, self.pg3)
- self.send_and_expect(self.pg1, pkts_1[0] * 65, self.pg1)
- self.send_and_expect(self.pg1, pkts_1[1] * 65, self.pg2)
- self.send_and_expect(self.pg1, pkts_1[2] * 65, self.pg3)
+ self.send_and_expect(self.pg0, pkts_0[0] * NUM_PKTS, self.pg1)
+ self.send_and_expect(self.pg0, pkts_0[1] * NUM_PKTS, self.pg2)
+ self.send_and_expect(self.pg0, pkts_0[2] * NUM_PKTS, self.pg3)
+ self.send_and_expect(self.pg1, pkts_1[0] * NUM_PKTS, self.pg1)
+ self.send_and_expect(self.pg1, pkts_1[1] * NUM_PKTS, self.pg2)
+ self.send_and_expect(self.pg1, pkts_1[2] * NUM_PKTS, self.pg3)
#
# check that if the SVS lookup does not match a route the packet
@@ -142,13 +144,13 @@ class TestSVS(VppTestCase):
IP(src=self.pg0.remote_ip4, dst=self.pg0.remote_ip4) /
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))
- self.send_and_expect(self.pg0, p * 65, self.pg0)
+ self.send_and_expect(self.pg0, p * NUM_PKTS, self.pg0)
p = (Ether(dst=self.pg1.local_mac, src=self.pg1.remote_mac) /
IP(src=self.pg1.remote_ip4, dst=self.pg1.remote_ip4) /
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))
- self.send_and_expect(self.pg1, p * 65, self.pg1)
+ self.send_and_expect(self.pg1, p * NUM_PKTS, self.pg1)
#
# dump the SVS configs
@@ -257,12 +259,12 @@ class TestSVS(VppTestCase):
#
# now all the packets should be delivered out the respective interface
#
- self.send_and_expect(self.pg0, pkts_0[0] * 65, self.pg1)
- self.send_and_expect(self.pg0, pkts_0[1] * 65, self.pg2)
- self.send_and_expect(self.pg0, pkts_0[2] * 65, self.pg3)
- self.send_and_expect(self.pg1, pkts_1[0] * 65, self.pg1)
- self.send_and_expect(self.pg1, pkts_1[1] * 65, self.pg2)
- self.send_and_expect(self.pg1, pkts_1[2] * 65, self.pg3)
+ self.send_and_expect(self.pg0, pkts_0[0] * NUM_PKTS, self.pg1)
+ self.send_and_expect(self.pg0, pkts_0[1] * NUM_PKTS, self.pg2)
+ self.send_and_expect(self.pg0, pkts_0[2] * NUM_PKTS, self.pg3)
+ self.send_and_expect(self.pg1, pkts_1[0] * NUM_PKTS, self.pg1)
+ self.send_and_expect(self.pg1, pkts_1[1] * NUM_PKTS, self.pg2)
+ self.send_and_expect(self.pg1, pkts_1[2] * NUM_PKTS, self.pg3)
#
# check that if the SVS lookup does not match a route the packet
@@ -272,13 +274,13 @@ class TestSVS(VppTestCase):
IPv6(src=self.pg0.remote_ip6, dst=self.pg0.remote_ip6) /
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))
- self.send_and_expect(self.pg0, p * 65, self.pg0)
+ self.send_and_expect(self.pg0, p * NUM_PKTS, self.pg0)
p = (Ether(dst=self.pg1.local_mac, src=self.pg1.remote_mac) /
IPv6(src=self.pg1.remote_ip6, dst=self.pg1.remote_ip6) /
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))
- self.send_and_expect(self.pg1, p * 65, self.pg1)
+ self.send_and_expect(self.pg1, p * NUM_PKTS, self.pg1)
#
# dump the SVS configs