summaryrefslogtreecommitdiffstats
path: root/test/test_abf.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_abf.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_abf.py')
-rw-r--r--test/test_abf.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/test/test_abf.py b/test/test_abf.py
index 1de36c92221..350af0dce07 100644
--- a/test/test_abf.py
+++ b/test/test_abf.py
@@ -14,6 +14,8 @@ from scapy.layers.inet6 import IPv6
from vpp_object import VppObject
+NUM_PKTS = 67
+
def find_abf_policy(test, id):
policies = test.vapi.abf_policy_dump()
@@ -216,7 +218,7 @@ class TestAbf(VppTestCase):
IP(src="1.1.1.1", dst="1.1.1.2") /
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))
- self.send_and_expect(self.pg0, p_1*65, self.pg1)
+ self.send_and_expect(self.pg0, p_1*NUM_PKTS, self.pg1)
#
# Attach a 'better' priority policy to the same interface
@@ -228,7 +230,7 @@ class TestAbf(VppTestCase):
attach_2 = VppAbfAttach(self, 11, self.pg0.sw_if_index, 40)
attach_2.add_vpp_config()
- self.send_and_expect(self.pg0, p_1*65, self.pg2)
+ self.send_and_expect(self.pg0, p_1*NUM_PKTS, self.pg2)
#
# Attach a policy with priority in the middle
@@ -240,13 +242,13 @@ class TestAbf(VppTestCase):
attach_3 = VppAbfAttach(self, 12, self.pg0.sw_if_index, 45)
attach_3.add_vpp_config()
- self.send_and_expect(self.pg0, p_1*65, self.pg2)
+ self.send_and_expect(self.pg0, p_1*NUM_PKTS, self.pg2)
#
# remove the best priority
#
attach_2.remove_vpp_config()
- self.send_and_expect(self.pg0, p_1*65, self.pg3)
+ self.send_and_expect(self.pg0, p_1*NUM_PKTS, self.pg3)
#
# Attach one of the same policies to Pg1
@@ -259,14 +261,14 @@ class TestAbf(VppTestCase):
IP(src="1.1.1.1", dst="1.1.1.2") /
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))
- self.send_and_expect(self.pg1, p_2 * 65, self.pg3)
+ self.send_and_expect(self.pg1, p_2 * NUM_PKTS, self.pg3)
#
# detach the policy from PG1, now expect traffic to be dropped
#
attach_4.remove_vpp_config()
- self.send_and_assert_no_replies(self.pg1, p_2 * 65, "Detached")
+ self.send_and_assert_no_replies(self.pg1, p_2 * NUM_PKTS, "Detached")
#
# Swap to route via a next-hop in the non-default table
@@ -287,7 +289,7 @@ class TestAbf(VppTestCase):
attach_5 = VppAbfAttach(self, 13, self.pg0.sw_if_index, 30)
attach_5.add_vpp_config()
- self.send_and_expect(self.pg0, p_1*65, self.pg4)
+ self.send_and_expect(self.pg0, p_1*NUM_PKTS, self.pg4)
self.pg4.unconfig_ip4()
self.pg4.set_table_ip4(0)
@@ -343,7 +345,7 @@ class TestAbf(VppTestCase):
# packets are dropped because there is no route to the policy's
# next hop
#
- self.send_and_assert_no_replies(self.pg1, p * 65, "no route")
+ self.send_and_assert_no_replies(self.pg1, p * NUM_PKTS, "no route")
#
# add a route resolving the next-hop
@@ -358,7 +360,7 @@ class TestAbf(VppTestCase):
#
# now expect packets forwarded.
#
- self.send_and_expect(self.pg0, p * 65, self.pg1)
+ self.send_and_expect(self.pg0, p * NUM_PKTS, self.pg1)
if __name__ == '__main__':